Initial D2 sound playback support (known issues to follow on the CowonD2Info wiki...
[kugel-rb.git] / firmware / target / arm / tcc780x / cowond2 / audio-cowond2.c
blobf73528247c586aedd238015a496d14d6e13c4884
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Michael Sevakis
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "system.h"
20 #include "cpu.h"
21 #include "audio.h"
22 #include "sound.h"
24 int audio_channels = 2;
25 int audio_output_source = AUDIO_SRC_PLAYBACK;
27 void audio_set_output_source(int source)
29 int oldmode = set_fiq_status(FIQ_DISABLED);
31 if ((unsigned)source >= AUDIO_NUM_SOURCES)
32 source = AUDIO_SRC_PLAYBACK;
34 audio_output_source = source;
36 /*if (source != AUDIO_SRC_PLAYBACK)
37 IISCONFIG |= (1 << 29);*/
39 set_fiq_status(oldmode);
42 void audio_input_mux(int source, unsigned flags)
44 static int last_source = AUDIO_SRC_PLAYBACK;
45 static bool last_recording = false;
46 bool recording = flags & SRCF_RECORDING;
48 switch (source)
50 default: /* playback - no recording */
51 source = AUDIO_SRC_PLAYBACK;
52 case AUDIO_SRC_PLAYBACK:
53 audio_channels = 2;
54 if (source != last_source)
56 /*audiohw_set_monitor(false);
57 audiohw_disable_recording();*/
59 break;
61 case AUDIO_SRC_MIC: /* recording only */
62 audio_channels = 1;
63 if (source != last_source)
65 /*audiohw_set_monitor(false);
66 audiohw_enable_recording(true); /. source mic */
68 break;
70 case AUDIO_SRC_FMRADIO: /* recording and playback */
71 audio_channels = 2;
73 if (source == last_source && recording == last_recording)
74 break;
76 last_recording = recording;
78 if (recording)
80 /*audiohw_set_monitor(false);
81 audiohw_enable_recording(false);*/
83 else
85 /*audiohw_disable_recording();
86 audiohw_set_monitor(true); /. line 1 analog audio path */
88 break;
89 } /* end switch */
91 last_source = source;
92 } /* audio_input_mux */