summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c')
-rw-r--r--firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c b/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c
new file mode 100644
index 0000000000..05b77a8ff2
--- /dev/null
+++ b/firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c
@@ -0,0 +1,76 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2008 by Nils Wallménius
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include "config.h"
21#include "system.h"
22#include "audiohw.h"
23#include "audio.h"
24
25void audiohw_enable_tone_controls(bool enable);
26void audiohw_enable_depth_3d(bool enable);
27
28/* Set the audio source for IIS TX */
29void audio_set_output_source(int source)
30{
31 switch (source)
32 {
33 default:
34 case AUDIO_SRC_PLAYBACK:
35 /*
36 audiohw_enable_tone_controls(true);
37 audiohw_enable_depth_3d(true);
38 */
39 break;
40
41 case AUDIO_SRC_FMRADIO:
42 /* Analog path doesn't support these and digital radio playback
43 * cannot be done without mixing on the MCU if voice is to be
44 * heard. Any recording should match what is heard. */
45 audiohw_enable_tone_controls(false);
46 audiohw_enable_depth_3d(false);
47 break;
48 }
49}
50
51void audio_input_mux(int source, unsigned int flags)
52{
53 /* Prevent pops from unneeded switching */
54 static int last_source = AUDIO_SRC_PLAYBACK;
55 bool recording = flags & SRCF_RECORDING;
56 static bool last_recording = false;
57
58 switch (source)
59 {
60 default:
61 source = AUDIO_SRC_PLAYBACK;
62 /* Fallthrough */
63 case AUDIO_SRC_PLAYBACK: /* playback - no recording */
64 if (source != last_source)
65 audiohw_set_recsrc(AUDIO_SRC_PLAYBACK, false);
66 break;
67
68 case AUDIO_SRC_FMRADIO: /* recording and playback */
69 if (source != last_source || recording != last_recording)
70 audiohw_set_recsrc(AUDIO_SRC_FMRADIO, recording);
71 break;
72 }
73
74 last_source = source;
75 last_recording = recording;
76}