summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/audio-as3525.c
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2009-11-01 22:51:31 +0000
committerRafaël Carré <rafael.carre@gmail.com>2009-11-01 22:51:31 +0000
commit9b4057bbd43dfeaf69785605407e4625f01be069 (patch)
tree5d37bbedfcef2527629b1aae0ed184187832aaab /firmware/target/arm/as3525/audio-as3525.c
parent6cdb80d7df997d3220efe03ea6779ba2c81ddf79 (diff)
downloadrockbox-9b4057bbd43dfeaf69785605407e4625f01be069.tar.gz
rockbox-9b4057bbd43dfeaf69785605407e4625f01be069.zip
Sansa AMS recording support (Microphone and FM)
Still disabled on all targets: - Fuze and e200v2 see spurious interrupts with no source defined - Clip/m200v4 deadlock instantly when starting recording (perhaps due to low memory size) Having the code in SVN will make working on this feature easier Also add keymaps for Fuze, and correct Frequency section of recording options : the 22.05kHz limitation of e200v1 and c200v1 doesn't apply to Sansa AMS (different I2S hardware, unrelated to as3514) Flyspray: FS#10371 Authors: Fred Bauer and myself git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23476 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/audio-as3525.c')
-rw-r--r--firmware/target/arm/as3525/audio-as3525.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/firmware/target/arm/as3525/audio-as3525.c b/firmware/target/arm/as3525/audio-as3525.c
index 410fdfad79..b616153eae 100644
--- a/firmware/target/arm/as3525/audio-as3525.c
+++ b/firmware/target/arm/as3525/audio-as3525.c
@@ -25,44 +25,71 @@
25#include "audiohw.h" 25#include "audiohw.h"
26#include "sound.h" 26#include "sound.h"
27 27
28int audio_channels = 2;
29int audio_output_source = AUDIO_SRC_PLAYBACK;
30
31void audio_set_output_source(int source) 28void audio_set_output_source(int source)
32{ 29{
33 if ((unsigned)source >= AUDIO_NUM_SOURCES) 30 (void)source;
34 source = AUDIO_SRC_PLAYBACK; 31}
35
36 audio_output_source = source;
37} /* audio_set_output_source */
38 32
39void audio_input_mux(int source, unsigned flags) 33void audio_input_mux(int source, unsigned flags)
40{ 34{
41 static int last_source = AUDIO_SRC_PLAYBACK; 35 static int last_source = AUDIO_SRC_PLAYBACK;
42 36#ifdef HAVE_RECORDING
43 (void)flags; 37 static bool last_recording = false;
38 const bool recording = flags & SRCF_RECORDING;
39#else
40 (void) flags;
41#endif
44 42
45 switch (source) 43 switch (source)
46 { 44 {
47 default: /* playback - no recording */ 45 default: /* playback - no recording */
48 source = AUDIO_SRC_PLAYBACK; 46 source = AUDIO_SRC_PLAYBACK;
49 case AUDIO_SRC_PLAYBACK: 47 case AUDIO_SRC_PLAYBACK:
50 audio_channels = 2;
51 if (source != last_source) 48 if (source != last_source)
52 { 49 {
53 audiohw_set_monitor(false); 50 audiohw_set_monitor(false);
51#ifdef HAVE_RECORDING
52 audiohw_disable_recording();
53#endif
54 }
55 break;
56
57#ifdef HAVE_RECORDING
58 case AUDIO_SRC_MIC: /* recording only */
59 if (source != last_source)
60 {
61 audiohw_set_monitor(false);
62 audiohw_enable_recording(true); /* source mic */
54 } 63 }
55 break; 64 break;
65#endif
56 66
57 case AUDIO_SRC_FMRADIO: /* recording and playback */ 67 case AUDIO_SRC_FMRADIO: /* recording and playback */
58 audio_channels = 2; 68 if (source == last_source
59 if (source == last_source) 69#ifdef HAVE_RECORDING
70 && recording == last_recording
71#endif
72 )
60 break; 73 break;
61 74
62 audiohw_set_monitor(true); 75#ifdef HAVE_RECORDING
76 last_recording = recording;
77
78 if (recording)
79 {
80 audiohw_set_monitor(false);
81 audiohw_enable_recording(false);
82 }
83 else
84#endif
85 {
86#ifdef HAVE_RECORDING
87 audiohw_disable_recording();
88#endif
89 audiohw_set_monitor(true); /* line 2 analog audio path */
90 }
63 break; 91 break;
64 } /* end switch */ 92 }
65 93
66 last_source = source; 94 last_source = source;
67} /* audio_input_mux */ 95}
68