1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 by Nils Wallménius
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 /* Set the audio source for IIS TX */
27 void audio_set_output_source(int source
)
32 case AUDIO_SRC_PLAYBACK
:
33 /* Receive data from PORT2 (SSI2) */
34 AUDMUX_PDCR4
= AUDMUX_PDCR_RXDSEL_PORT2
;
35 /* wmc_clear(WMC_COMPANDING_CTRL, WMC_LOOPBACK); */
38 case AUDIO_SRC_FMRADIO
:
39 /* External source - receive data from self (loopback to TX) */
40 AUDMUX_PDCR4
= AUDMUX_PDCR_RXDSEL_PORT4
;
41 /* wmc_set(WMC_COMPANDING_CTRL, WMC_LOOPBACK); */
46 void audio_input_mux(int source
, unsigned int flags
)
48 /* Prevent pops from unneeded switching */
49 static int last_source
= AUDIO_SRC_PLAYBACK
;
50 bool recording
= flags
& SRCF_RECORDING
;
51 static bool last_recording
= false;
56 source
= AUDIO_SRC_PLAYBACK
;
58 case AUDIO_SRC_PLAYBACK
: /* playback - no recording */
59 if (source
!= last_source
)
60 audiohw_set_recsrc(AUDIO_SRC_PLAYBACK
, false);
63 case AUDIO_SRC_FMRADIO
: /* recording and playback */
64 if (source
!= last_source
|| recording
!= last_recording
)
65 audiohw_set_recsrc(AUDIO_SRC_FMRADIO
, recording
);
70 last_recording
= recording
;