summaryrefslogtreecommitdiff
path: root/apps/sound_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/sound_menu.c')
-rw-r--r--apps/sound_menu.c78
1 files changed, 59 insertions, 19 deletions
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index 34ed9af000..179951a17d 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -39,6 +39,12 @@
39#include "talk.h" 39#include "talk.h"
40#include "misc.h" 40#include "misc.h"
41#include "sound.h" 41#include "sound.h"
42#ifdef HAVE_RECORDING
43#include "audio.h"
44#ifdef CONFIG_TUNER
45#include "radio.h"
46#endif
47#endif
42#if CONFIG_CODEC == MAS3587F 48#if CONFIG_CODEC == MAS3587F
43#include "peakmeter.h" 49#include "peakmeter.h"
44#include "mas.h" 50#include "mas.h"
@@ -290,19 +296,68 @@ static bool avc(void)
290#ifdef HAVE_RECORDING 296#ifdef HAVE_RECORDING
291static bool recsource(void) 297static bool recsource(void)
292{ 298{
293 static const struct opt_items names[] = { 299 int n_opts = AUDIO_NUM_SOURCES;
300
301 struct opt_items names[AUDIO_NUM_SOURCES] = {
294 { STR(LANG_RECORDING_SRC_MIC) }, 302 { STR(LANG_RECORDING_SRC_MIC) },
295 { STR(LANG_RECORDING_SRC_LINE) }, 303 { STR(LANG_RECORDING_SRC_LINE) },
296#ifdef HAVE_SPDIF_IN 304#ifdef HAVE_SPDIF_IN
297 { STR(LANG_RECORDING_SRC_DIGITAL) }, 305 { STR(LANG_RECORDING_SRC_DIGITAL) },
298#endif 306#endif
299 }; 307 };
308
309 /* caveat: assumes it's the last item! */
310#ifdef HAVE_FMRADIO_IN
311 if (radio_hardware_present())
312 {
313 names[AUDIO_SRC_FMRADIO].string = ID2P(LANG_FM_RADIO);
314 names[AUDIO_SRC_FMRADIO].voice_id = LANG_FM_RADIO;
315 }
316 else
317 n_opts--;
318#endif
319
300 return set_option(str(LANG_RECORDING_SOURCE), 320 return set_option(str(LANG_RECORDING_SOURCE),
301 &global_settings.rec_source, INT, names, 321 &global_settings.rec_source, INT, names,
302 sizeof(names)/sizeof(struct opt_items), NULL ); 322 n_opts, NULL );
303} 323}
304 324
305/* To be removed when we add support for sample rates and channel settings */ 325/* To be removed when we add support for sample rates and channel settings */
326#if CONFIG_CODEC == SWCODEC
327static bool recquality(void)
328{
329 static const struct opt_items names[] = {
330 { "MP3 64 kBit/s", TALK_ID( 64, UNIT_KBIT) },
331 { "MP3 96 kBit/s", TALK_ID( 96, UNIT_KBIT) },
332 { "MP3 128 kBit/s", TALK_ID( 128, UNIT_KBIT) },
333 { "MP3 160 kBit/s", TALK_ID( 160, UNIT_KBIT) },
334 { "MP3 192 kBit/s", TALK_ID( 192, UNIT_KBIT) },
335 { "MP3 224 kBit/s", TALK_ID( 224, UNIT_KBIT) },
336 { "MP3 320 kBit/s", TALK_ID( 320, UNIT_KBIT) },
337 { "WV 900 kBit/s", TALK_ID( 900, UNIT_KBIT) },
338 { "WAV 1411 kBit/s", TALK_ID(1411, UNIT_KBIT) }
339 };
340
341 return set_option(str(LANG_RECORDING_QUALITY),
342 &global_settings.rec_quality, INT,
343 names, sizeof (names)/sizeof(struct opt_items),
344 NULL );
345}
346#elif CONFIG_CODEC == MAS3587F
347static bool recquality(void)
348{
349 return set_int(str(LANG_RECORDING_QUALITY), "", UNIT_INT,
350 &global_settings.rec_quality,
351 NULL, 1, 0, 7, NULL );
352}
353
354static bool receditable(void)
355{
356 return set_bool(str(LANG_RECORDING_EDITABLE),
357 &global_settings.rec_editable);
358}
359#endif
360
306#ifndef HAVE_UDA1380 361#ifndef HAVE_UDA1380
307static bool recfrequency(void) 362static bool recfrequency(void)
308{ 363{
@@ -331,21 +386,6 @@ static bool recchannels(void)
331} 386}
332#endif 387#endif
333 388
334#if CONFIG_CODEC == MAS3587F
335static bool recquality(void)
336{
337 return set_int(str(LANG_RECORDING_QUALITY), "", UNIT_INT,
338 &global_settings.rec_quality,
339 NULL, 1, 0, 7, NULL );
340}
341
342static bool receditable(void)
343{
344 return set_bool(str(LANG_RECORDING_EDITABLE),
345 &global_settings.rec_editable);
346}
347#endif
348
349static bool rectimesplit(void) 389static bool rectimesplit(void)
350{ 390{
351 static const struct opt_items names[] = { 391 static const struct opt_items names[] = {
@@ -1011,13 +1051,13 @@ bool recording_menu(bool no_source)
1011 struct menu_item items[13]; 1051 struct menu_item items[13];
1012 bool result; 1052 bool result;
1013 1053
1014#if CONFIG_CODEC == MAS3587F 1054#if CONFIG_CODEC == MAS3587F || CONFIG_CODEC == SWCODEC
1015 items[i].desc = ID2P(LANG_RECORDING_QUALITY); 1055 items[i].desc = ID2P(LANG_RECORDING_QUALITY);
1016 items[i++].function = recquality; 1056 items[i++].function = recquality;
1017#endif 1057#endif
1058#ifndef HAVE_UDA1380
1018/* We don't support frequency selection for UDA1380 yet. Let it just stay at 1059/* We don't support frequency selection for UDA1380 yet. Let it just stay at
1019 the default 44100 Hz. */ 1060 the default 44100 Hz. */
1020#ifndef HAVE_UDA1380
1021 items[i].desc = ID2P(LANG_RECORDING_FREQUENCY); 1061 items[i].desc = ID2P(LANG_RECORDING_FREQUENCY);
1022 items[i++].function = recfrequency; 1062 items[i++].function = recfrequency;
1023#endif 1063#endif