diff options
-rw-r--r-- | firmware/export/audiohw.h | 8 | ||||
-rw-r--r-- | firmware/pcm.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/audio-c200_e200.c | 28 |
3 files changed, 34 insertions, 4 deletions
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index f9d8caebf0..56f4d3dbea 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h | |||
@@ -529,13 +529,17 @@ void audiohw_disable_recording(void); | |||
529 | */ | 529 | */ |
530 | void audiohw_set_recvol(int left, int right, int type); | 530 | void audiohw_set_recvol(int left, int right, int type); |
531 | 531 | ||
532 | #endif /* HAVE_RECORDING */ | ||
533 | |||
534 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) | ||
532 | /** | 535 | /** |
533 | * Enable or disable recording monitor. | 536 | * Enable or disable recording monitor. |
534 | * @param enable ture or false. | 537 | * @param enable true or false. |
535 | */ | 538 | */ |
536 | void audiohw_set_monitor(bool enable); | 539 | void audiohw_set_monitor(bool enable); |
540 | #endif | ||
541 | |||
537 | 542 | ||
538 | #endif /* HAVE_RECORDING */ | ||
539 | 543 | ||
540 | #if CONFIG_CODEC != SWCODEC | 544 | #if CONFIG_CODEC != SWCODEC |
541 | 545 | ||
diff --git a/firmware/pcm.c b/firmware/pcm.c index 76a0ea2777..d15c129015 100644 --- a/firmware/pcm.c +++ b/firmware/pcm.c | |||
@@ -364,7 +364,9 @@ void pcm_set_frequency(unsigned int samplerate) | |||
364 | int index; | 364 | int index; |
365 | 365 | ||
366 | #ifdef CONFIG_SAMPR_TYPES | 366 | #ifdef CONFIG_SAMPR_TYPES |
367 | #ifdef HAVE_RECORDING | ||
367 | unsigned int type = samplerate & SAMPR_TYPE_MASK; | 368 | unsigned int type = samplerate & SAMPR_TYPE_MASK; |
369 | #endif | ||
368 | samplerate &= ~SAMPR_TYPE_MASK; | 370 | samplerate &= ~SAMPR_TYPE_MASK; |
369 | 371 | ||
370 | #ifdef HAVE_RECORDING | 372 | #ifdef HAVE_RECORDING |
diff --git a/firmware/target/arm/sandisk/audio-c200_e200.c b/firmware/target/arm/sandisk/audio-c200_e200.c index 0037bac58b..2f6bde1b98 100644 --- a/firmware/target/arm/sandisk/audio-c200_e200.c +++ b/firmware/target/arm/sandisk/audio-c200_e200.c | |||
@@ -45,8 +45,12 @@ void audio_set_output_source(int source) | |||
45 | void audio_input_mux(int source, unsigned flags) | 45 | void audio_input_mux(int source, unsigned flags) |
46 | { | 46 | { |
47 | static int last_source = AUDIO_SRC_PLAYBACK; | 47 | static int last_source = AUDIO_SRC_PLAYBACK; |
48 | #ifdef HAVE_RECORDING | ||
48 | static bool last_recording = false; | 49 | static bool last_recording = false; |
49 | bool recording = flags & SRCF_RECORDING; | 50 | bool recording = flags & SRCF_RECORDING; |
51 | #else | ||
52 | (void) flags; | ||
53 | #endif | ||
50 | 54 | ||
51 | switch (source) | 55 | switch (source) |
52 | { | 56 | { |
@@ -56,11 +60,16 @@ void audio_input_mux(int source, unsigned flags) | |||
56 | audio_channels = 2; | 60 | audio_channels = 2; |
57 | if (source != last_source) | 61 | if (source != last_source) |
58 | { | 62 | { |
63 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) | ||
59 | audiohw_set_monitor(false); | 64 | audiohw_set_monitor(false); |
65 | #endif | ||
66 | #ifdef HAVE_RECORDING | ||
60 | audiohw_disable_recording(); | 67 | audiohw_disable_recording(); |
68 | #endif | ||
61 | } | 69 | } |
62 | break; | 70 | break; |
63 | 71 | ||
72 | #if defined(HAVE_RECORDING) && (INPUT_SRC_CAPS & SRC_CAP_MIC) | ||
64 | case AUDIO_SRC_MIC: /* recording only */ | 73 | case AUDIO_SRC_MIC: /* recording only */ |
65 | audio_channels = 1; | 74 | audio_channels = 1; |
66 | if (source != last_source) | 75 | if (source != last_source) |
@@ -69,26 +78,39 @@ void audio_input_mux(int source, unsigned flags) | |||
69 | audiohw_enable_recording(true); /* source mic */ | 78 | audiohw_enable_recording(true); /* source mic */ |
70 | } | 79 | } |
71 | break; | 80 | break; |
81 | #endif | ||
72 | 82 | ||
83 | #if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) | ||
73 | case AUDIO_SRC_FMRADIO: /* recording and playback */ | 84 | case AUDIO_SRC_FMRADIO: /* recording and playback */ |
74 | audio_channels = 2; | 85 | audio_channels = 2; |
75 | 86 | ||
76 | if (source == last_source && recording == last_recording) | 87 | if (source == last_source |
88 | #ifdef HAVE_RECORDING | ||
89 | && recording == last_recording | ||
90 | #endif | ||
91 | ) | ||
77 | break; | 92 | break; |
78 | 93 | ||
94 | #ifdef HAVE_RECORDING | ||
79 | last_recording = recording; | 95 | last_recording = recording; |
80 | |||
81 | if (recording) | 96 | if (recording) |
82 | { | 97 | { |
83 | audiohw_set_monitor(false); | 98 | audiohw_set_monitor(false); |
84 | audiohw_enable_recording(false); | 99 | audiohw_enable_recording(false); |
85 | } | 100 | } |
101 | #endif | ||
86 | else | 102 | else |
87 | { | 103 | { |
104 | #ifdef HAVE_RECORDING | ||
88 | audiohw_disable_recording(); | 105 | audiohw_disable_recording(); |
106 | #endif | ||
107 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) | ||
89 | audiohw_set_monitor(true); /* line 1 analog audio path */ | 108 | audiohw_set_monitor(true); /* line 1 analog audio path */ |
109 | #endif | ||
110 | |||
90 | } | 111 | } |
91 | break; | 112 | break; |
113 | #endif /* (INPUT_SRC_CAPS & SRC_CAP_FMRADIO) */ | ||
92 | } /* end switch */ | 114 | } /* end switch */ |
93 | 115 | ||
94 | last_source = source; | 116 | last_source = source; |
@@ -164,6 +186,7 @@ void audiohw_set_sampr_dividers(int fsel) | |||
164 | IISDIV = (IISDIV & ~0xc000003f) | regvals[fsel].iisdiv; | 186 | IISDIV = (IISDIV & ~0xc000003f) | regvals[fsel].iisdiv; |
165 | } | 187 | } |
166 | 188 | ||
189 | #ifdef HAVE_RECORDING | ||
167 | unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) | 190 | unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) |
168 | { | 191 | { |
169 | /* Check if the samplerate is in the list of recordable rates. | 192 | /* Check if the samplerate is in the list of recordable rates. |
@@ -175,3 +198,4 @@ unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) | |||
175 | 198 | ||
176 | return samplerate * 2; /* Recording rates are 1/2 the codec clock */ | 199 | return samplerate * 2; /* Recording rates are 1/2 the codec clock */ |
177 | } | 200 | } |
201 | #endif | ||