summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tcc780x/cowond2/audio-cowond2.c')
-rw-r--r--firmware/target/arm/tcc780x/cowond2/audio-cowond2.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c b/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c
new file mode 100644
index 0000000000..f73528247c
--- /dev/null
+++ b/firmware/target/arm/tcc780x/cowond2/audio-cowond2.c
@@ -0,0 +1,92 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Michael Sevakis
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "system.h"
20#include "cpu.h"
21#include "audio.h"
22#include "sound.h"
23
24int audio_channels = 2;
25int audio_output_source = AUDIO_SRC_PLAYBACK;
26
27void audio_set_output_source(int source)
28{
29 int oldmode = set_fiq_status(FIQ_DISABLED);
30
31 if ((unsigned)source >= AUDIO_NUM_SOURCES)
32 source = AUDIO_SRC_PLAYBACK;
33
34 audio_output_source = source;
35
36 /*if (source != AUDIO_SRC_PLAYBACK)
37 IISCONFIG |= (1 << 29);*/
38
39 set_fiq_status(oldmode);
40}
41
42void audio_input_mux(int source, unsigned flags)
43{
44 static int last_source = AUDIO_SRC_PLAYBACK;
45 static bool last_recording = false;
46 bool recording = flags & SRCF_RECORDING;
47
48 switch (source)
49 {
50 default: /* playback - no recording */
51 source = AUDIO_SRC_PLAYBACK;
52 case AUDIO_SRC_PLAYBACK:
53 audio_channels = 2;
54 if (source != last_source)
55 {
56 /*audiohw_set_monitor(false);
57 audiohw_disable_recording();*/
58 }
59 break;
60
61 case AUDIO_SRC_MIC: /* recording only */
62 audio_channels = 1;
63 if (source != last_source)
64 {
65 /*audiohw_set_monitor(false);
66 audiohw_enable_recording(true); /. source mic */
67 }
68 break;
69
70 case AUDIO_SRC_FMRADIO: /* recording and playback */
71 audio_channels = 2;
72
73 if (source == last_source && recording == last_recording)
74 break;
75
76 last_recording = recording;
77
78 if (recording)
79 {
80 /*audiohw_set_monitor(false);
81 audiohw_enable_recording(false);*/
82 }
83 else
84 {
85 /*audiohw_disable_recording();
86 audiohw_set_monitor(true); /. line 1 analog audio path */
87 }
88 break;
89 } /* end switch */
90
91 last_source = source;
92} /* audio_input_mux */