summaryrefslogtreecommitdiff
path: root/apps/plugins/fft/fft.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/fft/fft.c')
-rw-r--r--apps/plugins/fft/fft.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c
index eeb6611488..4719446475 100644
--- a/apps/plugins/fft/fft.c
+++ b/apps/plugins/fft/fft.c
@@ -334,16 +334,7 @@ GREY_INFO_STRUCT
334# define FFT_AMP_SCALE BUTTON_PLAY 334# define FFT_AMP_SCALE BUTTON_PLAY
335# define FFT_QUIT BUTTON_POWER 335# define FFT_QUIT BUTTON_POWER
336 336
337#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) 337#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) || (CONFIG_KEYPAD == XDUOO_X20_PAD)
338# define FFT_PREV_GRAPH BUTTON_PREV
339# define FFT_NEXT_GRAPH BUTTON_NEXT
340# define FFT_ORIENTATION BUTTON_HOME
341# define FFT_FREQ_SCALE BUTTON_OPTION
342# define FFT_WINDOW (BUTTON_HOME|BUTTON_POWER)
343# define FFT_AMP_SCALE BUTTON_PLAY
344# define FFT_QUIT BUTTON_POWER
345
346#elif (CONFIG_KEYPAD == XDUOO_X20_PAD)
347# define FFT_PREV_GRAPH BUTTON_PREV 338# define FFT_PREV_GRAPH BUTTON_PREV
348# define FFT_NEXT_GRAPH BUTTON_NEXT 339# define FFT_NEXT_GRAPH BUTTON_NEXT
349# define FFT_ORIENTATION BUTTON_HOME 340# define FFT_ORIENTATION BUTTON_HOME
@@ -361,7 +352,7 @@ GREY_INFO_STRUCT
361# define FFT_AMP_SCALE BUTTON_PLAY 352# define FFT_AMP_SCALE BUTTON_PLAY
362# define FFT_QUIT BUTTON_POWER 353# define FFT_QUIT BUTTON_POWER
363 354
364#elif (CONFIG_KEYPAD == IHIFI_770_PAD) 355#elif (CONFIG_KEYPAD == IHIFI_770_PAD) || (CONFIG_KEYPAD == IHIFI_800_PAD)
365# define FFT_PREV_GRAPH BUTTON_PREV 356# define FFT_PREV_GRAPH BUTTON_PREV
366# define FFT_NEXT_GRAPH BUTTON_NEXT 357# define FFT_NEXT_GRAPH BUTTON_NEXT
367# define FFT_ORIENTATION BUTTON_HOME 358# define FFT_ORIENTATION BUTTON_HOME
@@ -370,13 +361,13 @@ GREY_INFO_STRUCT
370# define FFT_AMP_SCALE BUTTON_PLAY 361# define FFT_AMP_SCALE BUTTON_PLAY
371# define FFT_QUIT BUTTON_POWER 362# define FFT_QUIT BUTTON_POWER
372 363
373#elif (CONFIG_KEYPAD == IHIFI_800_PAD) 364#elif (CONFIG_KEYPAD == EROSQ_PAD)
374# define FFT_PREV_GRAPH BUTTON_PREV 365# define FFT_PREV_GRAPH BUTTON_SCROLL_BACK
375# define FFT_NEXT_GRAPH BUTTON_NEXT 366# define FFT_NEXT_GRAPH BUTTON_SCROLL_FWD
376# define FFT_ORIENTATION BUTTON_HOME 367# define FFT_ORIENTATION BUTTON_VOL_UP
377# define FFT_FREQ_SCALE BUTTON_VOL_UP 368# define FFT_FREQ_SCALE BUTTON_VOL_DOWN
378# define FFT_WINDOW BUTTON_VOL_DOWN 369# define FFT_WINDOW BUTTON_BACK
379# define FFT_AMP_SCALE BUTTON_PLAY 370# define FFT_AMP_SCALE BUTTON_MENU
380# define FFT_QUIT BUTTON_POWER 371# define FFT_QUIT BUTTON_POWER
381 372
382#elif !defined(HAVE_TOUCHSCREEN) 373#elif !defined(HAVE_TOUCHSCREEN)
@@ -530,7 +521,7 @@ static struct fft_config
530 int amp_scale; 521 int amp_scale;
531 int freq_scale; 522 int freq_scale;
532 int window_func; 523 int window_func;
533} fft_disk = 524} fft_disk =
534{ 525{
535 /* Defaults */ 526 /* Defaults */
536 .orientation = FFT_OR_VERT, 527 .orientation = FFT_OR_VERT,
@@ -647,7 +638,7 @@ static void apply_window_func(enum fft_window_func mode)
647/* Calculates the magnitudes from complex numbers and returns the maximum */ 638/* Calculates the magnitudes from complex numbers and returns the maximum */
648static unsigned calc_magnitudes(enum fft_amp_scale scale) 639static unsigned calc_magnitudes(enum fft_amp_scale scale)
649{ 640{
650 /* A major assumption made when calculating the Q*MAX constants 641 /* A major assumption made when calculating the Q*MAX constants
651 * is that the maximum magnitude is 29 bits long. */ 642 * is that the maximum magnitude is 29 bits long. */
652 unsigned this_max = 0; 643 unsigned this_max = 0;
653 kiss_fft_cpx *this_output = output[output_head] + 1; /* skip DC */ 644 kiss_fft_cpx *this_output = output[output_head] + 1; /* skip DC */
@@ -806,7 +797,7 @@ static void draw_lines_vertical(unsigned this_max, unsigned graph_max)
806 { 797 {
807 int bins_acc = LCD_WIDTH / 2; 798 int bins_acc = LCD_WIDTH / 2;
808 unsigned bins_max = 0; 799 unsigned bins_max = 0;
809 800
810 for(int i = 0, x = 0; i < ARRAYLEN_PLOT; ++i) 801 for(int i = 0, x = 0; i < ARRAYLEN_PLOT; ++i)
811 { 802 {
812 unsigned bin = plot[i]; 803 unsigned bin = plot[i];
@@ -1107,7 +1098,7 @@ static inline bool fft_get_fft(void)
1107 /* This block can introduce discontinuities in our data. Meaning, the 1098 /* This block can introduce discontinuities in our data. Meaning, the
1108 * FFT will not be done a continuous segment of the signal. Which can 1099 * FFT will not be done a continuous segment of the signal. Which can
1109 * be bad. Or not. 1100 * be bad. Or not.
1110 * 1101 *
1111 * Anyway, this is a demo, not a scientific tool. If you want accuracy, 1102 * Anyway, this is a demo, not a scientific tool. If you want accuracy,
1112 * do a proper spectrum analysis.*/ 1103 * do a proper spectrum analysis.*/
1113 1104
@@ -1409,7 +1400,7 @@ static void fft_setting_update(unsigned which)
1409 [FFT_OR_HORZ] = draw_bars_horizontal, 1400 [FFT_OR_HORZ] = draw_bars_horizontal,
1410 [FFT_OR_VERT] = draw_bars_vertical, 1401 [FFT_OR_VERT] = draw_bars_vertical,
1411 }, 1402 },
1412 [FFT_DM_SPECTROGRAM] = 1403 [FFT_DM_SPECTROGRAM] =
1413 { 1404 {
1414 [FFT_OR_HORZ] = draw_spectrogram_horizontal, 1405 [FFT_OR_HORZ] = draw_spectrogram_horizontal,
1415 [FFT_OR_VERT] = draw_spectrogram_vertical, 1406 [FFT_OR_VERT] = draw_spectrogram_vertical,
@@ -1533,7 +1524,7 @@ static void fft_cleanup(void)
1533{ 1524{
1534 myosd_destroy(); 1525 myosd_destroy();
1535 1526
1536 fft_close_fft(); 1527 fft_close_fft();
1537 1528
1538#ifdef HAVE_ADJUSTABLE_CPU_FREQ 1529#ifdef HAVE_ADJUSTABLE_CPU_FREQ
1539 rb->cancel_cpu_boost(); 1530 rb->cancel_cpu_boost();