diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2006-11-23 19:21:15 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2006-11-23 19:21:15 +0000 |
| commit | ab1861a3c2c06cf3edff7c42348d117f21235e48 (patch) | |
| tree | e41eddf45f5348a2d954ac97984fbf7a7c61bd6c /apps | |
| parent | 069c54d5d87378ccd73d84be2606ec2ab654bc21 (diff) | |
| download | rockbox-ab1861a3c2c06cf3edff7c42348d117f21235e48.zip rockbox-ab1861a3c2c06cf3edff7c42348d117f21235e48.tar.gz rockbox-ab1861a3c2c06cf3edff7c42348d117f21235e48.tar.bz2 rockbox-ab1861a3c2c06cf3edff7c42348d117f21235e48.tar.xz | |
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')
| -rw-r--r-- | apps/plugin.c | 9 | ||||
| -rw-r--r-- | apps/plugin.h | 10 | ||||
| -rw-r--r-- | apps/recorder/recording.c | 114 | ||||
| -rw-r--r-- | apps/recorder/recording.h | 9 |
4 files changed, 18 insertions, 124 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index f5e6ceb..21930ee 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -456,22 +456,25 @@ static const struct plugin_api rockbox_api = { #ifdef HAVE_RECORDING &rec_freq_sampr[0], #ifndef SIMULATOR - pcm_set_monitor, - pcm_set_rec_source, pcm_init_recording, pcm_close_recording, pcm_record_data, pcm_stop_recording, pcm_calculate_rec_peaks, + audio_set_recording_gain, + audio_set_output_source, rec_set_source, #endif #endif /* HAVE_RECORDING */ #endif /* CONFIG_CODEC == SWCODEC */ - #ifdef IRAM_STEAL plugin_iram_init, #endif + +#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && !defined(SIMULATOR) + sound_default, +#endif }; int plugin_load(const char* plugin, void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index 339afe9..ba0fdf0 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -568,25 +568,27 @@ struct plugin_api { #ifdef HAVE_RECORDING const unsigned long *rec_freq_sampr; #ifndef SIMULATOR - void (*pcm_set_monitor)(int monitor); - void (*pcm_set_rec_source)(int source); void (*pcm_init_recording)(void); void (*pcm_close_recording)(void); void (*pcm_record_data)(pcm_more_callback_type more_ready, unsigned char *start, size_t size); void (*pcm_stop_recording)(void); void (*pcm_calculate_rec_peaks)(int *left, int *right); + void (*audio_set_recording_gain)(int left, int right, int type); + void (*audio_set_output_source)(int monitor); void (*rec_set_source)(int source, unsigned flags); #endif #endif /* HAVE_RECORDING */ #endif /* CONFIG_CODEC == SWCODEC */ - - #ifdef IRAM_STEAL void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, char *iedata, size_t iedata_size); #endif + +#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) && !defined(SIMULATOR) + int (*sound_default)(int setting); +#endif }; /* plugin header */ diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 73d0425..6750acc 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 a977efa..a67337b 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 */ |