git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 7a24073f6d6376b3279ca030c82f0f57144707cf
parent 64db300f241a3f01610c2a3bfb31f7643104675b
Author: Maximilian Mader <max@bastelstu.be>
Date:   Wed, 13 Jul 2022 15:51:37 +0200

Make sure that `AL_BUFFERS_PROCESSED` returns a valid value in `_audio_deinit()`

Diffstat:
MSDL/audio/openal.c13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/SDL/audio/openal.c b/SDL/audio/openal.c @@ -59,13 +59,16 @@ static void _audio_deinit(void) { // Stop the source (this should mark all queued buffers as processed) alSourceStop(al_source); - // Free the processed buffers while ignoring potential errors + // Check if there are buffers that can be freed ALint processed; alGetSourcei(al_source, AL_BUFFERS_PROCESSED, &processed); - while (processed--) { - ALuint buffer; - alSourceUnqueueBuffers(al_source, 1, &buffer); - alDeleteBuffers(1, &buffer); + if (!AL_ERROR("Failed to query number of processed buffers")) { + // Try to free the buffers, we do not care about potential errors here + while (processed--) { + ALuint buffer; + alSourceUnqueueBuffers(al_source, 1, &buffer); + alDeleteBuffers(1, &buffer); + } } alDeleteSources(1, &al_source);

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.