summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-23 19:21:15 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-23 19:21:15 +0000
commitab1861a3c2c06cf3edff7c42348d117f21235e48 (patch)
treee41eddf45f5348a2d954ac97984fbf7a7c61bd6c /apps/recorder
parent069c54d5d87378ccd73d84be2606ec2ab654bc21 (diff)
iRiver/iAudio: Added audio_set_recording gain and sound_default to plugin API. Simplified plugin recording by target/-ing some audio functions. UDA1380 records with WSPLL as a result.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11577 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/recording.c114
-rw-r--r--apps/recorder/recording.h9
2 files changed, 6 insertions, 117 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 73d0425f24..6750acc691 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -38,12 +38,6 @@
#include "spdif.h"
#endif
#endif /* CONFIG_CODEC == SWCODEC */
-#ifdef HAVE_UDA1380
-#include "uda1380.h"
-#endif
-#ifdef HAVE_TLV320
-#include "tlv320.h"
-#endif
#include "recording.h"
#include "mp3_playback.h"
#include "mas.h"
@@ -580,36 +574,14 @@ static void rec_boost(bool state)
* The order of setting monitoring may need tweaking dependent upon the
* selected source to get the smoothest transition.
*/
-#if defined(HAVE_UDA1380)
-#define ac_disable_recording uda1380_disable_recording
-#define ac_enable_recording uda1380_enable_recording
-#define ac_set_monitor uda1380_set_monitor
-#elif defined(HAVE_TLV320)
-#define ac_disable_recording tlv320_disable_recording
-#define ac_enable_recording tlv320_enable_recording
-#define ac_set_monitor tlv320_set_monitor
-#endif
-
void rec_set_source(int source, unsigned flags)
{
- /* Prevent pops from unneeded switching */
- static int last_source = AUDIO_SRC_PLAYBACK;
-#ifdef HAVE_TLV320
- static bool last_recording = false;
-#endif
-
- bool recording = flags & SRCF_RECORDING;
- /* Default to peakmeter record. */
- bool pm_playback = false;
- bool pm_enabled = true;
-
/** Do power up/down of associated device(s) **/
/** SPDIF **/
#ifdef HAVE_SPDIF_IN
/* Always boost for SPDIF */
- if ((source == AUDIO_SRC_SPDIF) != (source == last_source))
- rec_boost(source == AUDIO_SRC_SPDIF);
+ rec_boost(source == AUDIO_SRC_SPDIF);
#endif /* HAVE_SPDIF_IN */
#ifdef HAVE_SPDIF_POWER
@@ -639,87 +611,11 @@ void rec_set_source(int source, unsigned flags)
radio_start();
#endif
- switch (source)
- {
- default: /* playback - no recording */
- source = AUDIO_SRC_PLAYBACK;
- case AUDIO_SRC_PLAYBACK:
- pm_playback = true;
- if (source == last_source)
- break;
- ac_disable_recording();
- ac_set_monitor(false);
- pcm_rec_mux(0); /* line in */
- break;
-
- case AUDIO_SRC_MIC: /* recording only */
- if (source == last_source)
- break;
- ac_enable_recording(true); /* source mic */
- pcm_rec_mux(0); /* line in */
- break;
-
- case AUDIO_SRC_LINEIN: /* recording only */
- if (source == last_source)
- break;
- pcm_rec_mux(0); /* line in */
- ac_enable_recording(false); /* source line */
- break;
+ /* set hardware inputs */
+ audio_set_source(source, flags);
-#ifdef HAVE_SPDIF_IN
- case AUDIO_SRC_SPDIF: /* recording only */
- if (source == last_source)
- break;
- ac_disable_recording();
- break;
-#endif /* HAVE_SPDIF_IN */
-
-#ifdef HAVE_FMRADIO_IN
- case AUDIO_SRC_FMRADIO: /* recording and playback */
- if (!recording)
- {
- audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
- sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
- pm_playback = true;
- pm_enabled = false;
- }
-
- pcm_rec_mux(1); /* fm radio */
-
-#ifdef HAVE_UDA1380
- if (source == last_source)
- break;
- /* I2S recording and playback */
- uda1380_enable_recording(false); /* source line */
- uda1380_set_monitor(true);
-#endif
-#ifdef HAVE_TLV320
- /* I2S recording and analog playback */
- if (source == last_source && recording == last_recording)
- break;
-
- last_recording = recording;
-
- if (recording)
- tlv320_enable_recording(false); /* source line */
- else
- {
- tlv320_disable_recording();
- tlv320_set_monitor(true); /* analog bypass */
- }
-#endif
- break;
-/* #elif defined(CONFIG_TUNER) */
-/* Have radio but cannot record it */
-/* case AUDIO_SRC_FMRADIO: */
-/* break; */
-#endif /* HAVE_FMRADIO_IN */
- } /* end switch */
-
- peak_meter_playback(pm_playback);
- peak_meter_enabled = pm_enabled;
-
- last_source = source;
+ peak_meter_playback((flags & SRCF_RECORDING) == 0);
+ peak_meter_enabled = true;
} /* rec_set_source */
#endif /* CONFIG_CODEC == SWCODEC && !defined(SIMULATOR) */
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h
index a977efa749..a67337b9b6 100644
--- a/apps/recorder/recording.h
+++ b/apps/recorder/recording.h
@@ -24,14 +24,7 @@ char *rec_create_filename(char *buf);
int rec_create_directory(void);
#if CONFIG_CODEC == SWCODEC
-/* selects an audio source for recording or playback */
-#define SRCF_PLAYBACK 0x0000 /* default */
-#define SRCF_RECORDING 0x1000
-#ifdef CONFIG_TUNER
-/* for AUDIO_SRC_FMRADIO */
-#define SRCF_FMRADIO_PLAYING 0x0000 /* default */
-#define SRCF_FMRADIO_PAUSED 0x2000
-#endif
+/* handles device powerup and sets audio source */
void rec_set_source(int source, unsigned flags);
#endif /* CONFIG_CODEC == SW_CODEC */