From df0dc2262ea10f621677c0f97aae1c205e253b87 Mon Sep 17 00:00:00 2001 From: Barry Wardell Date: Mon, 18 Dec 2006 01:52:21 +0000 Subject: 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 --- firmware/target/arm/audio-pp.c | 84 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 firmware/target/arm/audio-pp.c (limited to 'firmware/target/arm/audio-pp.c') 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 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2006 by Michael Sevakis + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "system.h" +#include "cpu.h" +#include "audio.h" +#include "sound.h" + +void audio_set_output_source(int source) +{ + if ((unsigned)source >= AUDIO_NUM_SOURCES) + source = AUDIO_SRC_PLAYBACK; +} /* audio_set_output_source */ + +void audio_set_source(int source, unsigned flags) +{ + /* Prevent pops from unneeded switching */ + static int last_source = AUDIO_SRC_PLAYBACK; + bool recording = flags & SRCF_RECORDING; + static bool last_recording = false; + + switch (source) + { + default: /* playback - no recording */ + source = AUDIO_SRC_PLAYBACK; + case AUDIO_SRC_PLAYBACK: + if (source != last_source) + { + audiohw_disable_recording(); + audiohw_set_monitor(false); + } + break; + + case AUDIO_SRC_MIC: /* recording only */ + if (source != last_source) + { + audiohw_enable_recording(true); /* source mic */ + audiohw_set_monitor(false); + } + break; + + case AUDIO_SRC_LINEIN: /* recording only */ + if (source != last_source) + { + audiohw_enable_recording(false); /* source line */ + audiohw_set_monitor(false); + } + break; +#ifdef CONFIG_TUNER + case AUDIO_SRC_FMRADIO: /* recording and playback */ + if (!recording) + audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN); + + if (source == last_source && recording == last_recording) + break; + + last_recording = recording; + + /* I2S recording and playback */ + audiohw_enable_recording(false); /* source line */ + audiohw_set_monitor(!recording); + break; +#endif + } /* end switch */ + + last_source = source; +} /* audio_set_source */ + + -- cgit v1.2.3