From 5324a2e769610a4a895b96654d52fe9178a22804 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 13 Mar 2010 12:31:47 +0000 Subject: [PATCH] Fine-tune SDL sound output --- Src/SID_SDL.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Src/SID_SDL.h b/Src/SID_SDL.h index c25a456..c9d9488 100644 --- a/Src/SID_SDL.h +++ b/Src/SID_SDL.h @@ -30,7 +30,7 @@ static SDL_AudioSpec spec; #define FRODO_SNDBUF 512 -#define SOUNDBUFSIZE 2048 +#define SOUNDBUFSIZE 1024 #define N_BUFS 8 static int16 soundbuffer[N_BUFS][FRODO_SNDBUF]; @@ -76,6 +76,7 @@ void DigitalRenderer::init_sound(void) } this->sound_buffer = new int16[this->sndbufsize]; + memset(this->sound_buffer, 0, sizeof(int16) * this->sndbufsize); ready = true; SDL_PauseAudio(0); } @@ -137,12 +138,12 @@ void DigitalRenderer::PushVolume(uint8 vol) int datalen = sndbufsize; to_output -= datalen; - SDL_LockAudio(); calc_buffer(soundbuffer[head], datalen * 2); head = (head + 1) % N_BUFS; - if (head == tail) - printf("Uh oh, hit the tail\n"); + if (head == tail) { + tail = (head + 1) % N_BUFS; + } SDL_UnlockAudio(); } }