From ae47fb63df4d086ca4199c386a1bfba25523d4c8 Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Wed, 15 Jul 2020 10:19:41 -0400 Subject: [PATCH] fix chirp on startup --- sdl/sdl-speaker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdl/sdl-speaker.cpp b/sdl/sdl-speaker.cpp index a585f60..014d885 100644 --- a/sdl/sdl-speaker.cpp +++ b/sdl/sdl-speaker.cpp @@ -15,10 +15,12 @@ extern "C" #include "globals.h" -#define SDLSIZE (4096) +#define SDLSIZE (2048) // But we want to keep more than just that, so we can fill it full every time #define CACHEMULTIPLIER 2 +#define WATERLEVEL SDLSIZE + // FIXME: Globals; ick. static volatile uint32_t bufIdx = 0; static volatile short soundBuf[CACHEMULTIPLIER*SDLSIZE]; @@ -50,7 +52,7 @@ static void audioCallback(void *unused, Uint8 *stream, int len) return; } - if (audioRunning==1 && bufIdx >= SDLSIZE) { + if (audioRunning==1 && bufIdx >= WATERLEVEL) { // Fully up and running now; we got a full cache audioRunning = 2; } else if (audioRunning==1) {