summaryrefslogtreecommitdiff
path: root/apps/recorder/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/radio.c')
-rw-r--r--apps/recorder/radio.c380
1 files changed, 205 insertions, 175 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index c292909b33..208e7b67fa 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -24,7 +24,6 @@
24#include "mas.h" 24#include "mas.h"
25#include "settings.h" 25#include "settings.h"
26#include "button.h" 26#include "button.h"
27#include "fmradio.h"
28#include "status.h" 27#include "status.h"
29#include "kernel.h" 28#include "kernel.h"
30#include "mpeg.h" 29#include "mpeg.h"
@@ -63,17 +62,6 @@
63 62
64#ifdef CONFIG_TUNER 63#ifdef CONFIG_TUNER
65 64
66#if CONFIG_CODEC == SWCODEC
67#ifdef HAVE_UDA1380
68#include "uda1380.h"
69#endif
70#ifdef HAVE_TLV320
71#include "tlv320.h"
72#endif
73
74#include "pcm_record.h"
75#endif
76
77#if CONFIG_KEYPAD == RECORDER_PAD 65#if CONFIG_KEYPAD == RECORDER_PAD
78#define FM_MENU BUTTON_F1 66#define FM_MENU BUTTON_F1
79#define FM_PRESET BUTTON_F2 67#define FM_PRESET BUTTON_F2
@@ -165,6 +153,7 @@ static int curr_freq;
165static int radio_mode = RADIO_SCAN_MODE; 153static int radio_mode = RADIO_SCAN_MODE;
166 154
167static int radio_status = FMRADIO_OFF; 155static int radio_status = FMRADIO_OFF;
156static bool in_screen = false;
168 157
169#define MAX_PRESETS 64 158#define MAX_PRESETS 64
170static bool presets_loaded = false, presets_changed = false; 159static bool presets_loaded = false, presets_changed = false;
@@ -239,22 +228,87 @@ int get_radio_status(void)
239 return radio_status; 228 return radio_status;
240} 229}
241 230
231bool in_radio_screen(void)
232{
233 return in_screen;
234}
235
236/* secret flag for starting paused - prevents unmute */
237#define FMRADIO_START_PAUSED 0x8000
238void radio_start(void)
239{
240 bool start_paused;
241 int mute_timeout;
242
243 if(radio_status == FMRADIO_PLAYING)
244 return;
245
246 start_paused = radio_status & FMRADIO_START_PAUSED;
247 /* clear flag before any yielding */
248 radio_status &= ~FMRADIO_START_PAUSED;
249
250 if(radio_status == FMRADIO_OFF)
251 radio_power(true);
252
253 curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
254
255 radio_set(RADIO_SLEEP, 0); /* wake up the tuner */
256 radio_set(RADIO_FREQUENCY, curr_freq);
257
258 if(radio_status == FMRADIO_OFF)
259 {
260 radio_set(RADIO_IF_MEASUREMENT, 0);
261 radio_set(RADIO_SENSITIVITY, 0);
262 radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
263 mute_timeout = current_tick + 1*HZ;
264 }
265 else
266 {
267 /* paused */
268 mute_timeout = current_tick + 2*HZ;
269 }
270
271 while(!radio_get(RADIO_STEREO) && !radio_get(RADIO_TUNED))
272 {
273 if(TIME_AFTER(current_tick, mute_timeout))
274 break;
275 yield();
276 }
277
278 /* keep radio from sounding initially */
279 if(!start_paused)
280 radio_set(RADIO_MUTE, 0);
281
282 radio_status = FMRADIO_PLAYING;
283} /* radio_start */
284
285void radio_pause(void)
286{
287 if(radio_status == FMRADIO_PAUSED)
288 return;
289
290 if(radio_status == FMRADIO_OFF)
291 {
292 radio_status |= FMRADIO_START_PAUSED;
293 radio_start();
294 }
295
296 radio_set(RADIO_MUTE, 1);
297 radio_set(RADIO_SLEEP, 1);
298
299 radio_status = FMRADIO_PAUSED;
300} /* radio_pause */
301
242void radio_stop(void) 302void radio_stop(void)
243{ 303{
304 if(radio_status == FMRADIO_OFF)
305 return;
306
244 radio_set(RADIO_MUTE, 1); 307 radio_set(RADIO_MUTE, 1);
245 radio_set(RADIO_SLEEP, 1); /* low power mode, if available */ 308 radio_set(RADIO_SLEEP, 1); /* low power mode, if available */
246 radio_status = FMRADIO_OFF; 309 radio_status = FMRADIO_OFF;
247 radio_power(false); /* status update, power off if avail. */ 310 radio_power(false); /* status update, power off if avail. */
248 311} /* radio_stop */
249#ifndef SIMULATOR /* SIMULATOR. Catch FMRADIO_OFF status for the sim. */
250#if CONFIG_CODEC == SWCODEC
251#ifdef HAVE_TLV320
252 tlv320_set_monitor(false);
253#endif
254 pcm_rec_mux(0); /* Line In */
255#endif
256#endif /* SIMULATOR */
257}
258 312
259bool radio_hardware_present(void) 313bool radio_hardware_present(void)
260{ 314{
@@ -297,18 +351,16 @@ static int find_closest_preset(int freq)
297 return i; 351 return i;
298 if(diff < 0) 352 if(diff < 0)
299 diff = -diff; 353 diff = -diff;
300 if(diff < min_diff) 354 if(diff < min_diff)
301 { 355 {
302 preset = i; 356 preset = i;
303 min_diff = diff; 357 min_diff = diff;
304 } 358 }
305 } 359 }
306 360
307 return preset; 361 return preset;
308} 362}
309 363
310
311
312static void remember_frequency(void) 364static void remember_frequency(void)
313{ 365{
314 global_settings.last_frequency = (curr_freq - MIN_FREQ) / FREQ_STEP; 366 global_settings.last_frequency = (curr_freq - MIN_FREQ) / FREQ_STEP;
@@ -366,13 +418,15 @@ bool radio_screen(void)
366#endif 418#endif
367 bool keep_playing = false; 419 bool keep_playing = false;
368 bool statusbar = global_settings.statusbar; 420 bool statusbar = global_settings.statusbar;
369 int mute_timeout = current_tick;
370 int button_timeout = current_tick + (2*HZ); 421 int button_timeout = current_tick + (2*HZ);
371#ifdef HAS_BUTTONBAR 422#ifdef HAS_BUTTONBAR
372 struct gui_buttonbar buttonbar; 423 struct gui_buttonbar buttonbar;
373 gui_buttonbar_init(&buttonbar); 424 gui_buttonbar_init(&buttonbar);
374 gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); 425 gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
375#endif 426#endif
427 /* change status to "in screen" */
428 in_screen = true;
429
376 /* always display status bar in radio screen for now */ 430 /* always display status bar in radio screen for now */
377 global_settings.statusbar = true; 431 global_settings.statusbar = true;
378 FOR_NB_SCREENS(i) 432 FOR_NB_SCREENS(i)
@@ -396,80 +450,44 @@ bool radio_screen(void)
396 } 450 }
397 451
398#ifndef SIMULATOR 452#ifndef SIMULATOR
453 if(radio_status == FMRADIO_OFF)
454 audio_stop();
455
399#if CONFIG_CODEC != SWCODEC 456#if CONFIG_CODEC != SWCODEC
400 if(rec_create_directory() > 0) 457 if(rec_create_directory() > 0)
401 have_recorded = true; 458 have_recorded = true;
402#endif
403 459
404 if(radio_status == FMRADIO_PLAYING_OUT)
405 radio_status = FMRADIO_PLAYING;
406 else if(radio_status == FMRADIO_PAUSED_OUT)
407 radio_status = FMRADIO_PAUSED;
408
409 if(radio_status == FMRADIO_OFF)
410 audio_stop();
411
412#if CONFIG_CODEC != SWCODEC
413 audio_init_recording(talk_get_bufsize()); 460 audio_init_recording(talk_get_bufsize());
414 461
415 sound_settings_apply(); 462 sound_settings_apply();
416 /* Yes, we use the D/A for monitoring */ 463 /* Yes, we use the D/A for monitoring */
417 peak_meter_playback(true); 464 peak_meter_playback(true);
418
419 peak_meter_enabled = true;
420 465
421 if (global_settings.rec_prerecord_time) 466 peak_meter_enabled = true;
422 talk_buffer_steal(); /* will use the mp3 buffer */
423 467
424 audio_set_recording_options(global_settings.rec_frequency, 468 rec_set_recording_options(global_settings.rec_frequency,
425 global_settings.rec_quality, 469 global_settings.rec_quality,
426 1, /* Line In */ 470 AUDIO_SRC_LINEIN, 0,
427 global_settings.rec_channels, 471 global_settings.rec_channels,
428 global_settings.rec_editable, 472 global_settings.rec_editable,
429 global_settings.rec_prerecord_time); 473 global_settings.rec_prerecord_time);
430 474
431 475 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
432#else 476 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
433 peak_meter_enabled = false;
434 477
435#ifdef HAVE_UDA1380 478#endif /* CONFIG_CODEC != SWCODEC */
436 uda1380_enable_recording(false); 479#endif /* ndef SIMULATOR */
437 uda1380_set_monitor(true);
438#elif defined(HAVE_TLV320)
439 //tlv320_enable_recording(false);
440 tlv320_set_recvol(23, 23, AUDIO_GAIN_LINEIN); /* 0dB */
441 tlv320_set_monitor(true);
442#endif
443 480
444 /* Set the input multiplexer to FM */ 481 /* turn on radio */
445 pcm_rec_mux(1); 482#if CONFIG_CODEC == SWCODEC
446#endif 483 rec_set_source(AUDIO_SRC_FMRADIO, (radio_status == FMRADIO_PAUSED) ?
447 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), 484 SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
448 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); 485#else
486 if (radio_status == FMRADIO_OFF)
487 radio_start();
449#endif 488#endif
450 489
451 curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ; 490 /* I hate this thing with vehement passion (jhMikeS): */
452
453 if(radio_status == FMRADIO_OFF)
454 {
455 radio_power(true);
456 radio_set(RADIO_SLEEP, 0); /* wake up the tuner */
457 radio_set(RADIO_FREQUENCY, curr_freq);
458 radio_set(RADIO_IF_MEASUREMENT, 0);
459 radio_set(RADIO_SENSITIVITY, 0);
460 radio_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
461 mute_timeout = current_tick + (1*HZ);
462 while( !radio_get(RADIO_STEREO)
463 &&!radio_get(RADIO_TUNED) )
464 {
465 if(TIME_AFTER(current_tick, mute_timeout))
466 break;
467 yield();
468 }
469 radio_set(RADIO_MUTE, 0);
470 radio_status = FMRADIO_PLAYING;
471 }
472
473 if(num_presets == 0 && yesno_pop(str(LANG_FM_FIRST_AUTOSCAN))) 491 if(num_presets == 0 && yesno_pop(str(LANG_FM_FIRST_AUTOSCAN)))
474 scan_presets(); 492 scan_presets();
475 493
@@ -478,8 +496,8 @@ bool radio_screen(void)
478 radio_mode = RADIO_PRESET_MODE; 496 radio_mode = RADIO_PRESET_MODE;
479 497
480#ifdef HAS_BUTTONBAR 498#ifdef HAS_BUTTONBAR
481 gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS), 499 gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU),
482 str(LANG_FM_BUTTONBAR_RECORD)); 500 str(LANG_FM_BUTTONBAR_PRESETS), str(LANG_FM_BUTTONBAR_RECORD));
483#endif 501#endif
484 502
485 cpu_idle_mode(true); 503 cpu_idle_mode(true);
@@ -535,7 +553,7 @@ bool radio_screen(void)
535 if (lastbutton != FM_STOP_PRE) 553 if (lastbutton != FM_STOP_PRE)
536 break; 554 break;
537#endif 555#endif
538#ifndef SIMULATOR 556#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
539 if(audio_status() == AUDIO_STATUS_RECORD) 557 if(audio_status() == AUDIO_STATUS_RECORD)
540 { 558 {
541 audio_stop(); 559 audio_stop();
@@ -548,7 +566,7 @@ bool radio_screen(void)
548 { 566 {
549 if(yesno_pop(str(LANG_FM_SAVE_CHANGES))) 567 if(yesno_pop(str(LANG_FM_SAVE_CHANGES)))
550 { 568 {
551 if(filepreset[0] == '\0') 569 if(filepreset[0] == '\0')
552 save_preset_list(); 570 save_preset_list();
553 else 571 else
554 radio_save_presets(); 572 radio_save_presets();
@@ -577,14 +595,13 @@ bool radio_screen(void)
577#ifndef SIMULATOR 595#ifndef SIMULATOR
578 if(audio_status() == AUDIO_STATUS_RECORD) 596 if(audio_status() == AUDIO_STATUS_RECORD)
579 { 597 {
580 audio_new_file(rec_create_filename(buf)); 598 rec_new_file();
581 update_screen = true; 599 update_screen = true;
582 } 600 }
583 else 601 else
584 { 602 {
585 have_recorded = true; 603 have_recorded = true;
586 talk_buffer_steal(); /* we use the mp3 buffer */ 604 rec_record();
587 audio_record(rec_create_filename(buf));
588 update_screen = true; 605 update_screen = true;
589 } 606 }
590#endif 607#endif
@@ -604,7 +621,7 @@ bool radio_screen(void)
604 ) 621 )
605 break; 622 break;
606#endif 623#endif
607#ifndef SIMULATOR 624#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
608 if(audio_status() == AUDIO_STATUS_RECORD) 625 if(audio_status() == AUDIO_STATUS_RECORD)
609 audio_stop(); 626 audio_stop();
610#endif 627#endif
@@ -615,7 +632,7 @@ bool radio_screen(void)
615 { 632 {
616 if(yesno_pop(str(LANG_FM_SAVE_CHANGES))) 633 if(yesno_pop(str(LANG_FM_SAVE_CHANGES)))
617 { 634 {
618 if(filepreset[0] == '\0') 635 if(filepreset[0] == '\0')
619 save_preset_list(); 636 save_preset_list();
620 else 637 else
621 radio_save_presets(); 638 radio_save_presets();
@@ -734,27 +751,11 @@ bool radio_screen(void)
734 ) 751 )
735 break; 752 break;
736#endif 753#endif
737 if(radio_status != FMRADIO_PLAYING) 754 if (radio_status == FMRADIO_PLAYING)
738 { 755 radio_pause();
739 radio_set(RADIO_SLEEP, 0);
740 radio_set(RADIO_FREQUENCY, curr_freq);
741 mute_timeout = current_tick + (2*HZ);
742 while( !radio_get(RADIO_STEREO)
743 &&!radio_get(RADIO_TUNED) )
744 {
745 if(TIME_AFTER(current_tick, mute_timeout))
746 break;
747 yield();
748 }
749 radio_set(RADIO_MUTE, 0);
750 radio_status = FMRADIO_PLAYING;
751 }
752 else 756 else
753 { 757 radio_start();
754 radio_set(RADIO_MUTE, 1); 758
755 radio_set(RADIO_SLEEP, 1);
756 radio_status = FMRADIO_PAUSED;
757 }
758 update_screen = true; 759 update_screen = true;
759 break; 760 break;
760#endif 761#endif
@@ -917,13 +918,17 @@ bool radio_screen(void)
917 if(TIME_AFTER(current_tick, timeout)) 918 if(TIME_AFTER(current_tick, timeout))
918 { 919 {
919 timeout = current_tick + HZ; 920 timeout = current_tick + HZ;
920 921
921 stereo = radio_get(RADIO_STEREO) && 922 /* keep "mono" from always being displayed when paused */
922 !global_settings.fm_force_mono; 923 if (radio_status != FMRADIO_PAUSED)
923 if(stereo != last_stereo_status)
924 { 924 {
925 update_screen = true; 925 stereo = radio_get(RADIO_STEREO) &&
926 last_stereo_status = stereo; 926 !global_settings.fm_force_mono;
927 if(stereo != last_stereo_status)
928 {
929 update_screen = true;
930 last_stereo_status = stereo;
931 }
927 } 932 }
928 } 933 }
929 934
@@ -952,9 +957,6 @@ bool radio_screen(void)
952 FOR_NB_SCREENS(i) 957 FOR_NB_SCREENS(i)
953 screens[i].puts_scroll(0, top_of_screen + 1, buf); 958 screens[i].puts_scroll(0, top_of_screen + 1, buf);
954 959
955 strcat(buf, stereo?str(LANG_CHANNEL_STEREO):
956 str(LANG_CHANNEL_MONO));
957
958 snprintf(buf, 128, stereo?str(LANG_CHANNEL_STEREO): 960 snprintf(buf, 128, stereo?str(LANG_CHANNEL_STEREO):
959 str(LANG_CHANNEL_MONO)); 961 str(LANG_CHANNEL_MONO));
960 FOR_NB_SCREENS(i) 962 FOR_NB_SCREENS(i)
@@ -1005,9 +1007,9 @@ bool radio_screen(void)
1005 done = true; 1007 done = true;
1006 } 1008 }
1007 if (TIME_AFTER(current_tick, button_timeout)) 1009 if (TIME_AFTER(current_tick, button_timeout))
1008 { 1010 {
1009 cpu_idle_mode(true); 1011 cpu_idle_mode(true);
1010 } 1012 }
1011 } /*while(!done)*/ 1013 } /*while(!done)*/
1012 1014
1013#ifndef SIMULATOR 1015#ifndef SIMULATOR
@@ -1033,28 +1035,26 @@ bool radio_screen(void)
1033 1035
1034 sound_settings_apply(); 1036 sound_settings_apply();
1035#endif /* SIMULATOR */ 1037#endif /* SIMULATOR */
1038
1036 if(keep_playing) 1039 if(keep_playing)
1037 { 1040 {
1038/* Catch FMRADIO_PLAYING_OUT status for the sim. */ 1041/* Catch FMRADIO_PLAYING status for the sim. */
1039#ifndef SIMULATOR 1042#ifndef SIMULATOR
1040#if CONFIG_CODEC != SWCODEC 1043#if CONFIG_CODEC != SWCODEC
1041 /* Enable the Left and right A/D Converter */ 1044 /* Enable the Left and right A/D Converter */
1042 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), 1045 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
1043 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); 1046 sound_default(SOUND_RIGHT_GAIN),
1047 AUDIO_GAIN_LINEIN);
1044 mas_codec_writereg(6, 0x4000); 1048 mas_codec_writereg(6, 0x4000);
1045#endif 1049#endif
1046#endif 1050#endif
1047 if(radio_status == FMRADIO_PAUSED)
1048 radio_status = FMRADIO_PAUSED_OUT;
1049 else
1050 radio_status = FMRADIO_PLAYING_OUT;
1051
1052 } 1051 }
1053 else 1052 else
1054 { 1053 {
1055 radio_stop();
1056#if CONFIG_CODEC == SWCODEC 1054#if CONFIG_CODEC == SWCODEC
1057 peak_meter_enabled = true; 1055 rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
1056#else
1057 radio_stop();
1058#endif 1058#endif
1059 } 1059 }
1060 1060
@@ -1062,9 +1062,11 @@ bool radio_screen(void)
1062 1062
1063 /* restore status bar settings */ 1063 /* restore status bar settings */
1064 global_settings.statusbar = statusbar; 1064 global_settings.statusbar = statusbar;
1065
1066 in_screen = false;
1065 1067
1066 return have_recorded; 1068 return have_recorded;
1067} 1069} /* radio_screen */
1068 1070
1069void radio_save_presets(void) 1071void radio_save_presets(void)
1070{ 1072{
@@ -1106,16 +1108,16 @@ void radio_load_presets(char *filename)
1106 1108
1107/* No Preset in configuration. */ 1109/* No Preset in configuration. */
1108 if(filename[0] == '\0') 1110 if(filename[0] == '\0')
1109 { 1111 {
1110 filepreset[0] = '\0'; 1112 filepreset[0] = '\0';
1111 return; 1113 return;
1112 } 1114 }
1113/* Temporary preset, loaded until player shuts down. */ 1115/* Temporary preset, loaded until player shuts down. */
1114 else if(filename[0] == '/') 1116 else if(filename[0] == '/')
1115 strncpy(filepreset, filename, sizeof(filepreset)); 1117 strncpy(filepreset, filename, sizeof(filepreset));
1116/* Preset from default directory. */ 1118/* Preset from default directory. */
1117 else 1119 else
1118 snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", 1120 snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr",
1119 FMPRESET_PATH, filename); 1121 FMPRESET_PATH, filename);
1120 1122
1121 fd = open(filepreset, O_RDONLY); 1123 fd = open(filepreset, O_RDONLY);
@@ -1466,30 +1468,6 @@ bool handle_radio_presets(void)
1466 return reload_dir; 1468 return reload_dir;
1467} 1469}
1468 1470
1469#ifndef SIMULATOR
1470#if CONFIG_CODEC != SWCODEC
1471static bool fm_recording_settings(void)
1472{
1473 bool ret;
1474
1475 ret = recording_menu(true);
1476 if(!ret)
1477 {
1478 if (global_settings.rec_prerecord_time)
1479 talk_buffer_steal(); /* will use the mp3 buffer */
1480
1481 audio_set_recording_options(global_settings.rec_frequency,
1482 global_settings.rec_quality,
1483 1, /* Line In */
1484 global_settings.rec_channels,
1485 global_settings.rec_editable,
1486 global_settings.rec_prerecord_time);
1487 }
1488 return ret;
1489}
1490#endif
1491#endif
1492
1493char monomode_menu_string[32]; 1471char monomode_menu_string[32];
1494 1472
1495static void create_monomode_menu(void) 1473static void create_monomode_menu(void)
@@ -1628,6 +1606,55 @@ int radio_menu_cb(int key, int m)
1628 return key; 1606 return key;
1629} 1607}
1630 1608
1609#ifndef SIMULATOR
1610#if defined(HAVE_FMRADIO_IN) || CONFIG_CODEC != SWCODEC
1611static bool fm_recording_screen(void)
1612{
1613 bool ret;
1614
1615#ifdef HAVE_FMRADIO_IN
1616 /* switch recording source to FMRADIO for the duration */
1617 int rec_source = global_settings.rec_source;
1618 global_settings.rec_source = AUDIO_SRC_FMRADIO;
1619
1620 /* clearing queue seems to cure a spontaneous abort during record */
1621 while (button_get(false) != BUTTON_NONE);
1622#endif
1623
1624 ret = recording_screen(true);
1625
1626#ifdef HAVE_FMRADIO_IN
1627 /* safe to reset as changing sources is prohibited here */
1628 global_settings.rec_source = rec_source;
1629#endif
1630
1631 return ret;
1632}
1633
1634static bool fm_recording_settings(void)
1635{
1636 bool ret = recording_menu(true);
1637
1638 if (!ret)
1639 {
1640 rec_set_recording_options(global_settings.rec_frequency,
1641 global_settings.rec_quality,
1642#if CONFIG_CODEC == SWCODEC
1643 AUDIO_SRC_FMRADIO, SRCF_FMRADIO_PLAYING,
1644#else
1645 AUDIO_SRC_LINEIN, 0,
1646#endif
1647 global_settings.rec_channels,
1648 global_settings.rec_editable,
1649 global_settings.rec_prerecord_time);
1650 }
1651
1652 return ret;
1653}
1654#endif
1655#endif /* SIMULATOR */
1656
1657
1631/* main menu of the radio screen */ 1658/* main menu of the radio screen */
1632bool radio_menu(void) 1659bool radio_menu(void)
1633{ 1660{
@@ -1637,24 +1664,27 @@ bool radio_menu(void)
1637 static const struct menu_item items[] = { 1664 static const struct menu_item items[] = {
1638/* Add functions not accessible via buttons */ 1665/* Add functions not accessible via buttons */
1639#ifndef FM_PRESET 1666#ifndef FM_PRESET
1640 { ID2P(LANG_FM_BUTTONBAR_PRESETS), handle_radio_presets }, 1667 { ID2P(LANG_FM_BUTTONBAR_PRESETS), handle_radio_presets },
1641#endif 1668#endif
1642#ifndef FM_PRESET_ADD 1669#ifndef FM_PRESET_ADD
1643 { ID2P(LANG_FM_ADD_PRESET) , radio_add_preset }, 1670 { ID2P(LANG_FM_ADD_PRESET) , radio_add_preset },
1644#endif 1671#endif
1645 { ID2P(LANG_FM_PRESET_LOAD) , load_preset_list }, 1672 { ID2P(LANG_FM_PRESET_LOAD) , load_preset_list },
1646 { ID2P(LANG_FM_PRESET_SAVE) , save_preset_list }, 1673 { ID2P(LANG_FM_PRESET_SAVE) , save_preset_list },
1647 { ID2P(LANG_FM_PRESET_CLEAR) , clear_preset_list }, 1674 { ID2P(LANG_FM_PRESET_CLEAR) , clear_preset_list },
1648 1675
1649 { monomode_menu_string , toggle_mono_mode }, 1676 { monomode_menu_string , toggle_mono_mode },
1650#ifndef FM_MODE 1677#ifndef FM_MODE
1651 { radiomode_menu_string , toggle_radio_mode }, 1678 { radiomode_menu_string , toggle_radio_mode },
1679#endif
1680 { ID2P(LANG_SOUND_SETTINGS) , sound_menu },
1681#ifndef SIMULATOR
1682#if defined(HAVE_FMRADIO_IN) || CONFIG_CODEC != SWCODEC
1683 { ID2P(LANG_RECORDING_MENU) , fm_recording_screen },
1684 { ID2P(LANG_RECORDING_SETTINGS) , fm_recording_settings },
1652#endif 1685#endif
1653 { ID2P(LANG_SOUND_SETTINGS) , sound_menu },
1654#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
1655 { ID2P(LANG_RECORDING_SETTINGS) , fm_recording_settings},
1656#endif 1686#endif
1657 { ID2P(LANG_FM_SCAN_PRESETS) , scan_presets }, 1687 { ID2P(LANG_FM_SCAN_PRESETS) , scan_presets },
1658 }; 1688 };
1659 1689
1660 create_monomode_menu(); 1690 create_monomode_menu();