summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c578
1 files changed, 415 insertions, 163 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index e6b06d56dc..080cafcf2f 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -24,12 +24,14 @@
24#include <stdlib.h> 24#include <stdlib.h>
25 25
26#include "system.h" 26#include "system.h"
27#include "power.h"
27#include "lcd.h" 28#include "lcd.h"
28#include "led.h" 29#include "led.h"
29#include "mpeg.h" 30#include "mpeg.h"
30#include "audio.h" 31#include "audio.h"
31#if CONFIG_CODEC == SWCODEC 32#if CONFIG_CODEC == SWCODEC
32#include "pcm_record.h" 33#include "pcm_record.h"
34#include "playback.h"
33#endif 35#endif
34#ifdef HAVE_UDA1380 36#ifdef HAVE_UDA1380
35#include "uda1380.h" 37#include "uda1380.h"
@@ -37,7 +39,7 @@
37#ifdef HAVE_TLV320 39#ifdef HAVE_TLV320
38#include "tlv320.h" 40#include "tlv320.h"
39#endif 41#endif
40 42#include "recording.h"
41#include "mp3_playback.h" 43#include "mp3_playback.h"
42#include "mas.h" 44#include "mas.h"
43#include "button.h" 45#include "button.h"
@@ -66,6 +68,7 @@
66#include "splash.h" 68#include "splash.h"
67#include "screen_access.h" 69#include "screen_access.h"
68#include "action.h" 70#include "action.h"
71#include "radio.h"
69#ifdef HAVE_RECORDING 72#ifdef HAVE_RECORDING
70 73
71#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) 74#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1)
@@ -73,21 +76,6 @@
73bool f2_rec_screen(void); 76bool f2_rec_screen(void);
74bool f3_rec_screen(void); 77bool f3_rec_screen(void);
75 78
76#define SOURCE_MIC 0
77#define SOURCE_LINE 1
78#ifdef HAVE_SPDIF_IN
79#define SOURCE_SPDIF 2
80#define MAX_SOURCE SOURCE_SPDIF
81#else
82#define MAX_SOURCE SOURCE_LINE
83#endif
84
85#if CONFIG_CODEC == SWCODEC
86#define REC_FILE_ENDING ".wav"
87#else
88#define REC_FILE_ENDING ".mp3"
89#endif
90
91#define MAX_FILE_SIZE 0x7F800000 /* 2 GB - 4 MB */ 79#define MAX_FILE_SIZE 0x7F800000 /* 2 GB - 4 MB */
92 80
93int screen_update = NB_SCREENS; 81int screen_update = NB_SCREENS;
@@ -102,6 +90,19 @@ const char* const freq_str[6] =
102 "16kHz" 90 "16kHz"
103}; 91};
104 92
93#if CONFIG_CODEC == SWCODEC
94#define REC_ENCODER_ID(q) \
95 rec_quality_info_afmt[q]
96#define REC_QUALITY_LABEL(q) \
97 (audio_formats[REC_ENCODER_ID(q)].label)
98#define REC_FILE_ENDING(q) \
99 (audio_formats[REC_ENCODER_ID(q)].ext)
100#else
101/* default record file extension for HWCODEC */
102#define REC_QUALITY_LABEL(q) "MP3"
103#define REC_FILE_ENDING(q) ".mp3"
104#endif
105
105#ifdef HAVE_AGC 106#ifdef HAVE_AGC
106/* Timing counters: 107/* Timing counters:
107 * peak_time is incremented every 0.2s, every 2nd run of record screen loop. 108 * peak_time is incremented every 0.2s, every 2nd run of record screen loop.
@@ -161,13 +162,14 @@ static short agc_maxgain;
161 162
162static void set_gain(void) 163static void set_gain(void)
163{ 164{
164 if(global_settings.rec_source == SOURCE_MIC) 165 if(global_settings.rec_source == AUDIO_SRC_MIC)
165 { 166 {
166 audio_set_recording_gain(global_settings.rec_mic_gain, 167 audio_set_recording_gain(global_settings.rec_mic_gain,
167 0, AUDIO_GAIN_MIC); 168 0, AUDIO_GAIN_MIC);
168 } 169 }
169 else 170 else
170 { 171 {
172 /* AUDIO_SRC_LINEIN, AUDIO_SRC_SPDIF, AUDIO_SRC_FMRADIO */
171 audio_set_recording_gain(global_settings.rec_left_gain, 173 audio_set_recording_gain(global_settings.rec_left_gain,
172 global_settings.rec_right_gain, 174 global_settings.rec_right_gain,
173 AUDIO_GAIN_LINEIN); 175 AUDIO_GAIN_LINEIN);
@@ -217,12 +219,16 @@ bool agc_gain_is_max(bool left, bool right)
217 if (agc_preset == 0) 219 if (agc_preset == 0)
218 return false; 220 return false;
219 221
220 if (global_settings.rec_source == SOURCE_LINE) 222 switch (global_settings.rec_source)
221 { 223 {
224 case AUDIO_SRC_LINEIN:
225#ifdef HAVE_FMRADIO_IN
226 case AUDIO_SRC_FMRADIO:
227#endif
222 gain_current_l = global_settings.rec_left_gain; 228 gain_current_l = global_settings.rec_left_gain;
223 gain_current_r = global_settings.rec_right_gain; 229 gain_current_r = global_settings.rec_right_gain;
224 } else 230 break;
225 { 231 default:
226 gain_current_l = global_settings.rec_mic_gain; 232 gain_current_l = global_settings.rec_mic_gain;
227 gain_current_r = global_settings.rec_mic_gain; 233 gain_current_r = global_settings.rec_mic_gain;
228 } 234 }
@@ -235,13 +241,16 @@ void change_recording_gain(bool increment, bool left, bool right)
235{ 241{
236 int factor = (increment ? 1 : -1); 242 int factor = (increment ? 1 : -1);
237 243
238 if (global_settings.rec_source == SOURCE_LINE) 244 switch (global_settings.rec_source)
239 { 245 {
246 case AUDIO_SRC_LINEIN:
247#ifdef HAVE_FMRADIO_IN
248 case AUDIO_SRC_FMRADIO:
249#endif
240 if(left) global_settings.rec_left_gain += factor; 250 if(left) global_settings.rec_left_gain += factor;
241 if (right) global_settings.rec_right_gain += factor; 251 if (right) global_settings.rec_right_gain += factor;
242 } 252 break;
243 else 253 default:
244 {
245 global_settings.rec_mic_gain += factor; 254 global_settings.rec_mic_gain += factor;
246 } 255 }
247} 256}
@@ -443,12 +452,15 @@ void adjust_cursor(void)
443#ifdef HAVE_AGC 452#ifdef HAVE_AGC
444 switch(global_settings.rec_source) 453 switch(global_settings.rec_source)
445 { 454 {
446 case SOURCE_MIC: 455 case AUDIO_SRC_MIC:
447 if(cursor == 2) 456 if(cursor == 2)
448 cursor = 4; 457 cursor = 4;
449 else if(cursor == 3) 458 else if(cursor == 3)
450 cursor = 1; 459 cursor = 1;
451 case SOURCE_LINE: 460 case AUDIO_SRC_LINEIN:
461#ifdef HAVE_FMRADIO_IN
462 case AUDIO_SRC_FMRADIO:
463#endif
452 max_cursor = 5; 464 max_cursor = 5;
453 break; 465 break;
454 default: 466 default:
@@ -458,10 +470,13 @@ void adjust_cursor(void)
458#else 470#else
459 switch(global_settings.rec_source) 471 switch(global_settings.rec_source)
460 { 472 {
461 case SOURCE_MIC: 473 case AUDIO_SRC_MIC:
462 max_cursor = 1; 474 max_cursor = 1;
463 break; 475 break;
464 case SOURCE_LINE: 476 case AUDIO_SRC_LINEIN:
477#ifdef HAVE_FMRADIO_IN
478 case AUDIO_SRC_FMRADIO:
479#endif
465 max_cursor = 3; 480 max_cursor = 3;
466 break; 481 break;
467 default: 482 default:
@@ -481,10 +496,13 @@ char *rec_create_filename(char *buffer)
481 else 496 else
482 strncpy(buffer, rec_base_directory, MAX_PATH); 497 strncpy(buffer, rec_base_directory, MAX_PATH);
483 498
499
484#ifdef CONFIG_RTC 500#ifdef CONFIG_RTC
485 create_datetime_filename(buffer, buffer, "R", REC_FILE_ENDING); 501 create_datetime_filename(buffer, buffer, "R",
502 REC_FILE_ENDING(global_settings.rec_quality));
486#else 503#else
487 create_numbered_filename(buffer, buffer, "rec_", REC_FILE_ENDING, 4); 504 create_numbered_filename(buffer, buffer, "rec_",
505 REC_FILE_ENDING(global_settings.rec_quality), 4);
488#endif 506#endif
489 return buffer; 507 return buffer;
490} 508}
@@ -515,8 +533,190 @@ int rec_create_directory(void)
515 return 0; 533 return 0;
516} 534}
517 535
536#if CONFIG_CODEC == SWCODEC && !defined(SIMULATOR)
537/**
538 * Selects an audio source for recording or playback
539 * powers/unpowers related devices.
540 * Here because it calls app code and used only for HAVE_RECORDING atm.
541 * Would like it in pcm_record.c.
542 */
543#if defined(HAVE_UDA1380)
544#define ac_disable_recording uda1380_disable_recording
545#define ac_enable_recording uda1380_enable_recording
546#define ac_set_monitor uda1380_set_monitor
547#elif defined(HAVE_TLV320)
548#define ac_disable_recording tlv320_disable_recording
549#define ac_enable_recording tlv320_enable_recording
550#define ac_set_monitor tlv320_set_monitor
551#endif
552
553void rec_set_source(int source, int flags)
554{
555 /* Prevent pops from unneeded switching */
556 static int last_source = AUDIO_SRC_PLAYBACK;
557#ifdef HAVE_TLV320
558 static bool last_recording = false;
559#endif
560
561 bool recording = flags & SRCF_RECORDING;
562 /* Default to peakmeter record. */
563 bool pm_playback = false;
564 bool pm_enabled = true;
565
566 /** Do power up/down of associated device(s) **/
567
568#ifdef HAVE_SPDIF_IN
569 if ((source == AUDIO_SRC_SPDIF) != (source == last_source))
570 cpu_boost(source == AUDIO_SRC_SPDIF);
571
572#ifdef HAVE_SPDIF_POWER
573 /* Check if S/PDIF output power should be switched off or on. NOTE: assumes
574 both optical in and out is controlled by the same power source, which is
575 the case on H1x0. */
576 spdif_power_enable((source == AUDIO_SRC_SPDIF) ||
577 global_settings.spdif_enable);
578#endif
579#endif
580
581#ifdef CONFIG_TUNER
582 /* Switch radio off or on per source and flags. */
583 if (source != AUDIO_SRC_FMRADIO)
584 radio_stop();
585 else if (flags & SRCF_FMRADIO_PAUSED)
586 radio_pause();
587 else
588 radio_start();
589#endif
590
591 switch (source)
592 {
593 default: /* playback - no recording */
594 pm_playback = true;
595 if (source == last_source)
596 break;
597 ac_disable_recording();
598 ac_set_monitor(false);
599 pcm_rec_mux(0); /* line in */
600 break;
601
602 case AUDIO_SRC_MIC: /* recording only */
603 if (source == last_source)
604 break;
605 ac_enable_recording(true); /* source mic */
606 pcm_rec_mux(0); /* line in */
607 break;
608
609 case AUDIO_SRC_LINEIN: /* recording only */
610 if (source == last_source)
611 break;
612 pcm_rec_mux(0); /* line in */
613 ac_enable_recording(false); /* source line */
614 break;
615
616#ifdef HAVE_SPDIF_IN
617 case AUDIO_SRC_SPDIF: /* recording only */
618 if (recording)
619 {
620 /* This was originally done in audio_set_recording_options only */
621#ifdef HAVE_SPDIF_POWER
622 EBU1CONFIG = global_settings.spdif_enable ? (1 << 2) : 0;
623 /* Input source is EBUin1, Feed-through monitoring if desired */
624#else
625 EBU1CONFIG = (1 << 2);
626 /* Input source is EBUin1, Feed-through monitoring */
627#endif
628 }
629
630 if (source != last_source)
631 uda1380_disable_recording();
632 break;
633#endif /* HAVE_SPDIF_IN */
634
635#ifdef HAVE_FMRADIO_IN
636 case AUDIO_SRC_FMRADIO:
637 if (!recording)
638 {
639 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
640 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
641 pm_playback = true;
642 pm_enabled = false;
643 }
644
645 pcm_rec_mux(1); /* fm radio */
646
647#ifdef HAVE_UDA1380
648 if (source == last_source)
649 break;
650 /* I2S recording and playback */
651 uda1380_enable_recording(false); /* source line */
652 uda1380_set_monitor(true);
653#endif
654#ifdef HAVE_TLV320
655 /* I2S recording and analog playback */
656 if (source == last_source && recording == last_recording)
657 break;
658
659 last_recording = recording;
660
661 if (recording)
662 tlv320_enable_recording(false); /* source line */
663 else
664 {
665 tlv320_disable_recording();
666 tlv320_set_monitor(true); /* analog bypass */
667 }
668#endif
669 break;
670/* #elif defined(CONFIG_TUNER) */
671/* Have radio but cannot record it */
672/* case AUDIO_SRC_FMRADIO: */
673/* break; */
674#endif /* HAVE_FMRADIO_IN */
675 } /* end switch */
676
677 peak_meter_playback(pm_playback);
678 peak_meter_enabled = pm_enabled;
679
680 last_source = source;
681} /* rec_set_source */
682#endif /* CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) */
683
684/* steal the mp3 buffer then actually set options */
685void rec_set_recording_options(int frequency, int quality,
686 int source, int source_flags,
687 int channel_mode, bool editable,
688 int prerecord_time)
689{
690#if CONFIG_CODEC != SWCODEC
691 if (global_settings.rec_prerecord_time)
692#endif
693 talk_buffer_steal(); /* will use the mp3 buffer */
694
695#if CONFIG_CODEC == SWCODEC
696 rec_set_source(source, source_flags | SRCF_RECORDING);
697#else
698 (void)source_flags;
699#endif
700
701 audio_set_recording_options(frequency, quality, source,
702 channel_mode, editable, prerecord_time);
703}
704
518static char path_buffer[MAX_PATH]; 705static char path_buffer[MAX_PATH];
519 706
707/* steals mp3 buffer, creates unique filename and starts recording */
708void rec_record(void)
709{
710 talk_buffer_steal(); /* we use the mp3 buffer */
711 audio_record(rec_create_filename(path_buffer));
712}
713
714/* creates unique filename and starts recording */
715void rec_new_file(void)
716{
717 audio_new_file(rec_create_filename(path_buffer));
718}
719
520/* used in trigger_listerner and recording_screen */ 720/* used in trigger_listerner and recording_screen */
521static unsigned int last_seconds = 0; 721static unsigned int last_seconds = 0;
522 722
@@ -533,16 +733,16 @@ static void trigger_listener(int trigger_status)
533 if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD) 733 if((audio_status() & AUDIO_STATUS_RECORD) != AUDIO_STATUS_RECORD)
534 { 734 {
535 talk_buffer_steal(); /* we use the mp3 buffer */ 735 talk_buffer_steal(); /* we use the mp3 buffer */
536 audio_record(rec_create_filename(path_buffer)); 736 rec_record();
537 737 /* give control to mpeg thread so that it can start
538 /* give control to mpeg thread so that it can start recording*/ 738 recording */
539 yield(); yield(); yield(); 739 yield(); yield(); yield();
540 } 740 }
541 741
542 /* if we're already recording this is a retrigger */ 742 /* if we're already recording this is a retrigger */
543 else 743 else
544 { 744 {
545 audio_new_file(rec_create_filename(path_buffer)); 745 rec_new_file();
546 /* tell recording_screen to reset the time */ 746 /* tell recording_screen to reset the time */
547 last_seconds = 0; 747 last_seconds = 0;
548 } 748 }
@@ -563,10 +763,9 @@ static void trigger_listener(int trigger_status)
563 } 763 }
564} 764}
565 765
566bool recording_screen(void) 766bool recording_screen(bool no_source)
567{ 767{
568 long button; 768 long button;
569 long lastbutton = BUTTON_NONE;
570 bool done = false; 769 bool done = false;
571 char buf[32]; 770 char buf[32];
572 char buf2[32]; 771 char buf2[32];
@@ -575,11 +774,19 @@ bool recording_screen(void)
575 bool have_recorded = false; 774 bool have_recorded = false;
576 unsigned int seconds; 775 unsigned int seconds;
577 int hours, minutes; 776 int hours, minutes;
578 char path_buffer[MAX_PATH];
579 char filename[13]; 777 char filename[13];
580 bool been_in_usb_mode = false; 778 bool been_in_usb_mode = false;
581 int last_audio_stat = -1; 779 int last_audio_stat = -1;
582 int audio_stat; 780 int audio_stat;
781#ifdef HAVE_FMRADIO_IN
782 /* Radio is left on if:
783 * 1) Is was on at the start and the initial source is FM Radio
784 * 2) 1) and the source was never changed to something else
785 */
786 int radio_status = (global_settings.rec_source != AUDIO_SRC_FMRADIO) ?
787 FMRADIO_OFF : get_radio_status();
788#endif
789 int talk_menu = global_settings.talk_menu;
583#if CONFIG_LED == LED_REAL 790#if CONFIG_LED == LED_REAL
584 bool led_state = false; 791 bool led_state = false;
585 int led_countdown = 2; 792 int led_countdown = 2;
@@ -608,6 +815,18 @@ bool recording_screen(void)
608 ata_set_led_enabled(false); 815 ata_set_led_enabled(false);
609#endif 816#endif
610 817
818#if CONFIG_CODEC == SWCODEC
819 audio_stop();
820 voice_stop();
821 /* recording_menu gets messed up: so reset talk_menu */
822 talk_menu = global_settings.talk_menu;
823 global_settings.talk_menu = 0;
824#else
825 /* Yes, we use the D/A for monitoring */
826 peak_meter_enabled = true;
827 peak_meter_playback(true);
828#endif
829
611#ifndef SIMULATOR 830#ifndef SIMULATOR
612 audio_init_recording(talk_get_bufsize()); 831 audio_init_recording(talk_get_bufsize());
613#else 832#else
@@ -616,44 +835,19 @@ bool recording_screen(void)
616 835
617 sound_set_volume(global_settings.volume); 836 sound_set_volume(global_settings.volume);
618 837
619#if CONFIG_CODEC == SWCODEC
620 audio_stop();
621 /* Set peak meter to recording mode */
622 peak_meter_playback(false);
623
624#if defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
625 if (global_settings.rec_source == SOURCE_SPDIF)
626 cpu_boost(true);
627#endif
628
629#else
630 /* Yes, we use the D/A for monitoring */
631 peak_meter_playback(true);
632#endif
633 peak_meter_enabled = true;
634#ifdef HAVE_AGC 838#ifdef HAVE_AGC
635 peak_meter_get_peakhold(&peak_l, &peak_r); 839 peak_meter_get_peakhold(&peak_l, &peak_r);
636#endif 840#endif
637 841
638#if CONFIG_CODEC != SWCODEC 842 rec_set_recording_options(global_settings.rec_frequency,
639 if (global_settings.rec_prerecord_time) 843 global_settings.rec_quality,
640#endif 844 global_settings.rec_source,
641 talk_buffer_steal(); /* will use the mp3 buffer */ 845 0,
642 846 global_settings.rec_channels,
643#if defined(HAVE_SPDIF_POWER) && !defined(SIMULATOR) 847 global_settings.rec_editable,
644 /* Tell recording whether we want S/PDIF power enabled at all times */ 848 global_settings.rec_prerecord_time);
645 audio_set_spdif_power_setting(global_settings.spdif_enable);
646#endif
647
648 audio_set_recording_options(global_settings.rec_frequency,
649 global_settings.rec_quality,
650 global_settings.rec_source,
651 global_settings.rec_channels,
652 global_settings.rec_editable,
653 global_settings.rec_prerecord_time);
654 849
655 set_gain(); 850 set_gain();
656
657 settings_apply_trigger(); 851 settings_apply_trigger();
658 852
659#ifdef HAVE_AGC 853#ifdef HAVE_AGC
@@ -663,7 +857,7 @@ bool recording_screen(void)
663 agc_preset_str[3] = str(LANG_AGC_DJSET); 857 agc_preset_str[3] = str(LANG_AGC_DJSET);
664 agc_preset_str[4] = str(LANG_AGC_MEDIUM); 858 agc_preset_str[4] = str(LANG_AGC_MEDIUM);
665 agc_preset_str[5] = str(LANG_AGC_VOICE); 859 agc_preset_str[5] = str(LANG_AGC_VOICE);
666 if (global_settings.rec_source == SOURCE_MIC) { 860 if (global_settings.rec_source == AUDIO_SRC_MIC) {
667 agc_preset = global_settings.rec_agc_preset_mic; 861 agc_preset = global_settings.rec_agc_preset_mic;
668 agc_maxgain = global_settings.rec_agc_maxgain_mic; 862 agc_maxgain = global_settings.rec_agc_maxgain_mic;
669 } 863 }
@@ -697,11 +891,7 @@ bool recording_screen(void)
697 891
698 while(!done) 892 while(!done)
699 { 893 {
700#if CONFIG_CODEC == SWCODEC
701 audio_stat = pcm_rec_status();
702#else
703 audio_stat = audio_status(); 894 audio_stat = audio_status();
704#endif
705 895
706#if CONFIG_LED == LED_REAL 896#if CONFIG_LED == LED_REAL
707 897
@@ -794,8 +984,8 @@ bool recording_screen(void)
794 } 984 }
795 else 985 else
796 { 986 {
797 peak_meter_playback(true);
798#if CONFIG_CODEC != SWCODEC 987#if CONFIG_CODEC != SWCODEC
988 peak_meter_playback(true);
799 peak_meter_enabled = false; 989 peak_meter_enabled = false;
800#endif 990#endif
801 done = true; 991 done = true;
@@ -815,14 +1005,13 @@ bool recording_screen(void)
815 /* manual recording */ 1005 /* manual recording */
816 have_recorded = true; 1006 have_recorded = true;
817 talk_buffer_steal(); /* we use the mp3 buffer */ 1007 talk_buffer_steal(); /* we use the mp3 buffer */
818 audio_record(rec_create_filename(path_buffer)); 1008 rec_record();
819 last_seconds = 0; 1009 last_seconds = 0;
820 if (global_settings.talk_menu) 1010 if (talk_menu)
821 { /* no voice possible here, but a beep */ 1011 { /* no voice possible here, but a beep */
822 audio_beep(HZ/2); /* longer beep on start */ 1012 audio_beep(HZ/2); /* longer beep on start */
823 } 1013 }
824 } 1014 }
825
826 /* this is triggered recording */ 1015 /* this is triggered recording */
827 else 1016 else
828 { 1017 {
@@ -838,7 +1027,7 @@ bool recording_screen(void)
838 /*if new file button pressed, start new file */ 1027 /*if new file button pressed, start new file */
839 if (button == ACTION_REC_NEWFILE) 1028 if (button == ACTION_REC_NEWFILE)
840 { 1029 {
841 audio_new_file(rec_create_filename(path_buffer)); 1030 rec_new_file();
842 last_seconds = 0; 1031 last_seconds = 0;
843 } 1032 }
844 else 1033 else
@@ -847,7 +1036,7 @@ bool recording_screen(void)
847 if(audio_stat & AUDIO_STATUS_PAUSE) 1036 if(audio_stat & AUDIO_STATUS_PAUSE)
848 { 1037 {
849 audio_resume_recording(); 1038 audio_resume_recording();
850 if (global_settings.talk_menu) 1039 if (talk_menu)
851 { /* no voice possible here, but a beep */ 1040 { /* no voice possible here, but a beep */
852 audio_beep(HZ/4); /* short beep on resume */ 1041 audio_beep(HZ/4); /* short beep on resume */
853 } 1042 }
@@ -883,7 +1072,7 @@ bool recording_screen(void)
883 sound_set_volume(global_settings.volume); 1072 sound_set_volume(global_settings.volume);
884 break; 1073 break;
885 case 1: 1074 case 1:
886 if(global_settings.rec_source == SOURCE_MIC) 1075 if(global_settings.rec_source == AUDIO_SRC_MIC)
887 { 1076 {
888 if(global_settings.rec_mic_gain < 1077 if(global_settings.rec_mic_gain <
889 sound_max(SOUND_MIC_GAIN)) 1078 sound_max(SOUND_MIC_GAIN))
@@ -913,7 +1102,7 @@ bool recording_screen(void)
913 case 4: 1102 case 4:
914 agc_preset = MIN(agc_preset + 1, AGC_MODE_SIZE); 1103 agc_preset = MIN(agc_preset + 1, AGC_MODE_SIZE);
915 agc_enable = (agc_preset != 0); 1104 agc_enable = (agc_preset != 0);
916 if (global_settings.rec_source == SOURCE_MIC) { 1105 if (global_settings.rec_source == AUDIO_SRC_MIC) {
917 global_settings.rec_agc_preset_mic = agc_preset; 1106 global_settings.rec_agc_preset_mic = agc_preset;
918 agc_maxgain = global_settings.rec_agc_maxgain_mic; 1107 agc_maxgain = global_settings.rec_agc_maxgain_mic;
919 } else { 1108 } else {
@@ -922,7 +1111,7 @@ bool recording_screen(void)
922 } 1111 }
923 break; 1112 break;
924 case 5: 1113 case 5:
925 if (global_settings.rec_source == SOURCE_MIC) 1114 if (global_settings.rec_source == AUDIO_SRC_MIC)
926 { 1115 {
927 agc_maxgain = MIN(agc_maxgain + 1, 1116 agc_maxgain = MIN(agc_maxgain + 1,
928 sound_max(SOUND_MIC_GAIN)); 1117 sound_max(SOUND_MIC_GAIN));
@@ -951,7 +1140,7 @@ bool recording_screen(void)
951 sound_set_volume(global_settings.volume); 1140 sound_set_volume(global_settings.volume);
952 break; 1141 break;
953 case 1: 1142 case 1:
954 if(global_settings.rec_source == SOURCE_MIC) 1143 if(global_settings.rec_source == AUDIO_SRC_MIC)
955 { 1144 {
956 if(global_settings.rec_mic_gain > 1145 if(global_settings.rec_mic_gain >
957 sound_min(SOUND_MIC_GAIN)) 1146 sound_min(SOUND_MIC_GAIN))
@@ -981,7 +1170,7 @@ bool recording_screen(void)
981 case 4: 1170 case 4:
982 agc_preset = MAX(agc_preset - 1, 0); 1171 agc_preset = MAX(agc_preset - 1, 0);
983 agc_enable = (agc_preset != 0); 1172 agc_enable = (agc_preset != 0);
984 if (global_settings.rec_source == SOURCE_MIC) { 1173 if (global_settings.rec_source == AUDIO_SRC_MIC) {
985 global_settings.rec_agc_preset_mic = agc_preset; 1174 global_settings.rec_agc_preset_mic = agc_preset;
986 agc_maxgain = global_settings.rec_agc_maxgain_mic; 1175 agc_maxgain = global_settings.rec_agc_maxgain_mic;
987 } else { 1176 } else {
@@ -990,7 +1179,7 @@ bool recording_screen(void)
990 } 1179 }
991 break; 1180 break;
992 case 5: 1181 case 5:
993 if (global_settings.rec_source == SOURCE_MIC) 1182 if (global_settings.rec_source == AUDIO_SRC_MIC)
994 { 1183 {
995 agc_maxgain = MAX(agc_maxgain - 1, 1184 agc_maxgain = MAX(agc_maxgain - 1,
996 sound_min(SOUND_MIC_GAIN)); 1185 sound_min(SOUND_MIC_GAIN));
@@ -1012,49 +1201,73 @@ bool recording_screen(void)
1012 case ACTION_STD_MENU: 1201 case ACTION_STD_MENU:
1013 if(audio_stat != AUDIO_STATUS_RECORD) 1202 if(audio_stat != AUDIO_STATUS_RECORD)
1014 { 1203 {
1204#ifdef HAVE_FMRADIO_IN
1205 const int prev_rec_source = global_settings.rec_source;
1206#endif
1207
1015#if CONFIG_LED == LED_REAL 1208#if CONFIG_LED == LED_REAL
1016 /* led is restored at begin of loop / end of function */ 1209 /* led is restored at begin of loop / end of function */
1017 led(false); 1210 led(false);
1018#endif 1211#endif
1019 if (recording_menu(false)) 1212 if (recording_menu(no_source))
1020 { 1213 {
1021 return SYS_USB_CONNECTED; 1214 done = true;
1215 been_in_usb_mode = true;
1216#ifdef HAVE_FMRADIO_IN
1217 radio_status = FMRADIO_OFF;
1218#endif
1022 } 1219 }
1023 settings_save(); 1220 else
1221 {
1222 settings_save();
1223
1224#ifdef HAVE_FMRADIO_IN
1225 /* If input changes away from FM Radio, radio will
1226 remain off when recording screen closes. */
1227 if (global_settings.rec_source != prev_rec_source
1228 && prev_rec_source == AUDIO_SRC_FMRADIO)
1229 radio_status = FMRADIO_OFF;
1230#endif
1024 1231
1025#if CONFIG_CODEC != SWCODEC 1232#if CONFIG_CODEC == SWCODEC
1026 if (global_settings.rec_prerecord_time) 1233 /* reinit after submenu exit */
1234 audio_close_recording();
1235 audio_init_recording(talk_get_bufsize());
1027#endif 1236#endif
1028 talk_buffer_steal(); /* will use the mp3 buffer */ 1237 rec_set_recording_options(
1029 1238 global_settings.rec_frequency,
1030 audio_set_recording_options(global_settings.rec_frequency, 1239 global_settings.rec_quality,
1031 global_settings.rec_quality, 1240 global_settings.rec_source,
1032 global_settings.rec_source, 1241 0,
1033 global_settings.rec_channels, 1242 global_settings.rec_channels,
1034 global_settings.rec_editable, 1243 global_settings.rec_editable,
1035 global_settings.rec_prerecord_time); 1244 global_settings.rec_prerecord_time);
1245
1036#ifdef HAVE_AGC 1246#ifdef HAVE_AGC
1037 if (global_settings.rec_source == SOURCE_MIC) { 1247 if (global_settings.rec_source == AUDIO_SRC_MIC) {
1038 agc_preset = global_settings.rec_agc_preset_mic; 1248 agc_preset = global_settings.rec_agc_preset_mic;
1039 agc_maxgain = global_settings.rec_agc_maxgain_mic; 1249 agc_maxgain = global_settings.rec_agc_maxgain_mic;
1040 } 1250 }
1041 else { 1251 else {
1042 agc_preset = global_settings.rec_agc_preset_line; 1252 agc_preset = global_settings.rec_agc_preset_line;
1043 agc_maxgain = global_settings.rec_agc_maxgain_line; 1253 agc_maxgain = global_settings.rec_agc_maxgain_line;
1044 } 1254 }
1045#endif 1255#endif
1046 1256
1047 adjust_cursor(); 1257 adjust_cursor();
1048 set_gain(); 1258 set_gain();
1049 update_countdown = 1; /* Update immediately */ 1259 update_countdown = 1; /* Update immediately */
1050 1260
1051 FOR_NB_SCREENS(i) 1261 FOR_NB_SCREENS(i)
1052 { 1262 {
1053 screens[i].setfont(FONT_SYSFIXED); 1263 screens[i].setfont(FONT_SYSFIXED);
1054 screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8); 1264 screens[i].setmargins(
1265 global_settings.invert_cursor ? 0 : w, 8);
1266 }
1055 } 1267 }
1056 } 1268 }
1057 break; 1269 break;
1270
1058#if CONFIG_KEYPAD == RECORDER_PAD 1271#if CONFIG_KEYPAD == RECORDER_PAD
1059 case ACTION_REC_F2: 1272 case ACTION_REC_F2:
1060 if(audio_stat != AUDIO_STATUS_RECORD) 1273 if(audio_stat != AUDIO_STATUS_RECORD)
@@ -1076,7 +1289,7 @@ bool recording_screen(void)
1076 case ACTION_REC_F3: 1289 case ACTION_REC_F3:
1077 if(audio_stat & AUDIO_STATUS_RECORD) 1290 if(audio_stat & AUDIO_STATUS_RECORD)
1078 { 1291 {
1079 audio_new_file(rec_create_filename(path_buffer)); 1292 rec_new_file();
1080 last_seconds = 0; 1293 last_seconds = 0;
1081 } 1294 }
1082 else 1295 else
@@ -1097,7 +1310,7 @@ bool recording_screen(void)
1097 } 1310 }
1098 } 1311 }
1099 break; 1312 break;
1100#endif 1313#endif /* CONFIG_KEYPAD == RECORDER_PAD */
1101 1314
1102 case SYS_USB_CONNECTED: 1315 case SYS_USB_CONNECTED:
1103 /* Only accept USB connection when not recording */ 1316 /* Only accept USB connection when not recording */
@@ -1106,6 +1319,9 @@ bool recording_screen(void)
1106 default_event_handler(SYS_USB_CONNECTED); 1319 default_event_handler(SYS_USB_CONNECTED);
1107 done = true; 1320 done = true;
1108 been_in_usb_mode = true; 1321 been_in_usb_mode = true;
1322#ifdef HAVE_FMRADIO_IN
1323 radio_status = FMRADIO_OFF;
1324#endif
1109 } 1325 }
1110 break; 1326 break;
1111 1327
@@ -1113,8 +1329,6 @@ bool recording_screen(void)
1113 default_event_handler(button); 1329 default_event_handler(button);
1114 break; 1330 break;
1115 } 1331 }
1116 if (button != BUTTON_NONE)
1117 lastbutton = button;
1118 1332
1119#ifdef HAVE_AGC 1333#ifdef HAVE_AGC
1120 peak_read = !peak_read; 1334 peak_read = !peak_read;
@@ -1230,7 +1444,7 @@ bool recording_screen(void)
1230 if (!(global_settings.rec_split_type) 1444 if (!(global_settings.rec_split_type)
1231 || (num_recorded_bytes >= MAX_FILE_SIZE)) 1445 || (num_recorded_bytes >= MAX_FILE_SIZE))
1232 { 1446 {
1233 audio_new_file(rec_create_filename(path_buffer)); 1447 rec_new_file();
1234 last_seconds = 0; 1448 last_seconds = 0;
1235 } 1449 }
1236 else 1450 else
@@ -1259,8 +1473,9 @@ bool recording_screen(void)
1259 screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 2, buf); 1473 screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 2, buf);
1260 } 1474 }
1261 1475
1262 if(global_settings.rec_source == SOURCE_MIC) 1476 if(global_settings.rec_source == AUDIO_SRC_MIC)
1263 { 1477 {
1478 /* Draw MIC recording gain */
1264 snprintf(buf, 32, "%s:%s", str(LANG_SYSFONT_RECORDING_GAIN), 1479 snprintf(buf, 32, "%s:%s", str(LANG_SYSFONT_RECORDING_GAIN),
1265 fmt_gain(SOUND_MIC_GAIN, 1480 fmt_gain(SOUND_MIC_GAIN,
1266 global_settings.rec_mic_gain, 1481 global_settings.rec_mic_gain,
@@ -1278,8 +1493,13 @@ bool recording_screen(void)
1278 PM_HEIGHT + 3, buf); 1493 PM_HEIGHT + 3, buf);
1279 } 1494 }
1280 } 1495 }
1281 else if(global_settings.rec_source == SOURCE_LINE) 1496 else if(global_settings.rec_source == AUDIO_SRC_LINEIN
1497#ifdef HAVE_FMRADIO_IN
1498 || global_settings.rec_source == AUDIO_SRC_FMRADIO
1499#endif
1500 )
1282 { 1501 {
1502 /* Draw LINE or FMRADIO recording gain */
1283 snprintf(buf, 32, "%s:%s", 1503 snprintf(buf, 32, "%s:%s",
1284 str(LANG_SYSFONT_RECORDING_LEFT), 1504 str(LANG_SYSFONT_RECORDING_LEFT),
1285 fmt_gain(SOUND_LEFT_GAIN, 1505 fmt_gain(SOUND_LEFT_GAIN,
@@ -1319,14 +1539,23 @@ bool recording_screen(void)
1319 1539
1320 FOR_NB_SCREENS(i) 1540 FOR_NB_SCREENS(i)
1321 { 1541 {
1322 if (global_settings.rec_source == SOURCE_LINE) 1542 switch (global_settings.rec_source)
1543 {
1544 case AUDIO_SRC_LINEIN:
1545#ifdef HAVE_FMRADIO_IN
1546 case AUDIO_SRC_FMRADIO:
1547#endif
1323 line[i] = 5; 1548 line[i] = 5;
1324 else if (global_settings.rec_source == SOURCE_MIC) 1549 break;
1550 case AUDIO_SRC_MIC:
1325 line[i] = 4; 1551 line[i] = 4;
1552 break;
1326#ifdef HAVE_SPDIF_IN 1553#ifdef HAVE_SPDIF_IN
1327 else if (global_settings.rec_source == SOURCE_SPDIF) 1554 case AUDIO_SRC_SPDIF:
1328 line[i] = 3; 1555 line[i] = 3;
1556 break;
1329#endif 1557#endif
1558 } /* end switch */
1330#ifdef HAVE_AGC 1559#ifdef HAVE_AGC
1331 if (screens[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i])) 1560 if (screens[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i]))
1332 { 1561 {
@@ -1358,7 +1587,7 @@ bool recording_screen(void)
1358 snprintf(buf, 32, "%s: %s", 1587 snprintf(buf, 32, "%s: %s",
1359 str(LANG_RECORDING_AGC_PRESET), 1588 str(LANG_RECORDING_AGC_PRESET),
1360 agc_preset_str[agc_preset]); 1589 agc_preset_str[agc_preset]);
1361 else if (global_settings.rec_source == SOURCE_MIC) 1590 else if (global_settings.rec_source == AUDIO_SRC_MIC)
1362 snprintf(buf, 32, "%s: %s%s", 1591 snprintf(buf, 32, "%s: %s%s",
1363 str(LANG_RECORDING_AGC_PRESET), 1592 str(LANG_RECORDING_AGC_PRESET),
1364 agc_preset_str[agc_preset], 1593 agc_preset_str[agc_preset],
@@ -1382,8 +1611,12 @@ bool recording_screen(void)
1382 screens[i].puts_style_offset(0, filename_offset[i] + 1611 screens[i].puts_style_offset(0, filename_offset[i] +
1383 PM_HEIGHT + line[i], buf, STYLE_INVERT,0); 1612 PM_HEIGHT + line[i], buf, STYLE_INVERT,0);
1384 } 1613 }
1385 else if ((global_settings.rec_source == SOURCE_MIC) 1614 else if (global_settings.rec_source == AUDIO_SRC_MIC
1386 || (global_settings.rec_source == SOURCE_LINE)) 1615 || global_settings.rec_source == AUDIO_SRC_LINEIN
1616#ifdef HAVE_FMRADIO_IN
1617 || global_settings.rec_source == AUDIO_SRC_FMRADIO
1618#endif
1619 )
1387 { 1620 {
1388 for(i = 0; i < screen_update; i++) { 1621 for(i = 0; i < screen_update; i++) {
1389 if (display_agc[i]) { 1622 if (display_agc[i]) {
@@ -1393,7 +1626,7 @@ bool recording_screen(void)
1393 } 1626 }
1394 } 1627 }
1395 1628
1396 if (global_settings.rec_source == SOURCE_MIC) 1629 if (global_settings.rec_source == AUDIO_SRC_MIC)
1397 { 1630 {
1398 if(agc_maxgain < (global_settings.rec_mic_gain)) 1631 if(agc_maxgain < (global_settings.rec_mic_gain))
1399 change_recording_gain(false, true, true); 1632 change_recording_gain(false, true, true);
@@ -1418,7 +1651,7 @@ bool recording_screen(void)
1418 filename_offset[i] + 1651 filename_offset[i] +
1419 PM_HEIGHT + 3, true); 1652 PM_HEIGHT + 3, true);
1420 1653
1421 if(global_settings.rec_source != SOURCE_MIC) 1654 if(global_settings.rec_source != AUDIO_SRC_MIC)
1422 { 1655 {
1423 for(i = 0; i < screen_update; i++) 1656 for(i = 0; i < screen_update; i++)
1424 screen_put_cursorxy(&screens[i], 0, 1657 screen_put_cursorxy(&screens[i], 0,
@@ -1456,14 +1689,14 @@ bool recording_screen(void)
1456 } 1689 }
1457/* Can't measure S/PDIF sample rate on Archos yet */ 1690/* Can't measure S/PDIF sample rate on Archos yet */
1458#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR) 1691#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
1459 if (global_settings.rec_source == SOURCE_SPDIF) 1692 if (global_settings.rec_source == AUDIO_SRC_SPDIF)
1460 snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate()); 1693 snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate());
1461#else 1694#else
1462 (void)spdif_sfreq; 1695 (void)spdif_sfreq;
1463#endif 1696#endif
1464 snprintf(buf, 32, "%s %s", 1697 snprintf(buf, 32, "%s %s",
1465#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR) 1698#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
1466 global_settings.rec_source == SOURCE_SPDIF ? 1699 global_settings.rec_source == AUDIO_SRC_SPDIF ?
1467 spdif_sfreq : 1700 spdif_sfreq :
1468#endif 1701#endif
1469 freq_str[global_settings.rec_frequency], 1702 freq_str[global_settings.rec_frequency],
@@ -1473,8 +1706,8 @@ bool recording_screen(void)
1473 1706
1474 for(i = 0; i < screen_update; i++) { 1707 for(i = 0; i < screen_update; i++) {
1475#ifdef HAVE_AGC 1708#ifdef HAVE_AGC
1476 if ((global_settings.rec_source == SOURCE_MIC) 1709 if ((global_settings.rec_source == AUDIO_SRC_MIC)
1477 || (global_settings.rec_source == SOURCE_LINE)) 1710 || (global_settings.rec_source == AUDIO_SRC_LINEIN))
1478 screens[i].puts(0, filename_offset[i] + PM_HEIGHT + line[i] + 1, buf); 1711 screens[i].puts(0, filename_offset[i] + PM_HEIGHT + line[i] + 1, buf);
1479 else 1712 else
1480#endif 1713#endif
@@ -1484,6 +1717,14 @@ bool recording_screen(void)
1484#ifdef HAVE_AGC 1717#ifdef HAVE_AGC
1485 hist_time++; 1718 hist_time++;
1486#endif 1719#endif
1720
1721#if CONFIG_CODEC == SWCODEC
1722 snprintf(buf, 32, "%s",
1723 REC_QUALITY_LABEL(global_settings.rec_quality));
1724 for(i = 0; i < screen_update; i++)
1725 screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 6, buf);
1726#endif
1727
1487 for(i = 0; i < screen_update; i++) 1728 for(i = 0; i < screen_update; i++)
1488 { 1729 {
1489 gui_statusbar_draw(&(statusbars.statusbars[i]), true); 1730 gui_statusbar_draw(&(statusbars.statusbars[i]), true);
@@ -1506,7 +1747,7 @@ bool recording_screen(void)
1506 { 1747 {
1507 done = true; 1748 done = true;
1508 } 1749 }
1509 } 1750 } /* end while(!done) */
1510 1751
1511 1752
1512#if CONFIG_CODEC == SWCODEC 1753#if CONFIG_CODEC == SWCODEC
@@ -1531,18 +1772,26 @@ bool recording_screen(void)
1531 } 1772 }
1532 } 1773 }
1533 1774
1534#if CONFIG_CODEC == SWCODEC 1775#if CONFIG_CODEC == SWCODEC
1535 audio_stop_recording(); 1776 audio_stop_recording();
1536 audio_close_recording(); 1777 audio_close_recording();
1537 1778
1538#if defined(HAVE_SPDIF_IN) && !defined(SIMULATOR) 1779#ifdef HAVE_FMRADIO_IN
1539 if (global_settings.rec_source == SOURCE_SPDIF) 1780 if (radio_status != FMRADIO_OFF)
1540 cpu_boost(false); 1781 /* Restore radio playback - radio_status should be unchanged if started
1782 through fm radio screen (barring usb connect) */
1783 rec_set_source(AUDIO_SRC_FMRADIO, (radio_status & FMRADIO_PAUSED) ?
1784 SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
1785 else
1541#endif 1786#endif
1787 /* Go back to playback mode */
1788 rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
1542 1789
1543#else 1790 /* restore talk_menu setting */
1791 global_settings.talk_menu = talk_menu;
1792#else /* !SWCODEC */
1544 audio_init_playback(); 1793 audio_init_playback();
1545#endif 1794#endif /* CONFIG_CODEC == SWCODEC */
1546 1795
1547 /* make sure the trigger is really turned off */ 1796 /* make sure the trigger is really turned off */
1548 peak_meter_trigger(false); 1797 peak_meter_trigger(false);
@@ -1560,7 +1809,7 @@ bool recording_screen(void)
1560 ata_set_led_enabled(true); 1809 ata_set_led_enabled(true);
1561#endif 1810#endif
1562 return been_in_usb_mode; 1811 return been_in_usb_mode;
1563} 1812} /* recording_screen */
1564 1813
1565#if CONFIG_KEYPAD == RECORDER_PAD 1814#if CONFIG_KEYPAD == RECORDER_PAD
1566bool f2_rec_screen(void) 1815bool f2_rec_screen(void)
@@ -1680,15 +1929,13 @@ bool f2_rec_screen(void)
1680 } 1929 }
1681 } 1930 }
1682 1931
1683 if (global_settings.rec_prerecord_time) 1932 rec_set_recording_options(global_settings.rec_frequency,
1684 talk_buffer_steal(); /* will use the mp3 buffer */ 1933 global_settings.rec_quality,
1685 1934 global_settings.rec_source,
1686 audio_set_recording_options(global_settings.rec_frequency, 1935 0,
1687 global_settings.rec_quality, 1936 global_settings.rec_channels,
1688 global_settings.rec_source, 1937 global_settings.rec_editable,
1689 global_settings.rec_channels, 1938 global_settings.rec_prerecord_time);
1690 global_settings.rec_editable,
1691 global_settings.rec_prerecord_time);
1692 1939
1693 set_gain(); 1940 set_gain();
1694 1941
@@ -1760,7 +2007,7 @@ bool f3_rec_screen(void)
1760 case BUTTON_LEFT: 2007 case BUTTON_LEFT:
1761 case BUTTON_F3 | BUTTON_LEFT: 2008 case BUTTON_F3 | BUTTON_LEFT:
1762 global_settings.rec_source++; 2009 global_settings.rec_source++;
1763 if(global_settings.rec_source > MAX_SOURCE) 2010 if(global_settings.rec_source > AUDIO_SRC_MAX)
1764 global_settings.rec_source = 0; 2011 global_settings.rec_source = 0;
1765 used = true; 2012 used = true;
1766 break; 2013 break;
@@ -1782,16 +2029,13 @@ bool f3_rec_screen(void)
1782 } 2029 }
1783 } 2030 }
1784 2031
1785 if (global_settings.rec_prerecord_time) 2032 rec_set_recording_options(global_settings.rec_frequency,
1786 talk_buffer_steal(); /* will use the mp3 buffer */ 2033 global_settings.rec_quality,
1787 2034 global_settings.rec_source,
1788 audio_set_recording_options(global_settings.rec_frequency, 2035 0,
1789 global_settings.rec_quality, 2036 global_settings.rec_channels,
1790 global_settings.rec_source, 2037 global_settings.rec_editable,
1791 global_settings.rec_channels, 2038 global_settings.rec_prerecord_time);
1792 global_settings.rec_editable,
1793 global_settings.rec_prerecord_time);
1794
1795 2039
1796 set_gain(); 2040 set_gain();
1797 2041
@@ -1801,7 +2045,7 @@ bool f3_rec_screen(void)
1801 2045
1802 return false; 2046 return false;
1803} 2047}
1804#endif /* #ifdef RECORDER_PAD */ 2048#endif /* CONFIG_KEYPAD == RECORDER_PAD */
1805 2049
1806#if CONFIG_CODEC == SWCODEC 2050#if CONFIG_CODEC == SWCODEC
1807void audio_beep(int duration) 2051void audio_beep(int duration)
@@ -1831,6 +2075,14 @@ unsigned long audio_num_recorded_bytes(void)
1831 return 5 * 1024 * 1024; 2075 return 5 * 1024 * 1024;
1832} 2076}
1833 2077
2078#if CONFIG_CODEC == SWCODEC
2079void rec_set_source(int source, int flags)
2080{
2081 source = source;
2082 flags = flags;
2083}
2084#endif
2085
1834void audio_set_recording_options(int frequency, int quality, 2086void audio_set_recording_options(int frequency, int quality,
1835 int source, int channel_mode, 2087 int source, int channel_mode,
1836 bool editable, int prerecord_time) 2088 bool editable, int prerecord_time)