Bump version numbers for 3.13
[maemo-rb.git] / apps / menus / recording_menu.c
blob21686ab3da2bf75df7b029c31c9177c4ee46facf
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <stdbool.h>
26 #include "string.h"
27 #include "system.h"
28 #include "kernel.h"
29 #include "lcd.h"
30 #include "menu.h"
31 #include "button.h"
32 #include "mp3_playback.h"
33 #include "settings.h"
34 #include "screens.h"
35 #include "icons.h"
36 #ifdef HAVE_LCD_BITMAP
37 #include "font.h"
38 #include "scrollbar.h"
39 #endif
40 #include "lang.h"
41 #include "talk.h"
42 #include "misc.h"
43 #include "sound.h"
44 #ifdef HAVE_RECORDING
45 #include "audio.h"
46 #if CONFIG_TUNER
47 #include "radio.h"
48 #endif
49 #endif
50 #ifdef HAVE_RECORDING
51 #include "peakmeter.h"
52 #endif
53 #include "splash.h"
54 #if CONFIG_CODEC == SWCODEC
55 #include "metadata.h"
56 #include "menus/eq_menu.h"
57 #ifdef HAVE_RECORDING
58 #include "enc_config.h"
59 #endif
60 #include "general.h"
61 #endif
62 #include "action.h"
63 #include "recording.h"
64 #include "sound_menu.h"
65 #include "option_select.h"
66 #include "settings_list.h"
67 #include "list.h"
68 #include "viewport.h"
69 #include "exported_menus.h"
71 static bool no_source_in_menu = false;
72 static int recmenu_callback(int action,const struct menu_item_ex *this_item);
74 static int recsource_func(void)
76 int n_opts = REC_NUM_SOURCES;
78 static const struct opt_items names[AUDIO_NUM_SOURCES] = {
79 HAVE_MIC_REC_([AUDIO_SRC_MIC]
80 = { STR(LANG_RECORDING_SRC_MIC) },)
81 HAVE_LINE_REC_([AUDIO_SRC_LINEIN]
82 = { STR(LANG_LINE_IN) },)
83 HAVE_SPDIF_REC_([AUDIO_SRC_SPDIF]
84 = { STR(LANG_RECORDING_SRC_DIGITAL) },)
85 HAVE_FMRADIO_REC_([AUDIO_SRC_FMRADIO]
86 = { STR(LANG_FM_RADIO) },)
89 /* caveat: assumes it's the last item! */
90 #ifdef HAVE_FMRADIO_REC
91 if (!radio_hardware_present())
92 n_opts--;
93 #endif
95 return set_option(str(LANG_RECORDING_SOURCE),
96 &global_settings.rec_source, INT, names,
97 n_opts, NULL );
99 MENUITEM_FUNCTION(recsource, 0, ID2P(LANG_RECORDING_SOURCE),
100 recsource_func, NULL, recmenu_callback, Icon_Menu_setting);
102 #if CONFIG_CODEC == SWCODEC
103 /* Makes an options list from a source list of options and indexes */
104 static void make_options_from_indexes(const struct opt_items *src_names,
105 const long *src_indexes,
106 int n_indexes,
107 struct opt_items *dst_names)
109 while (--n_indexes >= 0)
110 dst_names[n_indexes] = src_names[src_indexes[n_indexes]];
111 } /* make_options_from_indexes */
114 #endif /* CONFIG_CODEC == SWCODEC */
116 static int recfrequency_func(void)
118 #if CONFIG_CODEC == MAS3587F
119 static const struct opt_items names[6] = {
120 { "44.1kHz", TALK_ID(44, UNIT_KHZ) },
121 { "48kHz", TALK_ID(48, UNIT_KHZ) },
122 { "32kHz", TALK_ID(32, UNIT_KHZ) },
123 { "22.05kHz", TALK_ID(22, UNIT_KHZ) },
124 { "24kHz", TALK_ID(24, UNIT_KHZ) },
125 { "16kHz", TALK_ID(16, UNIT_KHZ) }
127 return set_option(str(LANG_RECORDING_FREQUENCY),
128 &global_settings.rec_frequency, INT,
129 names, 6, NULL );
130 #endif /* CONFIG_CODEC == MAS3587F */
132 #if CONFIG_CODEC == SWCODEC
133 static const struct opt_items names[REC_NUM_FREQ] = {
134 REC_HAVE_96_([REC_FREQ_96] = { "96kHz", TALK_ID(96, UNIT_KHZ) },)
135 REC_HAVE_88_([REC_FREQ_88] = { "88.2kHz", TALK_ID(88, UNIT_KHZ) },)
136 REC_HAVE_64_([REC_FREQ_64] = { "64kHz", TALK_ID(64, UNIT_KHZ) },)
137 REC_HAVE_48_([REC_FREQ_48] = { "48kHz", TALK_ID(48, UNIT_KHZ) },)
138 REC_HAVE_44_([REC_FREQ_44] = { "44.1kHz", TALK_ID(44, UNIT_KHZ) },)
139 REC_HAVE_32_([REC_FREQ_32] = { "32kHz", TALK_ID(32, UNIT_KHZ) },)
140 REC_HAVE_24_([REC_FREQ_24] = { "24kHz", TALK_ID(24, UNIT_KHZ) },)
141 REC_HAVE_22_([REC_FREQ_22] = { "22.05kHz", TALK_ID(22, UNIT_KHZ) },)
142 REC_HAVE_16_([REC_FREQ_16] = { "16kHz", TALK_ID(16, UNIT_KHZ) },)
143 REC_HAVE_12_([REC_FREQ_12] = { "12kHz", TALK_ID(12, UNIT_KHZ) },)
144 REC_HAVE_11_([REC_FREQ_11] = { "11.025kHz", TALK_ID(11, UNIT_KHZ) },)
145 REC_HAVE_8_( [REC_FREQ_8 ] = { "8kHz", TALK_ID( 8, UNIT_KHZ) },)
148 struct opt_items opts[REC_NUM_FREQ];
149 unsigned long table[REC_NUM_FREQ];
150 int n_opts;
151 int rec_frequency;
152 bool ret;
154 #ifdef HAVE_SPDIF_REC
155 if (global_settings.rec_source == REC_SRC_SPDIF)
157 /* Inform user that frequency follows the source's frequency */
158 opts[0].string = ID2P(LANG_SOURCE_FREQUENCY);
159 opts[0].voice_id = LANG_SOURCE_FREQUENCY;
160 n_opts = 1;
161 rec_frequency = 0;
163 else
164 #endif
166 struct encoder_caps caps;
167 struct encoder_config cfg;
169 cfg.rec_format = global_settings.rec_format;
170 global_to_encoder_config(&cfg);
172 if (!enc_get_caps(&cfg, &caps, true))
173 return false;
175 /* Construct samplerate menu based upon encoder settings */
176 n_opts = make_list_from_caps32(REC_SAMPR_CAPS, NULL,
177 caps.samplerate_caps, table);
179 if (n_opts == 0)
180 return false; /* No common flags...?? */
182 make_options_from_indexes(names, table, n_opts, opts);
184 /* Find closest rate that the potentially restricted list
185 comes to */
186 make_list_from_caps32(REC_SAMPR_CAPS, rec_freq_sampr,
187 caps.samplerate_caps, table);
189 rec_frequency = round_value_to_list32(
190 rec_freq_sampr[global_settings.rec_frequency],
191 table, n_opts, false);
194 ret = set_option(str(LANG_RECORDING_FREQUENCY),
195 &rec_frequency, INT, opts, n_opts, NULL );
197 if (!ret
198 HAVE_SPDIF_REC_( && global_settings.rec_source != REC_SRC_SPDIF)
201 /* Translate back to full index */
202 global_settings.rec_frequency =
203 round_value_to_list32(table[rec_frequency],
204 rec_freq_sampr,
205 REC_NUM_FREQ,
206 false);
209 return ret;
210 #endif /* CONFIG_CODEC == SWCODEC */
211 } /* recfrequency */
212 MENUITEM_FUNCTION(recfrequency, 0, ID2P(LANG_RECORDING_FREQUENCY),
213 recfrequency_func, NULL, NULL, Icon_Menu_setting);
216 static int recchannels_func(void)
218 static const struct opt_items names[CHN_NUM_MODES] = {
219 [CHN_MODE_STEREO] = { STR(LANG_CHANNEL_STEREO) },
220 [CHN_MODE_MONO] = { STR(LANG_CHANNEL_MONO) }
222 #if CONFIG_CODEC == MAS3587F
223 return set_option(str(LANG_CHANNELS),
224 &global_settings.rec_channels, INT,
225 names, CHN_NUM_MODES, NULL );
226 #endif /* CONFIG_CODEC == MAS3587F */
228 #if CONFIG_CODEC == SWCODEC
229 struct opt_items opts[CHN_NUM_MODES];
230 long table[CHN_NUM_MODES];
231 struct encoder_caps caps;
232 struct encoder_config cfg;
233 int n_opts;
234 int rec_channels;
235 bool ret;
237 cfg.rec_format = global_settings.rec_format;
238 global_to_encoder_config(&cfg);
240 if (!enc_get_caps(&cfg, &caps, true))
241 return false;
243 n_opts = make_list_from_caps32(CHN_CAP_ALL, NULL,
244 caps.channel_caps, table);
246 rec_channels = round_value_to_list32(global_settings.rec_channels,
247 table, n_opts, false);
249 make_options_from_indexes(names, table, n_opts, opts);
251 ret = set_option(str(LANG_CHANNELS), &rec_channels,
252 INT, opts, n_opts, NULL );
254 if (!ret)
255 global_settings.rec_channels = table[rec_channels];
257 return ret;
258 #endif /* CONFIG_CODEC == SWCODEC */
260 MENUITEM_FUNCTION(recchannels, 0, ID2P(LANG_CHANNELS),
261 recchannels_func, NULL, NULL, Icon_Menu_setting);
263 #if CONFIG_CODEC == SWCODEC
265 static int recmonomode_func(void)
267 static const struct opt_items names[3] = {
268 [0] = { STR(LANG_CHANNEL_LEFTRIGHT) },
269 [1] = { STR(LANG_CHANNEL_LEFT) },
270 [2] = { STR(LANG_CHANNEL_RIGHT) },
273 int rec_mono_mode = global_settings.rec_mono_mode;
274 bool ret = set_option(str(LANG_RECORDING_MONO_MODE), &rec_mono_mode,
275 INT, names, 3, NULL );
277 if (rec_mono_mode != global_settings.rec_mono_mode)
278 global_settings.rec_mono_mode = rec_mono_mode;
280 return ret;
282 MENUITEM_FUNCTION(recmonomode, 0, ID2P(LANG_RECORDING_MONO_MODE),
283 recmonomode_func, NULL, NULL, Icon_Menu_setting);
285 static int recformat_func(void)
287 static const struct opt_items names[REC_NUM_FORMATS] = {
288 [REC_FORMAT_AIFF] = { STR(LANG_AFMT_AIFF) },
289 [REC_FORMAT_MPA_L3] = { STR(LANG_AFMT_MPA_L3) },
290 [REC_FORMAT_WAVPACK] = { STR(LANG_AFMT_WAVPACK) },
291 [REC_FORMAT_PCM_WAV] = { STR(LANG_AFMT_PCM_WAV) },
294 int rec_format = global_settings.rec_format;
295 bool res = set_option(str(LANG_RECORDING_FORMAT), &rec_format, INT,
296 names, REC_NUM_FORMATS, NULL );
298 if (rec_format != global_settings.rec_format)
300 global_settings.rec_format = rec_format;
301 enc_global_settings_apply();
304 return res;
305 } /* recformat */
306 MENUITEM_FUNCTION(recformat, 0, ID2P(LANG_RECORDING_FORMAT),
307 recformat_func, NULL, NULL, Icon_Menu_setting);
309 MENUITEM_FUNCTION(enc_global_config_menu_item, 0, ID2P(LANG_ENCODER_SETTINGS),
310 (int(*)(void))enc_global_config_menu,
311 NULL, NULL, Icon_Submenu);
313 #endif /* CONFIG_CODEC == SWCODEC */
316 static int recmenu_callback(int action,const struct menu_item_ex *this_item)
318 switch (action)
320 case ACTION_REQUEST_MENUITEM:
321 if (this_item == &recsource && no_source_in_menu)
322 return ACTION_EXIT_MENUITEM;
323 break;
325 return action;
327 #if CONFIG_CODEC == MAS3587F
328 MENUITEM_SETTING(rec_quality, &global_settings.rec_quality, NULL);
329 MENUITEM_SETTING(rec_editable, &global_settings.rec_editable, NULL);
330 #endif
332 MENUITEM_SETTING(rec_split_type, &global_settings.rec_split_type, NULL);
333 MENUITEM_SETTING(rec_split_method, &global_settings.rec_split_method, NULL);
334 MENUITEM_SETTING(rec_timesplit, &global_settings.rec_timesplit, NULL);
335 MENUITEM_SETTING(rec_sizesplit, &global_settings.rec_sizesplit, NULL);
336 MAKE_MENU(filesplitoptionsmenu, ID2P(LANG_RECORD_TIMESPLIT), NULL, Icon_NOICON,
337 &rec_split_method, &rec_split_type, &rec_timesplit, &rec_sizesplit);
340 MENUITEM_SETTING(rec_prerecord_time, &global_settings.rec_prerecord_time, NULL);
342 static int clear_rec_directory(void)
344 strcpy(global_settings.rec_directory, REC_BASE_DIR);
345 settings_save();
346 splash(HZ, ID2P(LANG_RESET_DONE_CLEAR));
347 return false;
349 MENUITEM_FUNCTION(clear_rec_directory_item, 0, ID2P(LANG_CLEAR_REC_DIR),
350 clear_rec_directory, NULL, NULL, Icon_Folder);
352 MENUITEM_SETTING(cliplight, &global_settings.cliplight, NULL);
354 #ifdef HAVE_AGC
355 static int agc_preset_func(void)
357 static const struct opt_items names[] = {
358 { STR(LANG_OFF) },
359 { STR(LANG_AGC_SAFETY) },
360 { STR(LANG_AGC_LIVE) },
361 { STR(LANG_AGC_DJSET) },
362 { STR(LANG_AGC_MEDIUM) },
363 { STR(LANG_AGC_VOICE) },
365 if (global_settings.rec_source)
366 return set_option(str(LANG_RECORDING_AGC_PRESET),
367 &global_settings.rec_agc_preset_line,
368 INT, names, 6, NULL );
369 else
370 return set_option(str(LANG_RECORDING_AGC_PRESET),
371 &global_settings.rec_agc_preset_mic,
372 INT, names, 6, NULL );
375 static int agc_cliptime_func(void)
377 static const struct opt_items names[] = {
378 { "200ms", TALK_ID(200, UNIT_MS) },
379 { "400ms", TALK_ID(400, UNIT_MS) },
380 { "600ms", TALK_ID(600, UNIT_MS) },
381 { "800ms", TALK_ID(800, UNIT_MS) },
382 { "1s", TALK_ID(1, UNIT_SEC) }
384 return set_option(str(LANG_RECORDING_AGC_CLIPTIME),
385 &global_settings.rec_agc_cliptime,
386 INT, names, 5, NULL );
388 MENUITEM_FUNCTION(agc_preset, 0, ID2P(LANG_RECORDING_AGC_PRESET),
389 agc_preset_func, NULL, NULL, Icon_Menu_setting);
390 MENUITEM_FUNCTION(agc_cliptime, 0, ID2P(LANG_RECORDING_AGC_CLIPTIME),
391 agc_cliptime_func, NULL, NULL, Icon_Menu_setting);
392 #endif /* HAVE_AGC */
394 /** Rec trigger **/
395 enum trigger_menu_option
397 TRIGGER_MODE,
398 TRIGGER_TYPE,
399 PRERECORD_TIME,
400 START_THRESHOLD,
401 START_DURATION,
402 STOP_THRESHOLD,
403 STOP_POSTREC,
404 STOP_GAP,
405 TRIG_OPTION_COUNT,
408 static enum themable_icons trigger_get_icon(int selected_item, void * data)
410 (void)data;
411 if ((selected_item % 2) == 0) /* header */
412 return Icon_Menu_setting;
413 return Icon_NOICON;
416 static const char * trigger_get_name(int selected_item, void * data,
417 char * buffer, size_t buffer_len)
419 const struct settings_list **settings =
420 (const struct settings_list **)data;
421 const struct settings_list *s = settings[selected_item / 2];
422 if ((selected_item % 2) == 0) /* header */
423 return P2STR(ID2P(s->lang_id));
424 else
426 int temp;
427 temp = option_value_as_int(s);
428 if ((selected_item / 2 == START_THRESHOLD ||
429 selected_item / 2 == STOP_THRESHOLD) &&
430 temp == 0)
432 return str(LANG_OFF);
434 return option_get_valuestring(s, buffer, buffer_len, temp);
437 static void trigger_speak_item(const struct settings_list **settings,
438 int selected_setting, bool title)
440 const struct settings_list *s = settings[selected_setting];
441 int temp;
442 if (!global_settings.talk_menu)
443 return;
444 if (title)
445 talk_id(s->lang_id, false);
446 temp = option_value_as_int(s);
447 if ((selected_setting == START_THRESHOLD ||
448 selected_setting == STOP_THRESHOLD) &&
449 temp == 0)
451 talk_id(LANG_OFF, title);
452 } else {
453 option_talk_value(s, temp, title);
456 int rectrigger(void)
458 struct viewport vp[NB_SCREENS], triggervp[NB_SCREENS];
459 struct gui_synclist lists;
460 int action = ACTION_REDRAW;
461 bool done = false, changed = true;
462 const struct settings_list *settings[TRIG_OPTION_COUNT];
464 int pm_x[NB_SCREENS];
465 int pm_y[NB_SCREENS];
466 int pm_h[NB_SCREENS];
467 int trig_xpos[NB_SCREENS];
468 int trig_ypos[NB_SCREENS];
469 int trig_width[NB_SCREENS];
471 int old_start_thres_db = global_settings.rec_start_thres_db;
472 int old_start_thres_linear = global_settings.rec_start_thres_linear;
473 int old_start_duration = global_settings.rec_start_duration;
474 int old_prerecord_time = global_settings.rec_prerecord_time;
475 int old_stop_thres_db = global_settings.rec_stop_thres_db;
476 int old_stop_thres_linear = global_settings.rec_stop_thres_linear;
477 int old_stop_postrec = global_settings.rec_stop_postrec;
478 int old_stop_gap = global_settings.rec_stop_gap;
479 int old_trigger_mode = global_settings.rec_trigger_mode;
480 int old_trigger_type = global_settings.rec_trigger_type;
482 FOR_NB_SCREENS(i)
484 screens[i].clear_display();
485 screens[i].update();
486 viewport_set_defaults(&vp[i], i);
487 vp[i].height -= SYSFONT_HEIGHT*2;
488 triggervp[i] = vp[i];
489 triggervp[i].y = vp[i].y + vp[i].height;
490 triggervp[i].height = SYSFONT_HEIGHT*2;
491 trig_xpos[i] = 0;
492 trig_ypos[i] = 0;
493 pm_x[i] = 0;
494 pm_y[i] = SYSFONT_HEIGHT;
495 pm_h[i] = SYSFONT_HEIGHT;
496 trig_width[i] = triggervp[i].width;
498 /* TODO: what to do if there is < 4 lines on the screen? */
500 settings[TRIGGER_MODE] =
501 find_setting(&global_settings.rec_trigger_mode, NULL);
502 settings[TRIGGER_TYPE] =
503 find_setting(&global_settings.rec_trigger_type, NULL);
504 settings[PRERECORD_TIME] =
505 find_setting(&global_settings.rec_prerecord_time, NULL);
506 settings[START_DURATION] =
507 find_setting(&global_settings.rec_start_duration, NULL);
508 settings[STOP_POSTREC] =
509 find_setting(&global_settings.rec_stop_postrec, NULL);
510 settings[STOP_GAP] =
511 find_setting(&global_settings.rec_stop_gap, NULL);
512 if (global_settings.peak_meter_dbfs) /* show the dB settings */
514 settings[START_THRESHOLD] =
515 find_setting(&global_settings.rec_start_thres_db, NULL);
516 settings[STOP_THRESHOLD] =
517 find_setting(&global_settings.rec_stop_thres_db, NULL);
519 else
521 settings[START_THRESHOLD] =
522 find_setting(&global_settings.rec_start_thres_linear, NULL);
523 settings[STOP_THRESHOLD] =
524 find_setting(&global_settings.rec_stop_thres_linear, NULL);
526 gui_synclist_init(&lists, trigger_get_name, settings, false, 2, vp);
527 gui_synclist_set_nb_items(&lists, TRIG_OPTION_COUNT*2);
528 gui_synclist_set_icon_callback(&lists, global_settings.show_icons?trigger_get_icon:NULL);
529 /* restart trigger with new values */
530 settings_apply_trigger();
531 peak_meter_trigger (global_settings.rec_trigger_mode != TRIG_MODE_OFF);
533 trigger_speak_item(settings, 0, true);
535 while (!done)
537 if (changed)
539 gui_synclist_draw(&lists);
540 peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF);
541 settings_apply_trigger();
542 changed = false;
545 FOR_NB_SCREENS(i)
546 screens[i].set_viewport(&triggervp[i]);
547 peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, NB_SCREENS);
548 action = peak_meter_draw_get_btn(CONTEXT_SETTINGS_RECTRIGGER,
549 pm_x, pm_y, pm_h, NB_SCREENS, triggervp);
550 FOR_NB_SCREENS(i)
551 screens[i].update();
552 int i = gui_synclist_get_sel_pos(&lists);
553 switch (action)
555 case ACTION_STD_CANCEL:
556 splash(HZ/2, ID2P(LANG_CANCEL));
557 global_settings.rec_start_thres_db = old_start_thres_db;
558 global_settings.rec_start_thres_linear = old_start_thres_linear;
559 global_settings.rec_start_duration = old_start_duration;
560 global_settings.rec_prerecord_time = old_prerecord_time;
561 global_settings.rec_stop_thres_db = old_stop_thres_db;
562 global_settings.rec_stop_thres_linear = old_stop_thres_linear;
563 global_settings.rec_stop_postrec = old_stop_postrec;
564 global_settings.rec_stop_gap = old_stop_gap;
565 global_settings.rec_trigger_mode = old_trigger_mode;
566 global_settings.rec_trigger_type = old_trigger_type;
567 peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF);
568 settings_apply_trigger();
569 done = true;
570 break;
571 case ACTION_STD_OK:
572 done = true;
573 break;
574 case ACTION_SETTINGS_DEC:
575 case ACTION_SETTINGS_DECREPEAT:
576 option_select_next_val(settings[i/2], true, false);
577 trigger_speak_item(settings, i/2, false);
578 changed = true;
579 break;
580 case ACTION_SETTINGS_INC:
581 case ACTION_SETTINGS_INCREPEAT:
582 option_select_next_val(settings[i/2], false, false);
583 trigger_speak_item(settings, i/2, false);
584 changed = true;
585 break;
586 case ACTION_STD_PREV:
587 case ACTION_STD_PREVREPEAT:
588 i -= 2;
589 if (i<0)
590 i = (TRIG_OPTION_COUNT*2) - 2;
591 gui_synclist_select_item(&lists, i);
592 i = gui_synclist_get_sel_pos(&lists);
593 trigger_speak_item(settings, i/2, true);
594 changed = true;
595 break;
596 case ACTION_STD_NEXT:
597 case ACTION_STD_NEXTREPEAT:
598 gui_synclist_select_item(&lists, (i+2) % (TRIG_OPTION_COUNT*2));
599 i = gui_synclist_get_sel_pos(&lists);
600 trigger_speak_item(settings, i/2, true);
601 changed = true;
602 break;
605 peak_meter_trigger(false);
606 settings_save();
607 return 0;
609 MENUITEM_FUNCTION(rectrigger_item, 0, ID2P(LANG_RECORD_TRIGGER),
610 rectrigger, NULL, NULL, Icon_Menu_setting);
612 static struct browse_folder_info rec_config_browse = {RECPRESETS_DIR, SHOW_CFG};
613 MENUITEM_FUNCTION(browse_recconfigs, MENU_FUNC_USEPARAM, ID2P(LANG_CUSTOM_CFG),
614 browse_folder, (void*)&rec_config_browse, NULL, Icon_Config);
615 static int write_settings_file(void)
617 return settings_save_config(SETTINGS_SAVE_RECPRESETS);
619 MENUITEM_FUNCTION(save_recpresets_item, 0, ID2P(LANG_SAVE_SETTINGS),
620 write_settings_file, NULL, NULL, Icon_Config);
622 MAKE_MENU(recording_settings_menu, ID2P(LANG_RECORDING_SETTINGS),
623 NULL, Icon_Recording,
624 #if CONFIG_CODEC == MAS3587F
625 &rec_quality,
626 #endif
627 #if CONFIG_CODEC == SWCODEC
628 &recformat, &enc_global_config_menu_item,
629 #endif
630 &recfrequency, &recsource, /* recsource not shown if no_source */
631 &recchannels,
632 #if CONFIG_CODEC == SWCODEC
633 &recmonomode,
634 #endif
635 #if CONFIG_CODEC == MAS3587F
636 &rec_editable,
637 #endif
638 &filesplitoptionsmenu,
639 &rec_prerecord_time,
640 &clear_rec_directory_item,
641 #ifdef HAVE_BACKLIGHT
642 &cliplight,
643 #endif
644 &rectrigger_item,
645 #ifdef HAVE_AGC
646 &agc_preset, &agc_cliptime,
647 #endif
648 #ifdef HAVE_LCD_BITMAP
649 &peak_meter_menu,
650 #endif
651 &browse_recconfigs, &save_recpresets_item
654 bool recording_menu(bool no_source)
656 bool retval;
657 no_source_in_menu = no_source;
658 retval = do_menu(&recording_settings_menu, NULL, NULL, false) == MENU_ATTACHED_USB;
659 no_source_in_menu = false; /* always fall back to the default */
660 return retval;
663 MENUITEM_FUNCTION(recording_settings, MENU_FUNC_USEPARAM, ID2P(LANG_RECORDING_SETTINGS),
664 (int (*)(void*))recording_menu, 0, NULL, Icon_Recording);