diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/icons.c | 8 | ||||
-rw-r--r-- | apps/recorder/icons.h | 7 | ||||
-rw-r--r-- | apps/recorder/keyboard.c | 4 | ||||
-rw-r--r-- | apps/recorder/peakmeter.c | 75 | ||||
-rw-r--r-- | apps/recorder/recording.c | 78 | ||||
-rw-r--r-- | apps/recorder/recording.h | 3 |
6 files changed, 11 insertions, 164 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 03a88c9fdc..cc53716674 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -40,10 +40,6 @@ const unsigned char bitmap_icons_5x8[][5] = | |||
40 | {0x7f, 0x22, 0x1c, 0x22, 0x7f}, /* Stereo recording */ | 40 | {0x7f, 0x22, 0x1c, 0x22, 0x7f}, /* Stereo recording */ |
41 | [Icon_Mono] = | 41 | [Icon_Mono] = |
42 | {0x00, 0x1c, 0x22, 0x7f, 0x00}, /* Mono recording */ | 42 | {0x00, 0x1c, 0x22, 0x7f, 0x00}, /* Mono recording */ |
43 | #if CONFIG_CODEC != SWCODEC | ||
44 | [Icon_q] = | ||
45 | {0x1e, 0x21, 0x31, 0x21, 0x5e} /* Q icon */ | ||
46 | #endif | ||
47 | }; | 43 | }; |
48 | 44 | ||
49 | const unsigned char bitmap_icons_7x8[][7] = | 45 | const unsigned char bitmap_icons_7x8[][7] = |
@@ -68,7 +64,7 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
68 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ | 64 | {0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */ |
69 | }; | 65 | }; |
70 | 66 | ||
71 | #if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) | 67 | #if defined(HAVE_RECORDING) |
72 | const unsigned char bitmap_glyphs_4x8[][4] = | 68 | const unsigned char bitmap_glyphs_4x8[][4] = |
73 | { | 69 | { |
74 | /* Keep digits together and first! */ | 70 | /* Keep digits together and first! */ |
@@ -116,7 +112,7 @@ const unsigned char bitmap_formats_18x8[Format_18x8Last][18]= | |||
116 | {0x00, 0x1e, 0x20, 0x18, 0x20, 0x1e, 0x00, 0x3c, 0x0a, | 112 | {0x00, 0x1e, 0x20, 0x18, 0x20, 0x1e, 0x00, 0x3c, 0x0a, |
117 | 0x0a, 0x0a, 0x3c, 0x00, 0x0e, 0x10, 0x20, 0x10, 0x0e}, /* WAV */ | 113 | 0x0a, 0x0a, 0x3c, 0x00, 0x0e, 0x10, 0x20, 0x10, 0x0e}, /* WAV */ |
118 | }; | 114 | }; |
119 | #endif /* CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) */ | 115 | #endif /* defined(HAVE_RECORDING) */ |
120 | 116 | ||
121 | /* Disk/MMC activity */ | 117 | /* Disk/MMC activity */ |
122 | const unsigned char bitmap_icon_disk[12] = | 118 | const unsigned char bitmap_icon_disk[12] = |
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 3c955ffe5b..4faa757184 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -42,9 +42,6 @@ enum icons_5x8 { | |||
42 | Icon_Lock_Remote, | 42 | Icon_Lock_Remote, |
43 | Icon_Stereo, | 43 | Icon_Stereo, |
44 | Icon_Mono, | 44 | Icon_Mono, |
45 | #if CONFIG_CODEC != SWCODEC | ||
46 | Icon_q, | ||
47 | #endif | ||
48 | Icon5x8Last | 45 | Icon5x8Last |
49 | }; | 46 | }; |
50 | 47 | ||
@@ -70,7 +67,7 @@ enum icons_7x8 { | |||
70 | Icon7x8Last | 67 | Icon7x8Last |
71 | }; | 68 | }; |
72 | 69 | ||
73 | #if CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) | 70 | #if defined (HAVE_RECORDING) |
74 | #define BM_GLYPH_WIDTH 4 | 71 | #define BM_GLYPH_WIDTH 4 |
75 | enum Glyphs_4x8 { | 72 | enum Glyphs_4x8 { |
76 | Glyph_4x8_0 = 0, | 73 | Glyph_4x8_0 = 0, |
@@ -100,7 +97,7 @@ enum rec_format_18x8 { | |||
100 | }; | 97 | }; |
101 | extern const unsigned char bitmap_formats_18x8[Format_18x8Last][18]; | 98 | extern const unsigned char bitmap_formats_18x8[Format_18x8Last][18]; |
102 | 99 | ||
103 | #endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */ | 100 | #endif /* defined (HAVE_RECORDING) */ |
104 | 101 | ||
105 | extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5]; | 102 | extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5]; |
106 | extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7]; | 103 | extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7]; |
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c index 4b19287b7f..f735afe84d 100644 --- a/apps/recorder/keyboard.c +++ b/apps/recorder/keyboard.c | |||
@@ -1218,16 +1218,12 @@ static void kbd_move_cursor(struct edit_state *state, int dir) | |||
1218 | else if (state->editpos > state->len_utf8) | 1218 | else if (state->editpos > state->len_utf8) |
1219 | { | 1219 | { |
1220 | state->editpos = 0; | 1220 | state->editpos = 0; |
1221 | #if CONFIG_CODEC == SWCODEC | ||
1222 | if (global_settings.talk_menu) beep_play(1000, 150, 1500); | 1221 | if (global_settings.talk_menu) beep_play(1000, 150, 1500); |
1223 | #endif | ||
1224 | } | 1222 | } |
1225 | else if (state->editpos < 0) | 1223 | else if (state->editpos < 0) |
1226 | { | 1224 | { |
1227 | state->editpos = state->len_utf8; | 1225 | state->editpos = state->len_utf8; |
1228 | #if CONFIG_CODEC == SWCODEC | ||
1229 | if (global_settings.talk_menu) beep_play(1000, 150, 1500); | 1226 | if (global_settings.talk_menu) beep_play(1000, 150, 1500); |
1230 | #endif | ||
1231 | } | 1227 | } |
1232 | } | 1228 | } |
1233 | 1229 | ||
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 5ff2f21215..5a03534040 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c | |||
@@ -19,9 +19,6 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "config.h" | 21 | #include "config.h" |
22 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
23 | #include <stdlib.h> /* sim uses rand for peakmeter simulation */ | ||
24 | #endif | ||
25 | #include "thread.h" | 22 | #include "thread.h" |
26 | #include "kernel.h" | 23 | #include "kernel.h" |
27 | #include "settings.h" | 24 | #include "settings.h" |
@@ -42,7 +39,6 @@ | |||
42 | #endif | 39 | #endif |
43 | #include "action.h" | 40 | #include "action.h" |
44 | 41 | ||
45 | #if CONFIG_CODEC == SWCODEC | ||
46 | #include "pcm.h" | 42 | #include "pcm.h" |
47 | #include "pcm_mixer.h" | 43 | #include "pcm_mixer.h" |
48 | 44 | ||
@@ -50,17 +46,12 @@ | |||
50 | #include "pcm_record.h" | 46 | #include "pcm_record.h" |
51 | #endif | 47 | #endif |
52 | 48 | ||
49 | #if !(CONFIG_PLATFORM & PLATFORM_HOSTED) | ||
53 | static bool pm_playback = true; /* selects between playback and recording peaks */ | 50 | static bool pm_playback = true; /* selects between playback and recording peaks */ |
54 | #endif | 51 | #endif |
55 | 52 | ||
56 | static struct meter_scales scales[NB_SCREENS]; | 53 | static struct meter_scales scales[NB_SCREENS]; |
57 | 54 | ||
58 | #if !defined(SIMULATOR) && CONFIG_CODEC != SWCODEC | ||
59 | /* Data source */ | ||
60 | static int pm_src_left = MAS_REG_DQPEAK_L; | ||
61 | static int pm_src_right = MAS_REG_DQPEAK_R; | ||
62 | #endif | ||
63 | |||
64 | /* Current values and cumulation */ | 55 | /* Current values and cumulation */ |
65 | static int pm_cur_left; /* current values (last peak_meter_peek) */ | 56 | static int pm_cur_left; /* current values (last peak_meter_peek) */ |
66 | static int pm_cur_right; | 57 | static int pm_cur_right; |
@@ -554,16 +545,8 @@ void peak_meter_playback(bool playback) | |||
554 | { | 545 | { |
555 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) | 546 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
556 | (void)playback; | 547 | (void)playback; |
557 | #elif CONFIG_CODEC == SWCODEC | ||
558 | pm_playback = playback; | ||
559 | #else | 548 | #else |
560 | if (playback) { | 549 | pm_playback = playback; |
561 | pm_src_left = MAS_REG_DQPEAK_L; | ||
562 | pm_src_right = MAS_REG_DQPEAK_R; | ||
563 | } else { | ||
564 | pm_src_left = MAS_REG_QPEAK_L; | ||
565 | pm_src_right = MAS_REG_QPEAK_R; | ||
566 | } | ||
567 | #endif | 550 | #endif |
568 | /* reset the scales just in case recording and playback | 551 | /* reset the scales just in case recording and playback |
569 | use different viewport sizes. Normally we should be checking viewport | 552 | use different viewport sizes. Normally we should be checking viewport |
@@ -599,7 +582,10 @@ void peak_meter_peek(void) | |||
599 | bool was_clipping = pm_clip_left || pm_clip_right; | 582 | bool was_clipping = pm_clip_left || pm_clip_right; |
600 | #endif | 583 | #endif |
601 | /* read current values */ | 584 | /* read current values */ |
602 | #if CONFIG_CODEC == SWCODEC | 585 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
586 | pm_cur_left = left = 8000; | ||
587 | pm_cur_right = right = 9000; | ||
588 | #else | ||
603 | if (pm_playback) | 589 | if (pm_playback) |
604 | { | 590 | { |
605 | static struct pcm_peaks chan_peaks; /* *MUST* be static */ | 591 | static struct pcm_peaks chan_peaks; /* *MUST* be static */ |
@@ -614,14 +600,6 @@ void peak_meter_peek(void) | |||
614 | #endif | 600 | #endif |
615 | left = pm_cur_left; | 601 | left = pm_cur_left; |
616 | right = pm_cur_right; | 602 | right = pm_cur_right; |
617 | #else | ||
618 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | ||
619 | pm_cur_left = left = mas_codec_readreg(pm_src_left); | ||
620 | pm_cur_right = right = mas_codec_readreg(pm_src_right); | ||
621 | #else | ||
622 | pm_cur_left = left = 8000; | ||
623 | pm_cur_right = right = 9000; | ||
624 | #endif | ||
625 | #endif | 603 | #endif |
626 | 604 | ||
627 | /* check for clips | 605 | /* check for clips |
@@ -632,22 +610,12 @@ void peak_meter_peek(void) | |||
632 | a real clip. For software codecs, the peak is already | 610 | a real clip. For software codecs, the peak is already |
633 | the max of a bunch of samples, so use one max value | 611 | the max of a bunch of samples, so use one max value |
634 | or you fail to detect clipping! */ | 612 | or you fail to detect clipping! */ |
635 | #if CONFIG_CODEC == SWCODEC | ||
636 | if (left == MAX_PEAK - 1) { | 613 | if (left == MAX_PEAK - 1) { |
637 | #else | ||
638 | if ((left == pm_max_left) && | ||
639 | (left == MAX_PEAK - 1)) { | ||
640 | #endif | ||
641 | pm_clip_left = true; | 614 | pm_clip_left = true; |
642 | pm_clip_timeout_l = current_tick + pm_clip_hold; | 615 | pm_clip_timeout_l = current_tick + pm_clip_hold; |
643 | } | 616 | } |
644 | 617 | ||
645 | #if CONFIG_CODEC == SWCODEC | ||
646 | if (right == MAX_PEAK - 1) { | 618 | if (right == MAX_PEAK - 1) { |
647 | #else | ||
648 | if ((right == pm_max_right) && | ||
649 | (right == MAX_PEAK - 1)) { | ||
650 | #endif | ||
651 | pm_clip_right = true; | 619 | pm_clip_right = true; |
652 | pm_clip_timeout_r = current_tick + pm_clip_hold; | 620 | pm_clip_timeout_r = current_tick + pm_clip_hold; |
653 | } | 621 | } |
@@ -668,14 +636,12 @@ void peak_meter_peek(void) | |||
668 | pm_max_right = MAX(pm_max_right, right); | 636 | pm_max_right = MAX(pm_max_right, right); |
669 | 637 | ||
670 | #ifdef HAVE_RECORDING | 638 | #ifdef HAVE_RECORDING |
671 | #if CONFIG_CODEC == SWCODEC | ||
672 | /* Ignore any unread peakmeter data */ | 639 | /* Ignore any unread peakmeter data */ |
673 | #define MAX_DROP_TIME HZ/7 /* this value may need tweaking. Increase if you are | 640 | #define MAX_DROP_TIME HZ/7 /* this value may need tweaking. Increase if you are |
674 | getting trig events when you shouldn't with | 641 | getting trig events when you shouldn't with |
675 | trig_stp_hold = 0 */ | 642 | trig_stp_hold = 0 */ |
676 | if (!trig_stp_hold) | 643 | if (!trig_stp_hold) |
677 | trig_stp_hold = MAX_DROP_TIME; | 644 | trig_stp_hold = MAX_DROP_TIME; |
678 | #endif | ||
679 | 645 | ||
680 | switch (trig_status) { | 646 | switch (trig_status) { |
681 | case TRIG_READY: | 647 | case TRIG_READY: |
@@ -735,11 +701,7 @@ void peak_meter_peek(void) | |||
735 | || (right > trig_stp_threshold)) { | 701 | || (right > trig_stp_threshold)) { |
736 | /* restart hold time countdown */ | 702 | /* restart hold time countdown */ |
737 | trig_lowtime = current_tick; | 703 | trig_lowtime = current_tick; |
738 | #if CONFIG_CODEC == SWCODEC | ||
739 | } else if (current_tick - trig_lowtime > MAX_DROP_TIME){ | 704 | } else if (current_tick - trig_lowtime > MAX_DROP_TIME){ |
740 | #else | ||
741 | } else { | ||
742 | #endif | ||
743 | set_trig_status(TRIG_POSTREC); | 705 | set_trig_status(TRIG_POSTREC); |
744 | trig_hightime = current_tick; | 706 | trig_hightime = current_tick; |
745 | } | 707 | } |
@@ -797,12 +759,10 @@ void peak_meter_peek(void) | |||
797 | } | 759 | } |
798 | break; | 760 | break; |
799 | } | 761 | } |
800 | #if CONFIG_CODEC == SWCODEC | ||
801 | /* restore stop hold value */ | 762 | /* restore stop hold value */ |
802 | if (trig_stp_hold == MAX_DROP_TIME) | 763 | if (trig_stp_hold == MAX_DROP_TIME) |
803 | trig_stp_hold = 0; | 764 | trig_stp_hold = 0; |
804 | #endif | 765 | #endif |
805 | #endif | ||
806 | /* check levels next time peakmeter drawn */ | 766 | /* check levels next time peakmeter drawn */ |
807 | level_check = true; | 767 | level_check = true; |
808 | #ifdef PM_DEBUG | 768 | #ifdef PM_DEBUG |
@@ -822,11 +782,6 @@ static int peak_meter_read_l(void) | |||
822 | by peak_meter_peek since the last call of peak_meter_read_l */ | 782 | by peak_meter_peek since the last call of peak_meter_read_l */ |
823 | int retval; | 783 | int retval; |
824 | 784 | ||
825 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
826 | srand(current_tick); | ||
827 | pm_max_left = rand()%MAX_PEAK; | ||
828 | #endif | ||
829 | |||
830 | retval = pm_max_left; | 785 | retval = pm_max_left; |
831 | 786 | ||
832 | #if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC) | 787 | #if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC) |
@@ -855,11 +810,6 @@ static int peak_meter_read_r(void) | |||
855 | by peak_meter_peek since the last call of peak_meter_read_r */ | 810 | by peak_meter_peek since the last call of peak_meter_read_r */ |
856 | int retval; | 811 | int retval; |
857 | 812 | ||
858 | #if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | ||
859 | srand(current_tick); | ||
860 | pm_max_right = rand()%MAX_PEAK; | ||
861 | #endif | ||
862 | |||
863 | retval = pm_max_right; | 813 | retval = pm_max_right; |
864 | 814 | ||
865 | #if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC) | 815 | #if defined(HAVE_HISTOGRAM) || defined(HAVE_AGC) |
@@ -1128,11 +1078,7 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
1128 | /* cliplight */ | 1078 | /* cliplight */ |
1129 | if ((pm_clip_left || pm_clip_right) && | 1079 | if ((pm_clip_left || pm_clip_right) && |
1130 | global_settings.cliplight && | 1080 | global_settings.cliplight && |
1131 | #if CONFIG_CODEC == SWCODEC | ||
1132 | !pm_playback) | 1081 | !pm_playback) |
1133 | #else | ||
1134 | !(audio_status() & (AUDIO_STATUS_PLAY | AUDIO_STATUS_ERROR))) | ||
1135 | #endif | ||
1136 | { | 1082 | { |
1137 | /* if clipping, cliplight setting on and in recording screen */ | 1083 | /* if clipping, cliplight setting on and in recording screen */ |
1138 | if (global_settings.cliplight <= 2) | 1084 | if (global_settings.cliplight <= 2) |
@@ -1375,16 +1321,7 @@ int peak_meter_draw_get_btn(int action_context, int x[], int y[], | |||
1375 | long next_refresh = current_tick; | 1321 | long next_refresh = current_tick; |
1376 | long next_big_refresh = current_tick + HZ / 10; | 1322 | long next_big_refresh = current_tick + HZ / 10; |
1377 | int i; | 1323 | int i; |
1378 | #if (CONFIG_CODEC == SWCODEC) | ||
1379 | bool highperf = false; | 1324 | bool highperf = false; |
1380 | #else | ||
1381 | /* On MAS targets, we need to poll as often as possible in order to not | ||
1382 | * miss a peak, as the MAS does only provide a quasi-peak. When the disk | ||
1383 | * is active, it must not draw too much CPU power or a buffer overrun can | ||
1384 | * happen when saving a recording. As a compromise, poll only once per tick | ||
1385 | * when the disk is active, otherwise spin around as fast as possible. */ | ||
1386 | bool highperf = !storage_disk_is_active(); | ||
1387 | #endif | ||
1388 | bool dopeek = true; | 1325 | bool dopeek = true; |
1389 | 1326 | ||
1390 | while (TIME_BEFORE(current_tick, next_big_refresh)) { | 1327 | while (TIME_BEFORE(current_tick, next_big_refresh)) { |
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 553f815e52..36331a72f3 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -31,17 +31,14 @@ | |||
31 | #include "lcd.h" | 31 | #include "lcd.h" |
32 | #include "led.h" | 32 | #include "led.h" |
33 | #include "audio.h" | 33 | #include "audio.h" |
34 | #if CONFIG_CODEC == SWCODEC | ||
35 | #include "thread.h" | 34 | #include "thread.h" |
36 | #include "enc_config.h" | 35 | #include "enc_config.h" |
37 | #include "playback.h" | 36 | #include "playback.h" |
38 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) | 37 | #if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) |
39 | #include "spdif.h" | 38 | #include "spdif.h" |
40 | #endif | 39 | #endif |
41 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
42 | #include "pcm_record.h" | 40 | #include "pcm_record.h" |
43 | #include "recording.h" | 41 | #include "recording.h" |
44 | #include "mp3_playback.h" | ||
45 | #include "button.h" | 42 | #include "button.h" |
46 | #include "kernel.h" | 43 | #include "kernel.h" |
47 | #include "settings.h" | 44 | #include "settings.h" |
@@ -166,19 +163,9 @@ static bool update_list = false; /* (GIU) list needs updating */ | |||
166 | static int file_number = -1; | 163 | static int file_number = -1; |
167 | #endif /* CONFIG_RTC */ | 164 | #endif /* CONFIG_RTC */ |
168 | 165 | ||
169 | #if CONFIG_CODEC == SWCODEC | ||
170 | |||
171 | #define REC_FILE_ENDING(rec_format) \ | 166 | #define REC_FILE_ENDING(rec_format) \ |
172 | (audio_formats[rec_format_afmt[rec_format]].ext_list) | 167 | (audio_formats[rec_format_afmt[rec_format]].ext_list) |
173 | 168 | ||
174 | #else /* CONFIG_CODEC != SWCODEC */ | ||
175 | |||
176 | /* default record file extension for HWCODEC */ | ||
177 | #define REC_FILE_ENDING(rec_format) \ | ||
178 | (audio_formats[AFMT_MPA_L3].ext_list) | ||
179 | |||
180 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
181 | |||
182 | /* path for current file */ | 169 | /* path for current file */ |
183 | static char path_buffer[MAX_PATH]; | 170 | static char path_buffer[MAX_PATH]; |
184 | 171 | ||
@@ -607,18 +594,12 @@ void rec_init_recording_options(struct audio_recording_options *options) | |||
607 | options->rec_frequency = global_settings.rec_frequency; | 594 | options->rec_frequency = global_settings.rec_frequency; |
608 | options->rec_channels = global_settings.rec_channels; | 595 | options->rec_channels = global_settings.rec_channels; |
609 | options->rec_prerecord_time = global_settings.rec_prerecord_time; | 596 | options->rec_prerecord_time = global_settings.rec_prerecord_time; |
610 | #if CONFIG_CODEC == SWCODEC | ||
611 | options->rec_mono_mode = global_settings.rec_mono_mode; | 597 | options->rec_mono_mode = global_settings.rec_mono_mode; |
612 | options->rec_source_flags = 0; | 598 | options->rec_source_flags = 0; |
613 | options->enc_config.rec_format = global_settings.rec_format; | 599 | options->enc_config.rec_format = global_settings.rec_format; |
614 | global_to_encoder_config(&options->enc_config); | 600 | global_to_encoder_config(&options->enc_config); |
615 | #else | ||
616 | options->rec_quality = global_settings.rec_quality; | ||
617 | options->rec_editable = global_settings.rec_editable; | ||
618 | #endif | ||
619 | } | 601 | } |
620 | 602 | ||
621 | #if CONFIG_CODEC == SWCODEC | ||
622 | void rec_set_source(int source, unsigned flags) | 603 | void rec_set_source(int source, unsigned flags) |
623 | { | 604 | { |
624 | /* Set audio input source, power up/down devices */ | 605 | /* Set audio input source, power up/down devices */ |
@@ -628,14 +609,11 @@ void rec_set_source(int source, unsigned flags) | |||
628 | peak_meter_playback((flags & SRCF_RECORDING) == 0); | 609 | peak_meter_playback((flags & SRCF_RECORDING) == 0); |
629 | peak_meter_enable(true); | 610 | peak_meter_enable(true); |
630 | } | 611 | } |
631 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
632 | 612 | ||
633 | void rec_set_recording_options(struct audio_recording_options *options) | 613 | void rec_set_recording_options(struct audio_recording_options *options) |
634 | { | 614 | { |
635 | #if CONFIG_CODEC == SWCODEC | ||
636 | rec_set_source(options->rec_source, | 615 | rec_set_source(options->rec_source, |
637 | options->rec_source_flags | SRCF_RECORDING); | 616 | options->rec_source_flags | SRCF_RECORDING); |
638 | #endif | ||
639 | audio_set_recording_options(options); | 617 | audio_set_recording_options(options); |
640 | } | 618 | } |
641 | 619 | ||
@@ -646,9 +624,7 @@ void rec_command(enum recording_command cmd) | |||
646 | case RECORDING_CMD_STOP_SHUTDOWN: | 624 | case RECORDING_CMD_STOP_SHUTDOWN: |
647 | pm_activate_clipcount(false); | 625 | pm_activate_clipcount(false); |
648 | audio_stop_recording(); | 626 | audio_stop_recording(); |
649 | #if CONFIG_CODEC == SWCODEC | ||
650 | audio_close_recording(); | 627 | audio_close_recording(); |
651 | #endif | ||
652 | sys_poweroff(); | 628 | sys_poweroff(); |
653 | break; | 629 | break; |
654 | case RECORDING_CMD_STOP: | 630 | case RECORDING_CMD_STOP: |
@@ -695,12 +671,6 @@ static void trigger_listener(int trigger_status) | |||
695 | if(!(audio_status() & AUDIO_STATUS_RECORD)) | 671 | if(!(audio_status() & AUDIO_STATUS_RECORD)) |
696 | { | 672 | { |
697 | rec_status |= RCSTAT_HAVE_RECORDED; | 673 | rec_status |= RCSTAT_HAVE_RECORDED; |
698 | rec_command(RECORDING_CMD_START); | ||
699 | #if CONFIG_CODEC != SWCODEC | ||
700 | /* give control to mpeg thread so that it can start | ||
701 | recording */ | ||
702 | yield(); yield(); yield(); | ||
703 | #endif | ||
704 | } | 674 | } |
705 | 675 | ||
706 | /* if we're already recording this is a retrigger */ | 676 | /* if we're already recording this is a retrigger */ |
@@ -791,14 +761,9 @@ enum rec_list_items_mono { | |||
791 | #ifdef HAVE_SPDIF_REC | 761 | #ifdef HAVE_SPDIF_REC |
792 | enum rec_list_items_spdif { | 762 | enum rec_list_items_spdif { |
793 | ITEM_VOLUME_D = 0, | 763 | ITEM_VOLUME_D = 0, |
794 | #if CONFIG_CODEC == SWCODEC | ||
795 | ITEM_SAMPLERATE_D = 6, | 764 | ITEM_SAMPLERATE_D = 6, |
796 | ITEM_FILENAME_D = 7, | 765 | ITEM_FILENAME_D = 7, |
797 | ITEM_COUNT_D = 3, | 766 | ITEM_COUNT_D = 3, |
798 | #else | ||
799 | ITEM_FILENAME_D = 7, | ||
800 | ITEM_COUNT_D = 2, | ||
801 | #endif | ||
802 | }; | 767 | }; |
803 | #endif | 768 | #endif |
804 | 769 | ||
@@ -892,14 +857,12 @@ static const char* reclist_get_name(int selected_item, void * data, | |||
892 | buf3, sizeof(buf3))); | 857 | buf3, sizeof(buf3))); |
893 | break; | 858 | break; |
894 | #endif | 859 | #endif |
895 | #if CONFIG_CODEC == SWCODEC | ||
896 | #ifdef HAVE_SPDIF_REC | 860 | #ifdef HAVE_SPDIF_REC |
897 | case ITEM_SAMPLERATE_D: | 861 | case ITEM_SAMPLERATE_D: |
898 | snprintf(buffer, buffer_len, "%s: %lu", | 862 | snprintf(buffer, buffer_len, "%s: %lu", |
899 | str(LANG_FREQUENCY), pcm_rec_sample_rate()); | 863 | str(LANG_FREQUENCY), pcm_rec_sample_rate()); |
900 | break; | 864 | break; |
901 | #endif | 865 | #endif |
902 | #endif | ||
903 | case ITEM_FILENAME: | 866 | case ITEM_FILENAME: |
904 | { | 867 | { |
905 | if(audio_status() & AUDIO_STATUS_RECORD) | 868 | if(audio_status() & AUDIO_STATUS_RECORD) |
@@ -973,16 +936,12 @@ bool recording_screen(bool no_source) | |||
973 | const unsigned long split_seconds = (unsigned) global_settings.rec_timesplit * 60; | 936 | const unsigned long split_seconds = (unsigned) global_settings.rec_timesplit * 60; |
974 | const unsigned long split_bytes = rec_sizesplit_bytes(); | 937 | const unsigned long split_bytes = rec_sizesplit_bytes(); |
975 | 938 | ||
976 | #if CONFIG_CODEC == SWCODEC | ||
977 | int warning_counter = 0; | 939 | int warning_counter = 0; |
978 | #define WARNING_PERIOD 7 | 940 | #define WARNING_PERIOD 7 |
979 | #endif | ||
980 | 941 | ||
981 | #if CONFIG_CODEC == SWCODEC | ||
982 | #ifdef HAVE_SPDIF_REC | 942 | #ifdef HAVE_SPDIF_REC |
983 | unsigned long prev_sample_rate = 0; | 943 | unsigned long prev_sample_rate = 0; |
984 | #endif | 944 | #endif |
985 | #endif | ||
986 | 945 | ||
987 | #ifdef HAVE_FMRADIO_REC | 946 | #ifdef HAVE_FMRADIO_REC |
988 | /* Radio is left on if: | 947 | /* Radio is left on if: |
@@ -1030,7 +989,6 @@ bool recording_screen(bool no_source) | |||
1030 | ata_set_led_enabled(false); | 989 | ata_set_led_enabled(false); |
1031 | #endif | 990 | #endif |
1032 | 991 | ||
1033 | #if CONFIG_CODEC == SWCODEC | ||
1034 | /* hardware samplerate gets messed up so prevent mixer playing */ | 992 | /* hardware samplerate gets messed up so prevent mixer playing */ |
1035 | int keyclick = global_settings.keyclick; | 993 | int keyclick = global_settings.keyclick; |
1036 | global_settings.keyclick = 0; | 994 | global_settings.keyclick = 0; |
@@ -1039,11 +997,6 @@ bool recording_screen(bool no_source) | |||
1039 | talk_disable(true); | 997 | talk_disable(true); |
1040 | /* audio_init_recording stops anything playing when it takes the audio | 998 | /* audio_init_recording stops anything playing when it takes the audio |
1041 | buffer */ | 999 | buffer */ |
1042 | #else | ||
1043 | /* Yes, we use the D/A for monitoring */ | ||
1044 | peak_meter_enable(true); | ||
1045 | peak_meter_playback(true); | ||
1046 | #endif | ||
1047 | 1000 | ||
1048 | #ifdef HAVE_AGC | 1001 | #ifdef HAVE_AGC |
1049 | peak_meter_get_peakhold(&peak_l, &peak_r); | 1002 | peak_meter_get_peakhold(&peak_l, &peak_r); |
@@ -1175,7 +1128,7 @@ bool recording_screen(bool no_source) | |||
1175 | goto rec_abort; | 1128 | goto rec_abort; |
1176 | } | 1129 | } |
1177 | 1130 | ||
1178 | #if CONFIG_CODEC == SWCODEC && CONFIG_RTC == 0 | 1131 | #if CONFIG_RTC == 0 |
1179 | /* If format changed, a new number is required */ | 1132 | /* If format changed, a new number is required */ |
1180 | rec_init_filename(); | 1133 | rec_init_filename(); |
1181 | #endif | 1134 | #endif |
@@ -1202,12 +1155,8 @@ bool recording_screen(bool no_source) | |||
1202 | if(global_settings.rec_source == AUDIO_SRC_SPDIF) | 1155 | if(global_settings.rec_source == AUDIO_SRC_SPDIF) |
1203 | { | 1156 | { |
1204 | listid_to_enum[0] = ITEM_VOLUME_D; | 1157 | listid_to_enum[0] = ITEM_VOLUME_D; |
1205 | #if CONFIG_CODEC == SWCODEC | ||
1206 | listid_to_enum[1] = ITEM_SAMPLERATE_D; | 1158 | listid_to_enum[1] = ITEM_SAMPLERATE_D; |
1207 | listid_to_enum[2] = ITEM_FILENAME_D; | 1159 | listid_to_enum[2] = ITEM_FILENAME_D; |
1208 | #else | ||
1209 | listid_to_enum[1] = ITEM_FILENAME_D; | ||
1210 | #endif | ||
1211 | 1160 | ||
1212 | gui_synclist_set_nb_items(&lists, ITEM_COUNT_D); /* spdif */ | 1161 | gui_synclist_set_nb_items(&lists, ITEM_COUNT_D); /* spdif */ |
1213 | } | 1162 | } |
@@ -1452,10 +1401,6 @@ bool recording_screen(bool no_source) | |||
1452 | } | 1401 | } |
1453 | else | 1402 | else |
1454 | { | 1403 | { |
1455 | #if CONFIG_CODEC != SWCODEC | ||
1456 | peak_meter_playback(true); | ||
1457 | peak_meter_enable(false); | ||
1458 | #endif | ||
1459 | done = 1; | 1404 | done = 1; |
1460 | } | 1405 | } |
1461 | update_countdown = 0; /* Update immediately */ | 1406 | update_countdown = 0; /* Update immediately */ |
@@ -1543,11 +1488,7 @@ bool recording_screen(bool no_source) | |||
1543 | update_countdown = 0; /* Update immediately */ | 1488 | update_countdown = 0; /* Update immediately */ |
1544 | break; | 1489 | break; |
1545 | case ACTION_STD_MENU: | 1490 | case ACTION_STD_MENU: |
1546 | #if CONFIG_CODEC == SWCODEC | ||
1547 | if(!(audio_stat & AUDIO_STATUS_RECORD)) | 1491 | if(!(audio_stat & AUDIO_STATUS_RECORD)) |
1548 | #else | ||
1549 | if(audio_stat != AUDIO_STATUS_RECORD) | ||
1550 | #endif | ||
1551 | { | 1492 | { |
1552 | #if (CONFIG_LED == LED_REAL) | 1493 | #if (CONFIG_LED == LED_REAL) |
1553 | /* led is restored at begin of loop / end of function */ | 1494 | /* led is restored at begin of loop / end of function */ |
@@ -1622,7 +1563,6 @@ bool recording_screen(bool no_source) | |||
1622 | dsize = split_bytes; | 1563 | dsize = split_bytes; |
1623 | num_recorded_bytes = audio_num_recorded_bytes(); | 1564 | num_recorded_bytes = audio_num_recorded_bytes(); |
1624 | 1565 | ||
1625 | #if CONFIG_CODEC == SWCODEC | ||
1626 | if ((audio_stat & AUDIO_STATUS_WARNING) | 1566 | if ((audio_stat & AUDIO_STATUS_WARNING) |
1627 | && (warning_counter++ % WARNING_PERIOD) < WARNING_PERIOD/2) | 1567 | && (warning_counter++ % WARNING_PERIOD) < WARNING_PERIOD/2) |
1628 | { | 1568 | { |
@@ -1635,7 +1575,6 @@ bool recording_screen(bool no_source) | |||
1635 | (unsigned long)pcm_rec_get_warnings()); | 1575 | (unsigned long)pcm_rec_get_warnings()); |
1636 | } | 1576 | } |
1637 | else | 1577 | else |
1638 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
1639 | if ((global_settings.rec_sizesplit) && | 1578 | if ((global_settings.rec_sizesplit) && |
1640 | (global_settings.rec_split_method)) | 1579 | (global_settings.rec_split_method)) |
1641 | { | 1580 | { |
@@ -1657,16 +1596,11 @@ bool recording_screen(bool no_source) | |||
1657 | 1596 | ||
1658 | if(audio_stat & AUDIO_STATUS_PRERECORD) | 1597 | if(audio_stat & AUDIO_STATUS_PRERECORD) |
1659 | { | 1598 | { |
1660 | #if CONFIG_CODEC == SWCODEC | ||
1661 | /* Tracks amount of prerecorded data in buffer */ | 1599 | /* Tracks amount of prerecorded data in buffer */ |
1662 | snprintf(buf, sizeof(buf), "%s (%lu/%ds)...", | 1600 | snprintf(buf, sizeof(buf), "%s (%lu/%ds)...", |
1663 | str(LANG_RECORD_PRERECORD), | 1601 | str(LANG_RECORD_PRERECORD), |
1664 | audio_prerecorded_time() / HZ, | 1602 | audio_prerecorded_time() / HZ, |
1665 | global_settings.rec_prerecord_time); | 1603 | global_settings.rec_prerecord_time); |
1666 | #else /* !SWCODEC */ | ||
1667 | snprintf(buf, sizeof(buf), "%s...", | ||
1668 | str(LANG_RECORD_PRERECORD)); | ||
1669 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
1670 | } | 1604 | } |
1671 | else | 1605 | else |
1672 | { | 1606 | { |
@@ -1782,7 +1716,6 @@ bool recording_screen(bool no_source) | |||
1782 | } | 1716 | } |
1783 | #endif /* HAVE_AGC */ | 1717 | #endif /* HAVE_AGC */ |
1784 | 1718 | ||
1785 | #if CONFIG_CODEC == SWCODEC | ||
1786 | #ifdef HAVE_SPDIF_REC | 1719 | #ifdef HAVE_SPDIF_REC |
1787 | if((global_settings.rec_source == AUDIO_SRC_SPDIF) && | 1720 | if((global_settings.rec_source == AUDIO_SRC_SPDIF) && |
1788 | (prev_sample_rate != pcm_rec_sample_rate())) | 1721 | (prev_sample_rate != pcm_rec_sample_rate())) |
@@ -1792,7 +1725,6 @@ bool recording_screen(bool no_source) | |||
1792 | update_list = true; | 1725 | update_list = true; |
1793 | } | 1726 | } |
1794 | #endif | 1727 | #endif |
1795 | #endif | ||
1796 | 1728 | ||
1797 | if(update_list) | 1729 | if(update_list) |
1798 | { | 1730 | { |
@@ -1824,11 +1756,9 @@ bool recording_screen(bool no_source) | |||
1824 | FOR_NB_SCREENS(i) | 1756 | FOR_NB_SCREENS(i) |
1825 | screens[i].update(); | 1757 | screens[i].update(); |
1826 | 1758 | ||
1827 | #if CONFIG_CODEC == SWCODEC | ||
1828 | /* stop recording first and try to finish saving whatever it can */ | 1759 | /* stop recording first and try to finish saving whatever it can */ |
1829 | rec_command(RECORDING_CMD_STOP); | 1760 | rec_command(RECORDING_CMD_STOP); |
1830 | audio_close_recording(); | 1761 | audio_close_recording(); |
1831 | #endif | ||
1832 | 1762 | ||
1833 | audio_error_clear(); | 1763 | audio_error_clear(); |
1834 | 1764 | ||
@@ -1841,7 +1771,6 @@ bool recording_screen(bool no_source) | |||
1841 | 1771 | ||
1842 | rec_abort: | 1772 | rec_abort: |
1843 | 1773 | ||
1844 | #if CONFIG_CODEC == SWCODEC | ||
1845 | rec_command(RECORDING_CMD_STOP); | 1774 | rec_command(RECORDING_CMD_STOP); |
1846 | audio_close_recording(); | 1775 | audio_close_recording(); |
1847 | 1776 | ||
@@ -1861,9 +1790,6 @@ rec_abort: | |||
1861 | 1790 | ||
1862 | /* restore keyclick */ | 1791 | /* restore keyclick */ |
1863 | global_settings.keyclick = keyclick; | 1792 | global_settings.keyclick = keyclick; |
1864 | #else /* !SWCODEC */ | ||
1865 | audio_init_playback(); | ||
1866 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
1867 | 1793 | ||
1868 | #ifdef HAVE_SPEAKER | 1794 | #ifdef HAVE_SPEAKER |
1869 | /* Re-enable speaker */ | 1795 | /* Re-enable speaker */ |
@@ -1895,12 +1821,10 @@ rec_abort: | |||
1895 | return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0; | 1821 | return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0; |
1896 | } /* recording_screen */ | 1822 | } /* recording_screen */ |
1897 | 1823 | ||
1898 | #if CONFIG_CODEC == SWCODEC | ||
1899 | void audio_beep(int duration) | 1824 | void audio_beep(int duration) |
1900 | { | 1825 | { |
1901 | /* dummy */ | 1826 | /* dummy */ |
1902 | (void)duration; | 1827 | (void)duration; |
1903 | } | 1828 | } |
1904 | #endif /* #ifdef CONFIG_CODEC == SWCODEC */ | ||
1905 | 1829 | ||
1906 | #endif /* HAVE_RECORDING */ | 1830 | #endif /* HAVE_RECORDING */ |
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index 406986e8e0..12088f84f6 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h | |||
@@ -33,17 +33,14 @@ void settings_apply_trigger(void); | |||
33 | /* If true, start recording automatically when recording_sreen() is entered */ | 33 | /* If true, start recording automatically when recording_sreen() is entered */ |
34 | extern bool recording_start_automatic; | 34 | extern bool recording_start_automatic; |
35 | 35 | ||
36 | #if CONFIG_CODEC == SWCODEC | ||
37 | /* handles device powerup, sets audio source and peakmeter mode */ | 36 | /* handles device powerup, sets audio source and peakmeter mode */ |
38 | void rec_set_source(int source, unsigned flags); | 37 | void rec_set_source(int source, unsigned flags); |
39 | #endif /* CONFIG_CODEC == SW_CODEC */ | ||
40 | 38 | ||
41 | /* Initializes a recording_options structure with global settings. | 39 | /* Initializes a recording_options structure with global settings. |
42 | pass returned data to audio_set_recording_options or | 40 | pass returned data to audio_set_recording_options or |
43 | rec_set_recording_options */ | 41 | rec_set_recording_options */ |
44 | void rec_init_recording_options(struct audio_recording_options *options); | 42 | void rec_init_recording_options(struct audio_recording_options *options); |
45 | /* steals mp3 buffer, sets source and then options */ | 43 | /* steals mp3 buffer, sets source and then options */ |
46 | /* SRCF_RECORDING is implied for SWCODEC */ | ||
47 | void rec_set_recording_options(struct audio_recording_options *options); | 44 | void rec_set_recording_options(struct audio_recording_options *options); |
48 | 45 | ||
49 | enum recording_command | 46 | enum recording_command |