Fix several 'variable set but not used' warnings reported by GCC 6.4.1.
[kugel-rb.git] / apps / menus / radio_menu.c
blobe787aaa3e6d84d42d1e257108126293c59402a3a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 ****************************************************************************/
22 #include <stdio.h>
23 #include "config.h"
24 #include "menu.h"
25 #include "icon.h"
26 #include "radio.h"
27 #include "lang.h"
28 #include "settings.h"
29 #include "presets.h"
30 #include "exported_menus.h"
31 #include "sound_menu.h" /* recording_menu() */
33 #ifdef HAVE_RECORDING
34 #include "recording.h" /* recording_screen() */
36 #if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC
37 #define FM_RECORDING_SCREEN
38 static int fm_recording_screen(void)
40 bool ret;
42 /* switch recording source to FMRADIO for the duration */
43 int rec_source = global_settings.rec_source;
44 global_settings.rec_source = AUDIO_SRC_FMRADIO;
45 ret = recording_screen(true);
47 /* safe to reset as changing sources is prohibited here */
48 global_settings.rec_source = rec_source;
50 return ret;
53 MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING),
54 fm_recording_screen, NULL, NULL, Icon_Recording);
55 #endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */
57 #if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC
58 #define FM_RECORDING_SETTINGS
59 static int fm_recording_settings(void)
61 bool ret = recording_menu(true);
63 #if CONFIG_CODEC != SWCODEC
64 if (!ret)
66 struct audio_recording_options rec_options;
67 rec_init_recording_options(&rec_options);
68 rec_options.rec_source = AUDIO_SRC_LINEIN;
69 rec_set_recording_options(&rec_options);
71 #endif
73 return ret;
76 MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS),
77 fm_recording_settings, NULL, NULL, Icon_Recording);
78 #endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */
79 #endif /* HAVE_RECORDING */
81 #ifndef FM_PRESET
82 MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET),
83 handle_radio_presets, NULL, NULL, Icon_NOICON);
84 #endif
85 #ifndef FM_PRESET_ADD
86 MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET),
87 handle_radio_add_preset, NULL, NULL, Icon_NOICON);
88 #endif
90 MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD),
91 preset_list_load, NULL, NULL, Icon_NOICON);
92 MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE),
93 preset_list_save, NULL, NULL, Icon_NOICON);
94 MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR),
95 preset_list_clear, NULL, NULL, Icon_NOICON);
97 MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL);
98 MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL);
100 #ifndef FM_MODE
101 extern int radio_mode;
102 static char* get_mode_text(int selected_item, void * data, char *buffer)
104 (void)selected_item;
105 (void)data;
106 snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE),
107 radio_mode ? str(LANG_PRESET) :
108 str(LANG_RADIO_SCAN_MODE));
109 return buffer;
111 static int toggle_radio_mode(void)
113 radio_mode = (radio_mode == RADIO_SCAN_MODE) ?
114 RADIO_PRESET_MODE : RADIO_SCAN_MODE;
115 return 0;
117 MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0,
118 toggle_radio_mode, NULL,
119 get_mode_text, NULL, NULL, NULL, Icon_NOICON);
120 #endif
122 MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM,
123 ID2P(LANG_FM_SCAN_PRESETS),
124 presets_scan, NULL, NULL, Icon_NOICON);
126 MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL,
127 Icon_Radio_screen,
128 #ifndef FM_PRESET
129 &radio_presets_item,
130 #endif
131 #ifndef FM_PRESET_ADD
132 &radio_addpreset_item,
133 #endif
134 &presetload_item, &presetsave_item, &presetclear_item,
135 &force_mono,
136 #ifndef FM_MODE
137 &radio_mode_item,
138 #endif
139 &set_region, &sound_settings,
140 #ifdef FM_RECORDING_SCREEN
141 &recscreen_item,
142 #endif
143 #ifdef FM_RECORDING_SETTINGS
144 &recsettings_item,
145 #endif
146 &scan_presets_item);