summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-05-04 15:14:56 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-05-04 15:14:56 +0000
commit2aaf45e643053b9a3515e4320b82b16fb32be02a (patch)
tree3f29921a8e0ef2a752e2104ef96d9862c53017e2 /apps
parent621cf0788fd69c967688692b7f19c02b6df7a322 (diff)
downloadrockbox-2aaf45e643053b9a3515e4320b82b16fb32be02a.tar.gz
rockbox-2aaf45e643053b9a3515e4320b82b16fb32be02a.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h10
-rw-r--r--apps/plugins/test_sampr.c6
-rw-r--r--apps/recorder/recording.c19
4 files changed, 16 insertions, 25 deletions
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 = {
309 utf8seek, 309 utf8seek,
310 310
311 /* sound */ 311 /* sound */
312#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) 312#if CONFIG_CODEC == SWCODEC
313 sound_default, 313 sound_default,
314#endif 314#endif
315 sound_set, 315 sound_set,
@@ -329,9 +329,7 @@ static const struct plugin_api rockbox_api = {
329#if CONFIG_CODEC == SWCODEC 329#if CONFIG_CODEC == SWCODEC
330 &audio_master_sampr_list[0], 330 &audio_master_sampr_list[0],
331 &hw_freq_sampr[0], 331 &hw_freq_sampr[0],
332#ifndef SIMULATOR
333 pcm_apply_settings, 332 pcm_apply_settings,
334#endif
335 pcm_play_data, 333 pcm_play_data,
336 pcm_play_stop, 334 pcm_play_stop,
337 pcm_set_frequency, 335 pcm_set_frequency,
@@ -342,7 +340,6 @@ static const struct plugin_api rockbox_api = {
342 pcm_calculate_peaks, 340 pcm_calculate_peaks,
343#ifdef HAVE_RECORDING 341#ifdef HAVE_RECORDING
344 &rec_freq_sampr[0], 342 &rec_freq_sampr[0],
345#ifndef SIMULATOR
346 pcm_init_recording, 343 pcm_init_recording,
347 pcm_close_recording, 344 pcm_close_recording,
348 pcm_record_data, 345 pcm_record_data,
@@ -352,7 +349,6 @@ static const struct plugin_api rockbox_api = {
352 audio_set_recording_gain, 349 audio_set_recording_gain,
353 audio_set_output_source, 350 audio_set_output_source,
354 rec_set_source, 351 rec_set_source,
355#endif
356#endif /* HAVE_RECORDING */ 352#endif /* HAVE_RECORDING */
357 353
358#endif 354#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 @@
110#define PLUGIN_MAGIC 0x526F634B /* RocK */ 110#define PLUGIN_MAGIC 0x526F634B /* RocK */
111 111
112/* increase this every time the api struct changes */ 112/* increase this every time the api struct changes */
113#define PLUGIN_API_VERSION 53 113#define PLUGIN_API_VERSION 54
114 114
115/* update this to latest version if a change to the api struct breaks 115/* update this to latest version if a change to the api struct breaks
116 backwards compatibility (and please take the opportunity to sort in any 116 backwards compatibility (and please take the opportunity to sort in any
117 new function which are "waiting" at the end of the function table) */ 117 new function which are "waiting" at the end of the function table) */
118#define PLUGIN_MIN_API_VERSION 52 118#define PLUGIN_MIN_API_VERSION 54
119 119
120/* plugin return codes */ 120/* plugin return codes */
121enum plugin_status { 121enum plugin_status {
@@ -404,7 +404,7 @@ struct plugin_api {
404 int (*utf8seek)(const unsigned char* utf8, int offset); 404 int (*utf8seek)(const unsigned char* utf8, int offset);
405 405
406 /* sound */ 406 /* sound */
407#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING) 407#if CONFIG_CODEC == SWCODEC
408 int (*sound_default)(int setting); 408 int (*sound_default)(int setting);
409#endif 409#endif
410 void (*sound_set)(int setting, int value); 410 void (*sound_set)(int setting, int value);
@@ -424,9 +424,7 @@ struct plugin_api {
424#if CONFIG_CODEC == SWCODEC 424#if CONFIG_CODEC == SWCODEC
425 const unsigned long *audio_master_sampr_list; 425 const unsigned long *audio_master_sampr_list;
426 const unsigned long *hw_freq_sampr; 426 const unsigned long *hw_freq_sampr;
427#ifndef SIMULATOR
428 void (*pcm_apply_settings)(void); 427 void (*pcm_apply_settings)(void);
429#endif
430 void (*pcm_play_data)(pcm_more_callback_type get_more, 428 void (*pcm_play_data)(pcm_more_callback_type get_more,
431 unsigned char* start, size_t size); 429 unsigned char* start, size_t size);
432 void (*pcm_play_stop)(void); 430 void (*pcm_play_stop)(void);
@@ -438,7 +436,6 @@ struct plugin_api {
438 void (*pcm_calculate_peaks)(int *left, int *right); 436 void (*pcm_calculate_peaks)(int *left, int *right);
439#ifdef HAVE_RECORDING 437#ifdef HAVE_RECORDING
440 const unsigned long *rec_freq_sampr; 438 const unsigned long *rec_freq_sampr;
441#ifndef SIMULATOR
442 void (*pcm_init_recording)(void); 439 void (*pcm_init_recording)(void);
443 void (*pcm_close_recording)(void); 440 void (*pcm_close_recording)(void);
444 void (*pcm_record_data)(pcm_more_callback_type2 more_ready, 441 void (*pcm_record_data)(pcm_more_callback_type2 more_ready,
@@ -449,7 +446,6 @@ struct plugin_api {
449 void (*audio_set_recording_gain)(int left, int right, int type); 446 void (*audio_set_recording_gain)(int left, int right, int type);
450 void (*audio_set_output_source)(int monitor); 447 void (*audio_set_output_source)(int monitor);
451 void (*rec_set_source)(int source, unsigned flags); 448 void (*rec_set_source)(int source, unsigned flags);
452#endif
453#endif /* HAVE_RECORDING */ 449#endif /* HAVE_RECORDING */
454 450
455#endif 451#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)
198 rb->audio_stop(); 198 rb->audio_stop();
199 rb->sound_set(SOUND_VOLUME, rb->sound_default(SOUND_VOLUME)); 199 rb->sound_set(SOUND_VOLUME, rb->sound_default(SOUND_VOLUME));
200 200
201#ifdef HAVE_RECORDING
201 /* Select playback */ 202 /* Select playback */
202 rb->rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); 203 rb->rec_set_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
204#endif
203 205
206#ifdef HAVE_ADJUSTABLE_CPU_FREQ
204 rb->cpu_boost(true); 207 rb->cpu_boost(true);
208#endif
205 209
206 rb->pcm_set_frequency(rb->hw_freq_sampr[freq]); 210 rb->pcm_set_frequency(rb->hw_freq_sampr[freq]);
207 211
@@ -223,7 +227,9 @@ void play_waveform(void)
223 while (rb->pcm_is_playing()) 227 while (rb->pcm_is_playing())
224 rb->yield(); 228 rb->yield();
225 229
230#ifdef HAVE_ADJUSTABLE_CPU_FREQ
226 rb->cpu_boost(false); 231 rb->cpu_boost(false);
232#endif
227 233
228 /* restore default - user of apis is responsible for restoring 234 /* restore default - user of apis is responsible for restoring
229 default state - normally playback at 44100Hz */ 235 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)
2100 type = type; 2100 type = type;
2101} 2101}
2102 2102
2103void audio_set_output_source(int source)
2104{
2105 source = source;
2106}
2107
2108
2103void audio_record(const char *filename) 2109void audio_record(const char *filename)
2104{ 2110{
2105 filename = filename; 2111 filename = filename;
@@ -2117,19 +2123,6 @@ void audio_resume_recording(void)
2117{ 2123{
2118} 2124}
2119 2125
2120void pcm_calculate_rec_peaks(int *left, int *right)
2121{
2122 if (left)
2123 *left = 0;
2124 if (right)
2125 *right = 0;
2126}
2127
2128unsigned long pcm_rec_status(void)
2129{
2130 return 0;
2131}
2132
2133#endif /* #ifdef SIMULATOR */ 2126#endif /* #ifdef SIMULATOR */
2134#endif /* #ifdef CONFIG_CODEC == SWCODEC */ 2127#endif /* #ifdef CONFIG_CODEC == SWCODEC */
2135 2128