ref: 0fb147aa0d43277c6420681d69b76f0262d06788
parent: d2b5872c95e7c0970fdf81e16397ab497763b89b
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed May 29 14:49:09 EDT 2019
Change the sound buffer size to a power of 2 Turns out giving SDL2 a non-power-of-2 buffer size crashes it in Emscripten.
--- a/src/Sound.cpp
+++ b/src/Sound.cpp
@@ -16,9 +16,9 @@
#define FREQUENCY 44100
#ifdef RASPBERRY_PI
-#define STREAM_SIZE 0x400
+#define STREAM_SIZE 0x400 // Larger buffer to prevent stutter
#else
-#define STREAM_SIZE (FREQUENCY / 200)
+#define STREAM_SIZE 0x100 // FREQUENCY/200 rounded to the nearest power of 2 (SDL2 *needs* a power-of-2 buffer size)
#endif
#define clamp(x, y, z) (((x) > (z)) ? (z) : ((x) < (y)) ? (y) : (x))