diff options
Diffstat (limited to 'apps/recorder/peakmeter.c')
-rw-r--r-- | apps/recorder/peakmeter.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 0481e25acd..8bb771e9b3 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c | |||
@@ -68,6 +68,7 @@ static unsigned short db_min = 0; | |||
68 | static unsigned short db_max = 9000; | 68 | static unsigned short db_max = 9000; |
69 | static unsigned short db_range = 9000; | 69 | static unsigned short db_range = 9000; |
70 | 70 | ||
71 | #ifdef HAVE_RECORDING | ||
71 | static unsigned short trig_strt_threshold; | 72 | static unsigned short trig_strt_threshold; |
72 | static long trig_strt_duration; | 73 | static long trig_strt_duration; |
73 | static long trig_strt_dropout; | 74 | static long trig_strt_dropout; |
@@ -81,10 +82,11 @@ static long trig_hightime; | |||
81 | /* point in time when the volume fell below the threshold*/ | 82 | /* point in time when the volume fell below the threshold*/ |
82 | static long trig_lowtime; | 83 | static long trig_lowtime; |
83 | 84 | ||
84 | /* The output value of the trigger. See TRIG_XXX constants vor valid values */ | 85 | /* The output value of the trigger. See TRIG_XXX constants for valid values */ |
85 | static int trig_status = TRIG_OFF; | 86 | static int trig_status = TRIG_OFF; |
86 | 87 | ||
87 | static void (*trigger_listener)(int) = NULL; | 88 | static void (*trigger_listener)(int) = NULL; |
89 | #endif | ||
88 | 90 | ||
89 | #if CONFIG_HWCODEC == MASNONE | 91 | #if CONFIG_HWCODEC == MASNONE |
90 | #define MAS_REG_DQPEAK_L 0 | 92 | #define MAS_REG_DQPEAK_L 0 |
@@ -176,21 +178,6 @@ static const int db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = { | |||
176 | }; | 178 | }; |
177 | #endif | 179 | #endif |
178 | 180 | ||
179 | const char* peak_meter_dbnames[DB_SCALE_SRC_VALUES_SIZE] = { | ||
180 | "0 db", | ||
181 | "-3 db", | ||
182 | "-6 db", | ||
183 | "-9 db", | ||
184 | "-12 db", | ||
185 | "-18 db", | ||
186 | "-24 db", | ||
187 | "-30 db", | ||
188 | "-40 db", | ||
189 | "-50 db", | ||
190 | "-60 db", | ||
191 | "-inf", | ||
192 | }; | ||
193 | |||
194 | static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE; | 181 | static int db_scale_count = DB_SCALE_SRC_VALUES_SIZE; |
195 | 182 | ||
196 | /* if db_scale_valid is false the content of | 183 | /* if db_scale_valid is false the content of |
@@ -540,6 +527,7 @@ void peak_meter_playback(bool playback) | |||
540 | #endif | 527 | #endif |
541 | } | 528 | } |
542 | 529 | ||
530 | #ifdef HAVE_RECORDING | ||
543 | static void set_trig_status(int new_state) { | 531 | static void set_trig_status(int new_state) { |
544 | if (trig_status != new_state) { | 532 | if (trig_status != new_state) { |
545 | trig_status = new_state; | 533 | trig_status = new_state; |
@@ -548,6 +536,7 @@ static void set_trig_status(int new_state) { | |||
548 | } | 536 | } |
549 | } | 537 | } |
550 | } | 538 | } |
539 | #endif | ||
551 | 540 | ||
552 | /** | 541 | /** |
553 | * Reads peak values from the MAS, and detects clips. The | 542 | * Reads peak values from the MAS, and detects clips. The |
@@ -591,6 +580,7 @@ inline void peak_meter_peek(void) | |||
591 | current_tick + clip_time_out[peak_meter_clip_hold]; | 580 | current_tick + clip_time_out[peak_meter_clip_hold]; |
592 | } | 581 | } |
593 | 582 | ||
583 | #ifdef HAVE_RECORDING | ||
594 | switch (trig_status) { | 584 | switch (trig_status) { |
595 | case TRIG_READY: | 585 | case TRIG_READY: |
596 | /* no more changes, if trigger was activated as release trigger */ | 586 | /* no more changes, if trigger was activated as release trigger */ |
@@ -705,6 +695,7 @@ inline void peak_meter_peek(void) | |||
705 | } | 695 | } |
706 | break; | 696 | break; |
707 | } | 697 | } |
698 | #endif | ||
708 | 699 | ||
709 | /* peaks are searched -> we have to find the maximum. When | 700 | /* peaks are searched -> we have to find the maximum. When |
710 | many calls of peak_meter_peek the maximum value will be | 701 | many calls of peak_meter_peek the maximum value will be |
@@ -971,6 +962,7 @@ void peak_meter_draw(int x, int y, int width, int height) { | |||
971 | lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1); | 962 | lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1); |
972 | } | 963 | } |
973 | 964 | ||
965 | #ifdef HAVE_RECORDING | ||
974 | if (trig_status != TRIG_OFF) { | 966 | if (trig_status != TRIG_OFF) { |
975 | int start_trigx, stop_trigx, ycenter; | 967 | int start_trigx, stop_trigx, ycenter; |
976 | 968 | ||
@@ -984,8 +976,8 @@ void peak_meter_draw(int x, int y, int width, int height) { | |||
984 | stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); | 976 | stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); |
985 | lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter); | 977 | lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter); |
986 | if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); | 978 | if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); |
987 | |||
988 | } | 979 | } |
980 | #endif | ||
989 | 981 | ||
990 | #ifdef PM_DEBUG | 982 | #ifdef PM_DEBUG |
991 | /* display a bar to show how many calls to peak_meter_peek | 983 | /* display a bar to show how many calls to peak_meter_peek |
@@ -1011,6 +1003,7 @@ void peak_meter_draw(int x, int y, int width, int height) { | |||
1011 | last_right = right; | 1003 | last_right = right; |
1012 | } | 1004 | } |
1013 | 1005 | ||
1006 | #ifdef HAVE_RECORDING | ||
1014 | /** | 1007 | /** |
1015 | * Defines the parameters of the trigger. After these parameters are defined | 1008 | * Defines the parameters of the trigger. After these parameters are defined |
1016 | * the trigger can be started either by peak_meter_attack_trigger or by | 1009 | * the trigger can be started either by peak_meter_attack_trigger or by |
@@ -1142,6 +1135,7 @@ void peak_meter_draw_trig(int xpos, int ypos) { | |||
1142 | } | 1135 | } |
1143 | 1136 | ||
1144 | } | 1137 | } |
1138 | #endif | ||
1145 | 1139 | ||
1146 | int peak_meter_draw_get_btn(int x, int y, int width, int height) | 1140 | int peak_meter_draw_get_btn(int x, int y, int width, int height) |
1147 | { | 1141 | { |