1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2003 Linus Nielsen Feltzing
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 ****************************************************************************/
30 #include "exported_menus.h"
31 #include "sound_menu.h" /* recording_menu() */
35 #include "recording.h" /* recording_screen() */
37 #if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC
38 #define FM_RECORDING_SCREEN
39 static int fm_recording_screen(void)
43 /* switch recording source to FMRADIO for the duration */
44 int rec_source
= global_settings
.rec_source
;
45 global_settings
.rec_source
= AUDIO_SRC_FMRADIO
;
46 ret
= recording_screen(true);
48 /* safe to reset as changing sources is prohibited here */
49 global_settings
.rec_source
= rec_source
;
54 MENUITEM_FUNCTION(recscreen_item
, 0, ID2P(LANG_RECORDING
),
55 fm_recording_screen
, NULL
, NULL
, Icon_Recording
);
56 #endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */
58 #if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC
59 #define FM_RECORDING_SETTINGS
60 static int fm_recording_settings(void)
62 bool ret
= recording_menu(true);
64 #if CONFIG_CODEC != SWCODEC
67 struct audio_recording_options rec_options
;
68 rec_init_recording_options(&rec_options
);
69 rec_options
.rec_source
= AUDIO_SRC_LINEIN
;
70 rec_set_recording_options(&rec_options
);
77 MENUITEM_FUNCTION(recsettings_item
, 0, ID2P(LANG_RECORDING_SETTINGS
),
78 fm_recording_settings
, NULL
, NULL
, Icon_Recording
);
79 #endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */
80 #endif /* HAVE_RECORDING */
83 MENUITEM_FUNCTION(radio_presets_item
, 0, ID2P(LANG_PRESET
),
84 handle_radio_presets
, NULL
, NULL
, Icon_NOICON
);
87 MENUITEM_FUNCTION(radio_addpreset_item
, 0, ID2P(LANG_FM_ADD_PRESET
),
88 handle_radio_add_preset
, NULL
, NULL
, Icon_NOICON
);
91 MENUITEM_FUNCTION(presetload_item
, 0, ID2P(LANG_FM_PRESET_LOAD
),
92 preset_list_load
, NULL
, NULL
, Icon_NOICON
);
93 MENUITEM_FUNCTION(presetsave_item
, 0, ID2P(LANG_FM_PRESET_SAVE
),
94 preset_list_save
, NULL
, NULL
, Icon_NOICON
);
95 MENUITEM_FUNCTION(presetclear_item
, 0, ID2P(LANG_FM_PRESET_CLEAR
),
96 preset_list_clear
, NULL
, NULL
, Icon_NOICON
);
98 MENUITEM_SETTING(set_region
, &global_settings
.fm_region
, NULL
);
99 MENUITEM_SETTING(force_mono
, &global_settings
.fm_force_mono
, NULL
);
102 extern int radio_mode
;
103 static char* get_mode_text(int selected_item
, void * data
, char *buffer
)
107 snprintf(buffer
, MAX_PATH
, "%s %s", str(LANG_MODE
),
108 radio_mode
? str(LANG_PRESET
) :
109 str(LANG_RADIO_SCAN_MODE
));
112 static int mode_speak_item(int selected_item
, void * data
)
117 talk_ids
[0] = LANG_MODE
;
118 talk_ids
[1] = radio_mode
? LANG_PRESET
: LANG_RADIO_SCAN_MODE
;
119 talk_ids
[2] = TALK_FINAL_ID
;
120 talk_idarray(talk_ids
, true);
123 static int toggle_radio_mode(void)
125 radio_mode
= (radio_mode
== RADIO_SCAN_MODE
) ?
126 RADIO_PRESET_MODE
: RADIO_SCAN_MODE
;
129 MENUITEM_FUNCTION_DYNTEXT(radio_mode_item
, 0,
130 toggle_radio_mode
, NULL
,
131 get_mode_text
, mode_speak_item
,
132 NULL
, NULL
, Icon_NOICON
);
135 MENUITEM_FUNCTION(scan_presets_item
, MENU_FUNC_USEPARAM
,
136 ID2P(LANG_FM_SCAN_PRESETS
),
137 presets_scan
, NULL
, NULL
, Icon_NOICON
);
139 MAKE_MENU(radio_settings_menu
, ID2P(LANG_FM_MENU
), NULL
,
144 #ifndef FM_PRESET_ADD
145 &radio_addpreset_item
,
147 &presetload_item
, &presetsave_item
, &presetclear_item
,
152 &set_region
, &sound_settings
,
153 #ifdef FM_RECORDING_SCREEN
156 #ifdef FM_RECORDING_SETTINGS