Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Explicitly write silence to the audio device while it is paused.
This is what SDL 1.2 did; we'll do this properly (add a method for the target
 driver to pause) when I rewrite all this code after the official 2.0 release.

Fixes Bugzilla #1857.
  • Loading branch information
icculus committed Jul 12, 2013
1 parent f1306b1 commit 8b3d1fc3b8e9e76f58001051e8d72c8e17152657
Showing with 8 additions and 3 deletions.
  1. +8 −3 src/audio/SDL_audio.c
@@ -461,6 +461,7 @@ SDL_RunAudio(void *devicep)
}
} else {
/* Otherwise, do not use the streamer. This is the old code. */
const int silence = (int) device->spec.silence;

/* Loop, filling the audio buffers */
while (device->enabled) {
@@ -484,9 +485,13 @@ SDL_RunAudio(void *devicep)
}
}

SDL_LockMutex(device->mixer_lock);
(*fill) (udata, stream, stream_len);
SDL_UnlockMutex(device->mixer_lock);
if (device->paused) {
SDL_memset(stream, silence, stream_len);
} else {
SDL_LockMutex(device->mixer_lock);
(*fill) (udata, stream, stream_len);
SDL_UnlockMutex(device->mixer_lock);
}

/* Convert the audio if necessary */
if (device->convert.needed) {

0 comments on commit 8b3d1fc

Please sign in to comment.