summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-06-29 06:37:04 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-06-29 06:37:04 +0000
commita2b6703a369f6cdbfec1f150c408dadc877631fb (patch)
tree3145a8c1372c44711d38feefeba39c7d4098f139 /apps/plugins
parent8411614b8a068a4f274c3841aa55aab1df1bc246 (diff)
downloadrockbox-a2b6703a369f6cdbfec1f150c408dadc877631fb.tar.gz
rockbox-a2b6703a369f6cdbfec1f150c408dadc877631fb.zip
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')
-rw-r--r--apps/plugins/fft/fft.c13
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)
1137/********************* End of plotting functions (modes) *********************/ 1137/********************* End of plotting functions (modes) *********************/
1138 1138
1139/****************************** FFT functions ********************************/ 1139/****************************** FFT functions ********************************/
1140static bool is_playing(void)
1141{
1142 return rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) == CHANNEL_PLAYING;
1143}
1140 1144
1141/** functions use in single/multi configuration **/ 1145/** functions use in single/multi configuration **/
1142static inline bool fft_init_fft_lib(void) 1146static inline bool fft_init_fft_lib(void)
@@ -1156,7 +1160,8 @@ static inline bool fft_init_fft_lib(void)
1156static inline bool fft_get_fft(void) 1160static inline bool fft_get_fft(void)
1157{ 1161{
1158 int count; 1162 int count;
1159 int16_t *value = (int16_t *) rb->pcm_get_peak_buffer(&count); 1163 int16_t *value =
1164 (int16_t *) rb->mixer_channel_get_buffer(PCM_MIXER_CHAN_PLAYBACK, &count);
1160 /* This block can introduce discontinuities in our data. Meaning, the 1165 /* This block can introduce discontinuities in our data. Meaning, the
1161 * FFT will not be done a continuous segment of the signal. Which can 1166 * FFT will not be done a continuous segment of the signal. Which can
1162 * be bad. Or not. 1167 * be bad. Or not.
@@ -1214,7 +1219,7 @@ static void fft_thread_entry(void)
1214 1219
1215 while(fft_thread_run) 1220 while(fft_thread_run)
1216 { 1221 {
1217 if (!rb->pcm_is_playing()) 1222 if (!is_playing())
1218 { 1223 {
1219 rb->sleep(HZ/5); 1224 rb->sleep(HZ/5);
1220 continue; 1225 continue;
@@ -1296,7 +1301,7 @@ static void fft_close_fft(void)
1296 * target uses IRAM */ 1301 * target uses IRAM */
1297static bool fft_have_fft(void) 1302static bool fft_have_fft(void)
1298{ 1303{
1299 return rb->pcm_is_playing() && fft_get_fft(); 1304 return is_playing() && fft_get_fft();
1300} 1305}
1301 1306
1302static inline void fft_free_fft_output(void) 1307static inline void fft_free_fft_output(void)
@@ -1366,7 +1371,7 @@ enum plugin_status plugin_start(const void* parameter)
1366 { 1371 {
1367 int timeout; 1372 int timeout;
1368 1373
1369 if(!rb->pcm_is_playing()) 1374 if(!is_playing())
1370 { 1375 {
1371 showing_warning = true; 1376 showing_warning = true;
1372 mylcd_clear_display(); 1377 mylcd_clear_display();