summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c56
1 files changed, 24 insertions, 32 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index c2b2360df1..28b3a44b3a 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -121,37 +121,28 @@ static unsigned long rec_sizesplit_bytes(void)
121{ 121{
122 return rec_size_bytes[global_settings.rec_sizesplit]; 122 return rec_size_bytes[global_settings.rec_sizesplit];
123} 123}
124/*
125 * Time strings used for the trigger durations.
126 * Keep synchronous to trigger_times in settings_apply_trigger
127 */
128const struct opt_items trig_durations[TRIG_DURATION_COUNT] =
129{
130#define TS(x) { (unsigned char *)(#x "s"), TALK_ID(x, UNIT_SEC) }
131#define TM(x) { (unsigned char *)(#x "min"), TALK_ID(x, UNIT_MIN) }
132 TS(0), TS(1), TS(2), TS(5),
133 TS(10), TS(15), TS(20), TS(25), TS(30),
134 TM(1), TM(2), TM(5), TM(10)
135#undef TS
136#undef TM
137};
138 124
139void settings_apply_trigger(void) 125void settings_apply_trigger(void)
140{ 126{
141 /* Keep synchronous to trig_durations and trig_durations_conf*/ 127 int start_thres, stop_thres;
142 static const long trigger_times[TRIG_DURATION_COUNT] = { 128 if (global_settings.peak_meter_dbfs)
143 0, HZ, 2*HZ, 5*HZ, 129 {
144 10*HZ, 15*HZ, 20*HZ, 25*HZ, 30*HZ, 130 start_thres = global_settings.rec_start_thres_db - 1;
145 60*HZ, 2*60*HZ, 5*60*HZ, 10*60*HZ 131 stop_thres = global_settings.rec_stop_thres_db - 1;
146 }; 132 }
133 else
134 {
135 start_thres = global_settings.rec_start_thres_linear;
136 stop_thres = global_settings.rec_stop_thres_linear;
137 }
147 138
148 peak_meter_define_trigger( 139 peak_meter_define_trigger(
149 global_settings.rec_start_thres, 140 start_thres,
150 trigger_times[global_settings.rec_start_duration], 141 global_settings.rec_start_duration*HZ,
151 MIN(trigger_times[global_settings.rec_start_duration] / 2, 2*HZ), 142 MIN(global_settings.rec_start_duration*HZ / 2, 2*HZ),
152 global_settings.rec_stop_thres, 143 stop_thres,
153 trigger_times[global_settings.rec_stop_postrec], 144 global_settings.rec_stop_postrec*HZ,
154 trigger_times[global_settings.rec_stop_gap] 145 global_settings.rec_stop_gap*HZ
155 ); 146 );
156} 147}
157/* recording screen status flags */ 148/* recording screen status flags */
@@ -784,12 +775,12 @@ static void trigger_listener(int trigger_status)
784 else 775 else
785 { 776 {
786 if((audio_status() & AUDIO_STATUS_PAUSE) && 777 if((audio_status() & AUDIO_STATUS_PAUSE) &&
787 (global_settings.rec_trigger_type == 1)) 778 (global_settings.rec_trigger_type == TRIG_TYPE_PAUSE))
788 { 779 {
789 rec_command(RECORDING_CMD_RESUME); 780 rec_command(RECORDING_CMD_RESUME);
790 } 781 }
791 /* New file on trig start*/ 782 /* New file on trig start*/
792 else if (global_settings.rec_trigger_type != 2) 783 else if (global_settings.rec_trigger_type != TRIG_TYPE_NEW_FILE)
793 { 784 {
794 rec_command(RECORDING_CMD_START_NEWFILE); 785 rec_command(RECORDING_CMD_START_NEWFILE);
795 /* tell recording_screen to reset the time */ 786 /* tell recording_screen to reset the time */
@@ -804,15 +795,15 @@ static void trigger_listener(int trigger_status)
804 { 795 {
805 switch(global_settings.rec_trigger_type) 796 switch(global_settings.rec_trigger_type)
806 { 797 {
807 case 0: /* Stop */ 798 case TRIG_TYPE_STOP: /* Stop */
808 rec_command(RECORDING_CMD_STOP); 799 rec_command(RECORDING_CMD_STOP);
809 break; 800 break;
810 801
811 case 1: /* Pause */ 802 case TRIG_TYPE_PAUSE: /* Pause */
812 rec_command(RECORDING_CMD_PAUSE); 803 rec_command(RECORDING_CMD_PAUSE);
813 break; 804 break;
814 805
815 case 2: /* New file on trig stop*/ 806 case TRIG_TYPE_NEW_FILE: /* New file on trig stop*/
816 rec_command(RECORDING_CMD_START_NEWFILE); 807 rec_command(RECORDING_CMD_START_NEWFILE);
817 /* tell recording_screen to reset the time */ 808 /* tell recording_screen to reset the time */
818 last_seconds = 0; 809 last_seconds = 0;
@@ -1036,7 +1027,8 @@ bool recording_screen(bool no_source)
1036#endif /* CONFIG_LED */ 1027#endif /* CONFIG_LED */
1037 1028
1038 /* Wait for a button a while (HZ/10) drawing the peak meter */ 1029 /* Wait for a button a while (HZ/10) drawing the peak meter */
1039 button = peak_meter_draw_get_btn(pm_x, pm_y, h * PM_HEIGHT, 1030 button = peak_meter_draw_get_btn(CONTEXT_RECSCREEN,
1031 pm_x, pm_y, h * PM_HEIGHT,
1040 screen_update); 1032 screen_update);
1041 1033
1042 if (last_audio_stat != audio_stat) 1034 if (last_audio_stat != audio_stat)