From edce2af9fea299965d991f7c4cfa57154e749020 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 10 May 2009 18:16:51 +0000 Subject: [PATCH] Allow setting sound frequency to either 32KHz or 48KHz --- SDL/src/audio/wii/SDL_wiiaudio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SDL/src/audio/wii/SDL_wiiaudio.c b/SDL/src/audio/wii/SDL_wiiaudio.c index b00a573..e037319 100644 --- a/SDL/src/audio/wii/SDL_wiiaudio.c +++ b/SDL/src/audio/wii/SDL_wiiaudio.c @@ -132,8 +132,10 @@ DMACallback() static int WIIAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) { + if (spec->freq != 32000 && spec->freq != 48000) + spec->freq = 32000; + // Set up actual spec. - spec->freq = 48000; spec->format = AUDIO_S16MSB; spec->channels = 2; spec->samples = SAMPLES_PER_DMA_BUFFER; @@ -143,6 +145,11 @@ static int WIIAUD_OpenAudio(_THIS, SDL_AudioSpec *spec) memset(dma_buffers[0], 0, SAMPLES_PER_DMA_BUFFER); memset(dma_buffers[1], 0, SAMPLES_PER_DMA_BUFFER); + if (spec->freq == 32000) + AUDIO_SetDSPSampleRate(AI_SAMPLERATE_32KHZ); + else + AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ); + // startup conversion thread LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 65); @@ -213,7 +220,6 @@ static SDL_AudioDevice *WIIAUD_CreateDevice(int devindex) // Initialise the Wii side of the audio system AUDIO_Init(0); - AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ); AUDIO_RegisterDMACallback(DMACallback); /* Set the function pointers */