diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-06-29 06:37:04 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-06-29 06:37:04 +0000 |
commit | a2b6703a369f6cdbfec1f150c408dadc877631fb (patch) | |
tree | 3145a8c1372c44711d38feefeba39c7d4098f139 /apps/plugins/fft/fft.c | |
parent | 8411614b8a068a4f274c3841aa55aab1df1bc246 (diff) |
Commit FS#12150 - Fully-functional audio mixer - and finally whip old limitations about playback of voice and other sounds when paused. Channels are independent in state and amplitude. Fade on stop/pause is handled by the channel's volume control rather than global volume which means it now works from anywhere. Opens up the possibility of plugin sounds during music playback by merely adding an additional channel enum. If any PCM drivers were not properly modified, see one of the last comments in the task for a description of the simple change that is expected. Some params are tunable in firmware/export/pcm-mixer.h as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30097 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/fft/fft.c')
-rw-r--r-- | apps/plugins/fft/fft.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index b6b1e2fead..a920f8c7f1 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -1137,6 +1137,10 @@ static void draw_spectrogram_horizontal(void) /********************* End of plotting functions (modes) *********************/ /****************************** FFT functions ********************************/ +static bool is_playing(void) +{ + return rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) == CHANNEL_PLAYING; +} /** functions use in single/multi configuration **/ static inline bool fft_init_fft_lib(void) @@ -1156,7 +1160,8 @@ static inline bool fft_init_fft_lib(void) static inline bool fft_get_fft(void) { int count; - int16_t *value = (int16_t *) rb->pcm_get_peak_buffer(&count); + int16_t *value = + (int16_t *) rb->mixer_channel_get_buffer(PCM_MIXER_CHAN_PLAYBACK, &count); /* This block can introduce discontinuities in our data. Meaning, the * FFT will not be done a continuous segment of the signal. Which can * be bad. Or not. @@ -1214,7 +1219,7 @@ static void fft_thread_entry(void) while(fft_thread_run) { - if (!rb->pcm_is_playing()) + if (!is_playing()) { rb->sleep(HZ/5); continue; @@ -1296,7 +1301,7 @@ static void fft_close_fft(void) * target uses IRAM */ static bool fft_have_fft(void) { - return rb->pcm_is_playing() && fft_get_fft(); + return is_playing() && fft_get_fft(); } static inline void fft_free_fft_output(void) @@ -1366,7 +1371,7 @@ enum plugin_status plugin_start(const void* parameter) { int timeout; - if(!rb->pcm_is_playing()) + if(!is_playing()) { showing_warning = true; mylcd_clear_display(); |