Skip to content

Commit

Permalink
sdl2: Fix broken audio in MVE playback.
Browse files Browse the repository at this point in the history
This doesn't fix the audio gaps, just the static introduced in the SDL2 port.

SDL2 does not initialize the audio callback's buffer, unlike SDL 1.2, under
the assumption the callback is going to fully write it anyhow. But since
the movie player wants to mix against the current contents of the buffer,
we need to explicitly initialize it to silence first.
  • Loading branch information
icculus committed May 5, 2024
1 parent ff571ed commit 65b1a7d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libmve/lnxdsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,8 @@ static void LinuxSoundMixBuffersIntoMain(int len) {
}

static void LinuxSoundThreadHandler(void *unused, Uint8 *stream, int len) {
SDL_memset(stream, '\0', len);

LnxBuffers[0]->buffer = stream;
LnxBuffers[0]->buffer_len = len;
LnxBuffers[0]->play_cursor = 0;
Expand Down

0 comments on commit 65b1a7d

Please sign in to comment.