From a47a22445f111d0d2c89f9772524fd9b69632beb Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Fri, 25 Apr 2014 12:04:11 +0000 Subject: [PATCH] SDL sound instead of ASND sound with WII version --- src/emulator.c | 2 +- src/sound.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/emulator.c b/src/emulator.c index 07da5c3..8bd383b 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -1222,7 +1222,7 @@ int main(int argc,char *argv[]) #ifdef GEKKO dblbuffer=1; hwsurface=1; - sound_type=SOUND_ASND; + //sound_type=SOUND_ASND; //play_click does not work with ASND double buffer setenv("HOME", "/fbzx-wii", 1); //initialize libfat library diff --git a/src/sound.c b/src/sound.c index c31d50f..fc83e6b 100644 --- a/src/sound.c +++ b/src/sound.c @@ -227,14 +227,14 @@ int sound_init_sdl() { SDL_AudioSpec fmt; ordenador.sign=0; - ordenador.format=1; //16 bit + ordenador.format=1; //16 bit LE ordenador.channels=2; //stereo ordenador.freq=48000; ordenador.buffer_len=4096; /* Set 16-bit stereo audio at 48Khz */ fmt.freq = ordenador.freq; - fmt.format = AUDIO_U16LSB; //unsigned Little endian + fmt.format = AUDIO_S16SYS; //signed Little endian/Big endian fmt.channels = ordenador.channels; fmt.samples = ordenador.buffer_len; //number of samples fmt.callback = sdlcallback; @@ -244,6 +244,17 @@ int sound_init_sdl() { /* Open the audio device and start playing sound! */ if (SDL_OpenAudio(&fmt, NULL) < 0 ) return -1; + + printf("SDL audio initiated\n"); + + ordenador.freq = fmt.freq; + ordenador.channels = fmt.channels; + ordenador.buffer_len = fmt.samples; //number of samples + + printf("freq = %d\n",fmt.freq); + printf("channels = %d\n",fmt.channels); + printf("buffer_len = %d\n",fmt.samples); + printf("format = %x\n",fmt.format); return 0; } @@ -258,7 +269,7 @@ int sound_init_asnd() { ASND_Init(); ASND_Pause(0); ordenador.sign=0; - ordenador.format=1; //16 bit + ordenador.format=2; //16 bit BE ordenador.channels=2; //stereo ordenador.freq=48000; ordenador.buffer_len=4096;