summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-12 11:01:07 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-12 11:01:07 +0000
commite69d567d9ebf7d236ff9663b11ac396cc71dcd75 (patch)
tree093b9d1bc979d79be1fcd0daac1d8daf8ac55503 /uisimulator
parent0ad97d13fc52b28de566dc0ddaf7245583eec2cc (diff)
downloadrockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.tar.gz
rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.tar.bz2
rockbox-e69d567d9ebf7d236ff9663b11ac396cc71dcd75.zip
Bring consistency to pcm implementation and samplerate handling. Less low-level duplication. A small test_sampr fix so it works on coldfire again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19400 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/sdl/sound.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/uisimulator/sdl/sound.c b/uisimulator/sdl/sound.c
index 5f061695a8..39abc85aca 100644
--- a/uisimulator/sdl/sound.c
+++ b/uisimulator/sdl/sound.c
@@ -33,7 +33,6 @@
#include "SDL.h"
static int cvt_status = -1;
-static unsigned long pcm_frequency = SAMPR_44;
static Uint8* pcm_data;
static size_t pcm_data_size;
@@ -67,28 +66,26 @@ void pcm_play_unlock(void)
SDL_UnlockAudio();
}
-static void pcm_apply_settings_nolock(void)
+static void pcm_dma_apply_settings_nolock(void)
{
- cvt_status = SDL_BuildAudioCVT(&cvt, AUDIO_S16SYS, 2, pcm_frequency,
+ cvt_status = SDL_BuildAudioCVT(&cvt, AUDIO_S16SYS, 2, pcm_sampr,
obtained.format, obtained.channels, obtained.freq);
- pcm_curr_sampr = pcm_frequency;
-
if (cvt_status < 0) {
- cvt.len_ratio = (double)obtained.freq / (double)pcm_curr_sampr;
+ cvt.len_ratio = (double)obtained.freq / (double)pcm_sampr;
}
}
-void pcm_apply_settings(void)
+void pcm_dma_apply_settings(void)
{
pcm_play_lock();
- pcm_apply_settings_nolock();
+ pcm_dma_apply_settings_nolock();
pcm_play_unlock();
}
void pcm_play_dma_start(const void *addr, size_t size)
{
- pcm_apply_settings_nolock();
+ pcm_dma_apply_settings_nolock();
pcm_data = (Uint8 *) addr;
pcm_data_size = size;
@@ -114,30 +111,6 @@ size_t pcm_get_bytes_waiting(void)
return pcm_data_size;
}
-void pcm_set_frequency(unsigned int frequency)
-{
- switch (frequency)
- {
- HW_HAVE_8_( case SAMPR_8:)
- HW_HAVE_11_(case SAMPR_11:)
- HW_HAVE_12_(case SAMPR_12:)
- HW_HAVE_16_(case SAMPR_16:)
- HW_HAVE_22_(case SAMPR_22:)
- HW_HAVE_24_(case SAMPR_24:)
- HW_HAVE_32_(case SAMPR_32:)
- HW_HAVE_44_(case SAMPR_44:)
- HW_HAVE_48_(case SAMPR_48:)
- HW_HAVE_64_(case SAMPR_64:)
- HW_HAVE_88_(case SAMPR_88:)
- HW_HAVE_96_(case SAMPR_96:)
- break;
- default:
- frequency = SAMPR_44;
- }
-
- pcm_frequency = frequency;
-}
-
extern int sim_volume; /* in firmware/sound.c */
void write_to_soundcard(struct pcm_udata *udata) {
if (cvt.needed) {
@@ -357,7 +330,7 @@ void pcm_play_dma_init(void)
pcm_sample_bytes = obtained.channels * pcm_channel_bytes;
- pcm_apply_settings_nolock();
+ pcm_dma_apply_settings_nolock();
}
void pcm_postinit(void)