summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
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();