Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Linux: Correct misuse of SDL_MixAudio

Campbell Bartoncbcab0b54ee5
diff --git a/toonz/sources/common/tsound/tsound_sdl.cpp b/toonz/sources/common/tsound/tsound_sdl.cpp
index 705f1e60a..933f3e19b 100644
--- a/toonz/sources/common/tsound/tsound_sdl.cpp
+++ b/toonz/sources/common/tsound/tsound_sdl.cpp
@@ -133,12 +133,8 @@ static void sdl_fill_audio(void *udata, Uint8 *stream, int len) {
}
/* Mix as much data as possible */
- len = (len > audio_len ? audio_len : len);
-
- // Mix with silence if we're not at full volume
- if (_this->m_volume != SDL_MIX_MAXVOLUME) {
- SDL_memset(stream, 0, len);
- }
+ len = min(audio_len, len);
+ SDL_memset(stream, 0, len);
SDL_MixAudio(stream, (Uint8 *)myData->entireFileBuffer + myData->byteOffset,
len, _this->m_volume);
myData->byteOffset += len;