summaryrefslogtreecommitdiff
path: root/apps/radio/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/radio/radio.c')
-rw-r--r--apps/radio/radio.c111
1 files changed, 0 insertions, 111 deletions
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index 362d10f9a3..6038d600a9 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -54,9 +54,7 @@
54#include "viewport.h" 54#include "viewport.h"
55#include "skin_engine/skin_engine.h" 55#include "skin_engine/skin_engine.h"
56#include "statusbar-skinned.h" 56#include "statusbar-skinned.h"
57#if CONFIG_CODEC == SWCODEC
58#include "playback.h" 57#include "playback.h"
59#endif
60#include "presets.h" 58#include "presets.h"
61 59
62#if CONFIG_TUNER 60#if CONFIG_TUNER
@@ -353,14 +351,6 @@ void radio_screen(void)
353 int lastbutton = BUTTON_NONE; 351 int lastbutton = BUTTON_NONE;
354 unsigned long rec_lastclick = 0; 352 unsigned long rec_lastclick = 0;
355#endif 353#endif
356#if CONFIG_CODEC != SWCODEC
357 int timeout = current_tick + HZ/10;
358#if !defined(SIMULATOR)
359 unsigned int last_seconds = 0;
360 unsigned int seconds = 0;
361 struct audio_recording_options rec_options;
362#endif /* SIMULATOR */
363#endif /* CONFIG_CODEC != SWCODEC */
364#ifndef HAVE_NOISY_IDLE_MODE 354#ifndef HAVE_NOISY_IDLE_MODE
365 int button_timeout = current_tick + (2*HZ); 355 int button_timeout = current_tick + (2*HZ);
366#endif 356#endif
@@ -383,29 +373,7 @@ void radio_screen(void)
383 373
384 fms_fix_displays(FMS_ENTER); 374 fms_fix_displays(FMS_ENTER);
385 375
386#ifndef SIMULATOR
387
388#if CONFIG_CODEC != SWCODEC
389 rec_create_directory();
390 audio_init_recording();
391
392 sound_settings_apply();
393 /* Yes, we use the D/A for monitoring */
394 peak_meter_playback(true);
395
396 peak_meter_enable(true);
397
398 rec_init_recording_options(&rec_options);
399 rec_options.rec_source = AUDIO_SRC_LINEIN;
400 rec_set_recording_options(&rec_options);
401
402 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
403 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
404
405#endif /* CONFIG_CODEC != SWCODEC */
406#endif /* ndef SIMULATOR */
407 /* turn on radio */ 376 /* turn on radio */
408#if CONFIG_CODEC == SWCODEC
409 /* This should be done before touching audio settings */ 377 /* This should be done before touching audio settings */
410 while (!pcm_is_initialized()) 378 while (!pcm_is_initialized())
411 sleep(0); 379 sleep(0);
@@ -413,10 +381,6 @@ void radio_screen(void)
413 audio_set_input_source(AUDIO_SRC_FMRADIO, 381 audio_set_input_source(AUDIO_SRC_FMRADIO,
414 (radio_status == FMRADIO_PAUSED) ? 382 (radio_status == FMRADIO_PAUSED) ?
415 SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); 383 SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
416#else
417 if (radio_status == FMRADIO_OFF)
418 radio_start();
419#endif
420 384
421 if(radio_preset_count() < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN))) 385 if(radio_preset_count() < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN)))
422 presets_scan(NULL); 386 presets_scan(NULL);
@@ -468,13 +432,6 @@ void radio_screen(void)
468 switch(button) 432 switch(button)
469 { 433 {
470 case ACTION_FM_STOP: 434 case ACTION_FM_STOP:
471#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
472 if(audio_status() == AUDIO_STATUS_RECORD)
473 {
474 audio_stop();
475 }
476 else
477#endif
478 { 435 {
479 done = true; 436 done = true;
480 if(presets_have_changed()) 437 if(presets_have_changed())
@@ -513,18 +470,11 @@ void radio_screen(void)
513 rec_command(RECORDING_CMD_START); 470 rec_command(RECORDING_CMD_START);
514 update_type = SKIN_REFRESH_ALL; 471 update_type = SKIN_REFRESH_ALL;
515 } 472 }
516#if CONFIG_CODEC != SWCODEC
517 last_seconds = 0;
518#endif
519#endif /* SIMULATOR */ 473#endif /* SIMULATOR */
520 break; 474 break;
521#endif /* #ifdef FM_RECORD */ 475#endif /* #ifdef FM_RECORD */
522 476
523 case ACTION_FM_EXIT: 477 case ACTION_FM_EXIT:
524#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
525 if(audio_status() == AUDIO_STATUS_RECORD)
526 audio_stop();
527#endif
528 keep_playing = true; 478 keep_playing = true;
529 done = true; 479 done = true;
530 if(presets_have_changed()) 480 if(presets_have_changed())
@@ -629,10 +579,6 @@ void radio_screen(void)
629#endif /* FM_FREEZE */ 579#endif /* FM_FREEZE */
630 580
631 case SYS_USB_CONNECTED: 581 case SYS_USB_CONNECTED:
632#if CONFIG_CODEC != SWCODEC
633 /* Only accept USB connection when not recording */
634 if(audio_status() != AUDIO_STATUS_RECORD)
635#endif
636 { 582 {
637 default_event_handler(SYS_USB_CONNECTED); 583 default_event_handler(SYS_USB_CONNECTED);
638 screen_freeze = true; /* Cosmetic: makes sure the 584 screen_freeze = true; /* Cosmetic: makes sure the
@@ -688,10 +634,6 @@ void radio_screen(void)
688 default_event_handler(button); 634 default_event_handler(button);
689 if (!tuner_get(RADIO_PRESENT)) 635 if (!tuner_get(RADIO_PRESENT))
690 { 636 {
691#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
692 if(audio_status() == AUDIO_STATUS_RECORD)
693 audio_stop();
694#endif
695 keep_playing = false; 637 keep_playing = false;
696 done = true; 638 done = true;
697 if(presets_have_changed()) 639 if(presets_have_changed())
@@ -713,21 +655,10 @@ void radio_screen(void)
713 lastbutton = button; 655 lastbutton = button;
714#endif 656#endif
715 657
716#if CONFIG_CODEC != SWCODEC
717 peak_meter_peek();
718#endif
719
720 if(!screen_freeze) 658 if(!screen_freeze)
721 { 659 {
722 /* Only display the peak meter when not recording */ 660 /* Only display the peak meter when not recording */
723#if CONFIG_CODEC != SWCODEC
724 if(TIME_AFTER(current_tick, timeout))
725 {
726 timeout = current_tick + HZ;
727#else /* SWCODEC */
728 { 661 {
729#endif /* CONFIG_CODEC == SWCODEC */
730
731 /* keep "mono" from always being displayed when paused */ 662 /* keep "mono" from always being displayed when paused */
732 if (radio_status != FMRADIO_PAUSED) 663 if (radio_status != FMRADIO_PAUSED)
733 { 664 {
@@ -742,15 +673,8 @@ void radio_screen(void)
742 } 673 }
743 } 674 }
744 675
745#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
746 seconds = audio_recorded_time() / HZ;
747 if (update_type || seconds > last_seconds)
748 {
749 last_seconds = seconds;
750#else
751 if (update_type) 676 if (update_type)
752 { 677 {
753#endif
754 FOR_NB_SCREENS(i) 678 FOR_NB_SCREENS(i)
755 skin_update(FM_SCREEN, i, update_type); 679 skin_update(FM_SCREEN, i, update_type);
756 if (update_type == (int)SKIN_REFRESH_ALL) 680 if (update_type == (int)SKIN_REFRESH_ALL)
@@ -774,13 +698,6 @@ void radio_screen(void)
774 enqueue); 698 enqueue);
775 } 699 }
776 700
777#if CONFIG_CODEC != SWCODEC
778 if(audio_status() & AUDIO_STATUS_ERROR)
779 {
780 done = true;
781 }
782#endif
783
784#ifndef HAVE_NOISY_IDLE_MODE 701#ifndef HAVE_NOISY_IDLE_MODE
785 if (TIME_AFTER(current_tick, button_timeout)) 702 if (TIME_AFTER(current_tick, button_timeout))
786 { 703 {
@@ -790,23 +707,6 @@ void radio_screen(void)
790 } /*while(!done)*/ 707 } /*while(!done)*/
791 708
792#ifndef SIMULATOR 709#ifndef SIMULATOR
793#if CONFIG_CODEC != SWCODEC
794 if(audio_status() & AUDIO_STATUS_ERROR)
795 {
796 splash(0, str(LANG_DISK_FULL));
797 audio_error_clear();
798
799 while(1)
800 {
801 button = get_action(CONTEXT_FM|ALLOW_SOFTLOCK, TIMEOUT_BLOCK);
802 if(button == ACTION_FM_STOP)
803 break;
804 }
805 }
806
807 audio_init_playback();
808#endif /* CONFIG_CODEC != SWCODEC */
809
810 sound_settings_apply(); 710 sound_settings_apply();
811#endif /* SIMULATOR */ 711#endif /* SIMULATOR */
812 712
@@ -814,23 +714,12 @@ void radio_screen(void)
814 { 714 {
815/* Catch FMRADIO_PLAYING status for the sim. */ 715/* Catch FMRADIO_PLAYING status for the sim. */
816#ifndef SIMULATOR 716#ifndef SIMULATOR
817#if CONFIG_CODEC != SWCODEC
818 /* Enable the Left and right A/D Converter */
819 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
820 sound_default(SOUND_RIGHT_GAIN),
821 AUDIO_GAIN_LINEIN);
822 mas_codec_writereg(6, 0x4000);
823#endif
824 end_search(); 717 end_search();
825#endif /* SIMULATOR */ 718#endif /* SIMULATOR */
826 } 719 }
827 else 720 else
828 { 721 {
829#if CONFIG_CODEC == SWCODEC
830 audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); 722 audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
831#else
832 radio_stop();
833#endif
834 } 723 }
835 724
836#ifndef HAVE_NOISY_IDLE_MODE 725#ifndef HAVE_NOISY_IDLE_MODE