From 2aaf45e643053b9a3515e4320b82b16fb32be02a Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 4 May 2007 15:14:56 +0000 Subject: Get samplerate switching working in the sim to be similar to on target. Make all pcm functions available there as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13320 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 6 +----- apps/plugin.h | 10 +++------- apps/plugins/test_sampr.c | 6 ++++++ apps/recorder/recording.c | 19 ++++++------------- 4 files changed, 16 insertions(+), 25 deletions(-) (limited to 'apps') diff --git a/apps/plugin.c b/apps/plugin.c index 0ce214cbde..ea228c454c 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -309,7 +309,7 @@ static const struct plugin_api rockbox_api = { utf8seek, /* sound */ -#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) +#if CONFIG_CODEC == SWCODEC sound_default, #endif sound_set, @@ -329,9 +329,7 @@ static const struct plugin_api rockbox_api = { #if CONFIG_CODEC == SWCODEC &audio_master_sampr_list[0], &hw_freq_sampr[0], -#ifndef SIMULATOR pcm_apply_settings, -#endif pcm_play_data, pcm_play_stop, pcm_set_frequency, @@ -342,7 +340,6 @@ static const struct plugin_api rockbox_api = { pcm_calculate_peaks, #ifdef HAVE_RECORDING &rec_freq_sampr[0], -#ifndef SIMULATOR pcm_init_recording, pcm_close_recording, pcm_record_data, @@ -352,7 +349,6 @@ static const struct plugin_api rockbox_api = { audio_set_recording_gain, audio_set_output_source, rec_set_source, -#endif #endif /* HAVE_RECORDING */ #endif diff --git a/apps/plugin.h b/apps/plugin.h index 2886b0938f..987c07067d 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -110,12 +110,12 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 53 +#define PLUGIN_API_VERSION 54 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 52 +#define PLUGIN_MIN_API_VERSION 54 /* plugin return codes */ enum plugin_status { @@ -404,7 +404,7 @@ struct plugin_api { int (*utf8seek)(const unsigned char* utf8, int offset); /* sound */ -#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) +#if CONFIG_CODEC == SWCODEC int (*sound_default)(int setting); #endif void (*sound_set)(int setting, int value); @@ -424,9 +424,7 @@ struct plugin_api { #if CONFIG_CODEC == SWCODEC const unsigned long *audio_master_sampr_list; const unsigned long *hw_freq_sampr; -#ifndef SIMULATOR void (*pcm_apply_settings)(void); -#endif void (*pcm_play_data)(pcm_more_callback_type get_more, unsigned char* start, size_t size); void (*pcm_play_stop)(void); @@ -438,7 +436,6 @@ struct plugin_api { void (*pcm_calculate_peaks)(int *left, int *right); #ifdef HAVE_RECORDING const unsigned long *rec_freq_sampr; -#ifndef SIMULATOR void (*pcm_init_recording)(void); void (*pcm_close_recording)(void); void (*pcm_record_data)(pcm_more_callback_type2 more_ready, @@ -449,7 +446,6 @@ struct plugin_api { 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 diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c index 7e78137e97..891e68ffda 100644 --- a/apps/plugins/test_sampr.c +++ b/apps/plugins/test_sampr.c @@ -198,10 +198,14 @@ void play_waveform(void) rb->audio_stop(); rb->sound_set(SOUND_VOLUME, rb->sound_default(SOUND_VOLUME)); +#ifdef HAVE_RECORDING /* Select playback */ rb->rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); +#endif +#ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(true); +#endif rb->pcm_set_frequency(rb->hw_freq_sampr[freq]); @@ -223,7 +227,9 @@ void play_waveform(void) while (rb->pcm_is_playing()) rb->yield(); +#ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(false); +#endif /* restore default - user of apis is responsible for restoring default state - normally playback at 44100Hz */ diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 025480cf91..d0e79bcdd7 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -2100,6 +2100,12 @@ void audio_set_recording_gain(int left, int right, int type) type = type; } +void audio_set_output_source(int source) +{ + source = source; +} + + void audio_record(const char *filename) { filename = filename; @@ -2117,19 +2123,6 @@ void audio_resume_recording(void) { } -void pcm_calculate_rec_peaks(int *left, int *right) -{ - if (left) - *left = 0; - if (right) - *right = 0; -} - -unsigned long pcm_rec_status(void) -{ - return 0; -} - #endif /* #ifdef SIMULATOR */ #endif /* #ifdef CONFIG_CODEC == SWCODEC */ -- cgit v1.2.3