summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/peakmeter.c52
-rw-r--r--apps/recorder/peakmeter.h2
-rw-r--r--apps/recorder/recording.c32
3 files changed, 18 insertions, 68 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 48a695b933..5ff2f21215 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -97,10 +97,10 @@ static unsigned short pm_db_min = 0; /* minimum of range in 1/100 dB */
97static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */ 97static unsigned short pm_db_max = 9000; /* maximum of range in 1/100 dB */
98static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */ 98static unsigned short pm_db_range = 9000; /* range width in 1/100 dB */
99/* Timing behaviour */ 99/* Timing behaviour */
100static int pm_peak_hold = 1; /* peak hold timeout index */ 100static int pm_peak_hold = HZ / 5; /* peak hold timeout ticks */
101static int pm_peak_release = 8; /* peak release in units per read */ 101static int pm_peak_release = 8; /* peak release in units per read */
102static int pm_clip_hold = 16; /* clip hold timeout index */ 102static int pm_clip_hold = HZ * 60; /* clip hold timeout ticks */
103static bool pm_clip_eternal = false; /* true if clip timeout is disabled */ 103static bool pm_clip_eternal = false; /* true if clip timeout is disabled */
104 104
105#ifdef HAVE_RECORDING 105#ifdef HAVE_RECORDING
106static unsigned short trig_strt_threshold; 106static unsigned short trig_strt_threshold;
@@ -172,22 +172,6 @@ static int history_pos = 0;
172static void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales, 172static void peak_meter_draw(struct screen *display, struct meter_scales *meter_scales,
173 int x, int y, int width, int height); 173 int x, int y, int width, int height);
174 174
175/* time out values for max */
176static const short peak_time_out[] = {
177 0 * HZ, HZ / 5, 30, HZ / 2, HZ, 2 * HZ,
178 3 * HZ, 4 * HZ, 5 * HZ, 6 * HZ, 7 * HZ, 8 * HZ,
179 9 * HZ, 10 * HZ, 15 * HZ, 20 * HZ, 30 * HZ, 60 * HZ
180};
181
182/* time out values for clip */
183static const long clip_time_out[] = {
184 0 * HZ, 1 * HZ, 2 * HZ, 3 * HZ, 4 * HZ, 5 * HZ,
185 6 * HZ, 7 * HZ, 8 * HZ, 9 * HZ, 10 * HZ, 15 * HZ,
186 20 * HZ, 25 * HZ, 30 * HZ, 45 * HZ, 60 * HZ, 90 * HZ,
187 120 * HZ, 180 * HZ, 300 * HZ, 600L * HZ, 1200L * HZ,
188 2700L * HZ, 5400L * HZ
189};
190
191/* precalculated peak values that represent magical 175/* precalculated peak values that represent magical
192 dBfs values. Used to draw the scale */ 176 dBfs values. Used to draw the scale */
193static const short db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = { 177static const short db_scale_src_values[DB_SCALE_SRC_VALUES_SIZE] = {
@@ -522,18 +506,16 @@ void peak_meter_init_range( bool dbfs, int range_min, int range_max)
522 * Initialize the peak meter with all relevant values concerning times. 506 * Initialize the peak meter with all relevant values concerning times.
523 * @param int release - Set the maximum amount of pixels the meter is allowed 507 * @param int release - Set the maximum amount of pixels the meter is allowed
524 * to decrease with each redraw 508 * to decrease with each redraw
525 * @param int hold - Select the time preset for the time the peak indicator 509 * @param int hold_ms - Select the time in ms for the time the peak indicator
526 * is reset after a peak occurred. The preset values are 510 * is reset after a peak occurred.
527 * stored in peak_time_out. 511 * @param int clip_hold_sec - Select the time in seconds for the time the peak
528 * @param int clip_hold - Select the time preset for the time the peak 512 * indicator is reset after a peak occurred.
529 * indicator is reset after a peak occurred. The preset
530 * values are stored in clip_time_out.
531 */ 513 */
532void peak_meter_init_times(int release, int hold, int clip_hold) 514void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec)
533{ 515{
534 pm_peak_hold = hold; 516 pm_peak_hold = hold_ms/(1000UL/HZ); /* convert ms to ticks */
535 pm_peak_release = release; 517 pm_peak_release = release;
536 pm_clip_hold = clip_hold; 518 pm_clip_hold = HZ * clip_hold_sec;
537} 519}
538 520
539#ifdef HAVE_RECORDING 521#ifdef HAVE_RECORDING
@@ -657,8 +639,7 @@ void peak_meter_peek(void)
657 (left == MAX_PEAK - 1)) { 639 (left == MAX_PEAK - 1)) {
658#endif 640#endif
659 pm_clip_left = true; 641 pm_clip_left = true;
660 pm_clip_timeout_l = 642 pm_clip_timeout_l = current_tick + pm_clip_hold;
661 current_tick + clip_time_out[pm_clip_hold];
662 } 643 }
663 644
664#if CONFIG_CODEC == SWCODEC 645#if CONFIG_CODEC == SWCODEC
@@ -668,8 +649,7 @@ void peak_meter_peek(void)
668 (right == MAX_PEAK - 1)) { 649 (right == MAX_PEAK - 1)) {
669#endif 650#endif
670 pm_clip_right = true; 651 pm_clip_right = true;
671 pm_clip_timeout_r = 652 pm_clip_timeout_r = current_tick + pm_clip_hold;
672 current_tick + clip_time_out[pm_clip_hold];
673 } 653 }
674 654
675#ifdef HAVE_RECORDING 655#ifdef HAVE_RECORDING
@@ -1099,14 +1079,12 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales,
1099 /* check for new max values */ 1079 /* check for new max values */
1100 if (left > scales->pm_peak_left) { 1080 if (left > scales->pm_peak_left) {
1101 scales->pm_peak_left = left - 1; 1081 scales->pm_peak_left = left - 1;
1102 scales->pm_peak_timeout_l = 1082 scales->pm_peak_timeout_l = current_tick + pm_peak_hold;
1103 current_tick + peak_time_out[pm_peak_hold];
1104 } 1083 }
1105 1084
1106 if (right > scales->pm_peak_right) { 1085 if (right > scales->pm_peak_right) {
1107 scales->pm_peak_right = right - 1; 1086 scales->pm_peak_right = right - 1;
1108 scales->pm_peak_timeout_r = 1087 scales->pm_peak_timeout_r = current_tick + pm_peak_hold;
1109 current_tick + peak_time_out[pm_peak_hold];
1110 } 1088 }
1111 } 1089 }
1112 1090
diff --git a/apps/recorder/peakmeter.h b/apps/recorder/peakmeter.h
index 267ca20442..fc6c2183af 100644
--- a/apps/recorder/peakmeter.h
+++ b/apps/recorder/peakmeter.h
@@ -44,7 +44,7 @@ extern int peak_meter_draw_get_btn(int action_context, int x[], int y[],
44extern void peak_meter_set_clip_hold(int time); 44extern void peak_meter_set_clip_hold(int time);
45extern void peak_meter_peek(void); 45extern void peak_meter_peek(void);
46extern void peak_meter_init_range( bool dbfs, int range_min, int range_max); 46extern void peak_meter_init_range( bool dbfs, int range_min, int range_max);
47extern void peak_meter_init_times(int release, int hold, int clip_hold); 47extern void peak_meter_init_times(int release, int hold_ms, int clip_hold_sec);
48#ifdef HAVE_AGC 48#ifdef HAVE_AGC
49extern void peak_meter_get_peakhold(int *peak_left, int *peak_right); 49extern void peak_meter_get_peakhold(int *peak_left, int *peak_right);
50#endif 50#endif
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index d47773071f..0098fea007 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -78,34 +78,6 @@
78#include "appevents.h" 78#include "appevents.h"
79 79
80#ifdef HAVE_RECORDING 80#ifdef HAVE_RECORDING
81/* This array holds the record timer interval lengths, in minutes */
82static const unsigned short rec_timer_minutes[] =
83{
84 0, /* 0 means OFF */
85 5, /* 00:05 */
86 10, /* 00:10 */
87 15, /* 00:15 */
88 30, /* 00:30 */
89 60, /* 01:00 */
90 74, /* 01:14 */
91 80, /* 01:20 */
92 2*60, /* 02:00 */
93 4*60, /* 04:00 */
94 6*60, /* 06:00 */
95 8*60, /* 08:00 */
96 10*60, /* 10:00 */
97 12*60, /* 12:00 */
98 18*60, /* 18:00 */
99 24*60 /* 24:00 */
100};
101
102static unsigned int rec_timesplit_seconds(void)
103{
104 unsigned long tm_min = rec_timer_minutes[global_settings.rec_timesplit];
105 unsigned long tm_sec = tm_min * 60;
106 return tm_sec;
107}
108
109/* This array holds the record size interval lengths, in mebibytes */ 81/* This array holds the record size interval lengths, in mebibytes */
110static const unsigned short rec_size_mbytes[] = 82static const unsigned short rec_size_mbytes[] =
111{ 83{
@@ -1003,8 +975,8 @@ bool recording_screen(bool no_source)
1003 int audio_stat = 0; /* status of the audio system */ 975 int audio_stat = 0; /* status of the audio system */
1004 int last_audio_stat = -1; /* previous status so we can act on changes */ 976 int last_audio_stat = -1; /* previous status so we can act on changes */
1005 struct viewport vp_list[NB_SCREENS], vp_top[NB_SCREENS]; /* the viewports */ 977 struct viewport vp_list[NB_SCREENS], vp_top[NB_SCREENS]; /* the viewports */
1006 const long split_seconds = rec_timesplit_seconds(); 978 const unsigned long split_seconds = (unsigned) global_settings.rec_timesplit;
1007 const long split_bytes = rec_sizesplit_bytes(); 979 const unsigned long split_bytes = rec_sizesplit_bytes();
1008 980
1009#if CONFIG_CODEC == SWCODEC 981#if CONFIG_CODEC == SWCODEC
1010 int warning_counter = 0; 982 int warning_counter = 0;