From 6e7ab3558a6aa08bf1130ee6fab8ac97f692dbce Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 27 May 2017 12:29:36 +0300 Subject: [PATCH] Use a smaller audio buffer size if supported. --- SDL/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SDL/main.c b/SDL/main.c index 21f18db5..8105927f 100755 --- a/SDL/main.c +++ b/SDL/main.c @@ -477,7 +477,13 @@ usage: want_aspec.freq = AUDIO_FREQUENCY; want_aspec.format = AUDIO_S16SYS; want_aspec.channels = 2; +#if SDL_COMPILEDVERSION == 2005 && defined(__APPLE__) + /* SDL 2.0.5 on macOS introduced a bug where certain combinations of buffer lengths and frequencies + fail to produce audio correctly. This bug was fixed 2.0.6. */ want_aspec.samples = 2048; +#else + want_aspec.samples = 512; +#endif want_aspec.callback = audio_callback; want_aspec.userdata = &gb; SDL_OpenAudio(&want_aspec, &have_aspec);