From b6d9ea86ee838bd7d54ea35d45759f510b34faf4 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 21 Oct 2015 22:13:29 +0200 Subject: [PATCH] spu2x-sdl: memset the stream buffer in SDL2 Fix #382 --- plugins/spu2-x/src/SndOut_SDL.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/spu2-x/src/SndOut_SDL.cpp b/plugins/spu2-x/src/SndOut_SDL.cpp index e29e6ef6f4..b37693090f 100644 --- a/plugins/spu2-x/src/SndOut_SDL.cpp +++ b/plugins/spu2-x/src/SndOut_SDL.cpp @@ -55,6 +55,9 @@ namespace { void callback_fillBuffer(void *userdata, Uint8 *stream, int len) { // Length should always be samples in bytes. assert(len / sizeof(StereoOut_SDL) == samples); +#if SDL_MAJOR_VERSION >= 2 + memset(stream, 0, len); +#endif for(Uint16 i = 0; i < samples; i += SndOutPacketSize) SndBuffer::ReadSamples(&buffer[i]);