spu2x-sdl: memset the stream buffer in SDL2

Fix #382
This commit is contained in:
Gregory Hainaut 2015-10-21 22:13:29 +02:00
parent 53c38ef2cc
commit b6d9ea86ee
1 changed files with 3 additions and 0 deletions

View File

@ -55,6 +55,9 @@ namespace {
void callback_fillBuffer(void *userdata, Uint8 *stream, int len) { void callback_fillBuffer(void *userdata, Uint8 *stream, int len) {
// Length should always be samples in bytes. // Length should always be samples in bytes.
assert(len / sizeof(StereoOut_SDL) == samples); assert(len / sizeof(StereoOut_SDL) == samples);
#if SDL_MAJOR_VERSION >= 2
memset(stream, 0, len);
#endif
for(Uint16 i = 0; i < samples; i += SndOutPacketSize) for(Uint16 i = 0; i < samples; i += SndOutPacketSize)
SndBuffer::ReadSamples(&buffer[i]); SndBuffer::ReadSamples(&buffer[i]);