summaryrefslogtreecommitdiff
path: root/firmware/target/arm/audio-pp.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-12-18 01:52:21 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-12-18 01:52:21 +0000
commitdf0dc2262ea10f621677c0f97aae1c205e253b87 (patch)
treed25085132fe9f0504d221360092537492cedd3b8 /firmware/target/arm/audio-pp.c
parent440353a9aa1159584b977a2852e723ae07bad2a6 (diff)
downloadrockbox-df0dc2262ea10f621677c0f97aae1c205e253b87.tar.gz
rockbox-df0dc2262ea10f621677c0f97aae1c205e253b87.zip
FS#6096. Recording on PortalPlayer targets (H10, iPod Video, iPod 4g, iPod Color, iPod Nano).
* Fix failed compile of enc_config.c when HAVE_MPEG2_SAMPR is not defined. * Fix bug in AIFF encoder header creation on little endian targets. * Add recording screen keymaps for H10 and iPod. * Move pcm_playback PP specific code to target tree. * Add recording code to wmcodec drivers. * Add pcm_record code. Some problems still remain: * Playback doesn't work after recording until Rockbox is restarted. * Gain control not implemented. * Only 16-bit/44KHz for now. The hardware should be capable of up to 24-bit/96KHz. * Line-in recording not tested on H10. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11794 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/audio-pp.c')
-rw-r--r--firmware/target/arm/audio-pp.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/firmware/target/arm/audio-pp.c b/firmware/target/arm/audio-pp.c
new file mode 100644
index 0000000000..c08db8a88a
--- /dev/null
+++ b/firmware/target/arm/audio-pp.c
@@ -0,0 +1,84 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 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
24void audio_set_output_source(int source)
25{
26 if ((unsigned)source >= AUDIO_NUM_SOURCES)
27 source = AUDIO_SRC_PLAYBACK;
28} /* audio_set_output_source */
29
30void audio_set_source(int source, unsigned flags)
31{
32 /* Prevent pops from unneeded switching */
33 static int last_source = AUDIO_SRC_PLAYBACK;
34 bool recording = flags & SRCF_RECORDING;
35 static bool last_recording = false;
36
37 switch (source)
38 {
39 default: /* playback - no recording */
40 source = AUDIO_SRC_PLAYBACK;
41 case AUDIO_SRC_PLAYBACK:
42 if (source != last_source)
43 {
44 audiohw_disable_recording();
45 audiohw_set_monitor(false);
46 }
47 break;
48
49 case AUDIO_SRC_MIC: /* recording only */
50 if (source != last_source)
51 {
52 audiohw_enable_recording(true); /* source mic */
53 audiohw_set_monitor(false);
54 }
55 break;
56
57 case AUDIO_SRC_LINEIN: /* recording only */
58 if (source != last_source)
59 {
60 audiohw_enable_recording(false); /* source line */
61 audiohw_set_monitor(false);
62 }
63 break;
64#ifdef CONFIG_TUNER
65 case AUDIO_SRC_FMRADIO: /* recording and playback */
66 if (!recording)
67 audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN);
68
69 if (source == last_source && recording == last_recording)
70 break;
71
72 last_recording = recording;
73
74 /* I2S recording and playback */
75 audiohw_enable_recording(false); /* source line */
76 audiohw_set_monitor(!recording);
77 break;
78#endif
79 } /* end switch */
80
81 last_source = source;
82} /* audio_set_source */
83
84