diff options
author | Lorenzo Miori <memoryS60@gmail.com> | 2013-09-10 22:48:34 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-02-05 09:56:21 +0100 |
commit | e876f4df6d240bd2e319b1e63be95a625f049a97 (patch) | |
tree | ce2fe1b24650e3be7a6cd2d346d29090a5422a8c /firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c | |
parent | b828b9d99bff2acc0e1f543f3176fd4b632cba68 (diff) | |
download | rockbox-e876f4df6d240bd2e319b1e63be95a625f049a97.tar.gz rockbox-e876f4df6d240bd2e319b1e63be95a625f049a97.zip |
Samsung YP-R1 target port
This is the basic port to the new target Samsung
YP-R1, which runs on a similar platform as YP-R0.
Port is usable, although there are still
some optimizations that have to be done.
Change-Id: If83a8e386369e413581753780c159026d9e41f04
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr1/audio-ypr1.c | 76 |
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 | |||
25 | void audiohw_enable_tone_controls(bool enable); | ||
26 | void audiohw_enable_depth_3d(bool enable); | ||
27 | |||
28 | /* Set the audio source for IIS TX */ | ||
29 | void 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 | |||
51 | void 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 | } | ||