From 5980b0b9abb77c7a2a5b4709de0255fb6db03a48 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 5 Jan 2018 13:37:00 +0100 Subject: [PATCH] openal: fix warning spam every frame in newer AL implementations This fixes error messages being generated of the form: AL lib: (WW) alSetError: Error generated on context 0x801cf8800, code 0xa003 This is caused by alSourceUnqueueBuffers being called without first checking whether processed buffers are available using alGetSourcei. Fixes #180 --- panda/src/audiotraits/openalAudioSound.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/panda/src/audiotraits/openalAudioSound.cxx b/panda/src/audiotraits/openalAudioSound.cxx index da379bfd5c..9abaf24036 100644 --- a/panda/src/audiotraits/openalAudioSound.cxx +++ b/panda/src/audiotraits/openalAudioSound.cxx @@ -435,7 +435,11 @@ pull_used_buffers() { ReMutexHolder holder(OpenALAudioManager::_lock); while (_stream_queued.size()) { ALuint buffer = 0; - alGetError(); + ALint num_buffers = 0; + alGetSourcei(_source, AL_BUFFERS_PROCESSED, &num_buffers); + if (num_buffers <= 0) { + break; + } alSourceUnqueueBuffers(_source, 1, &buffer); int err = alGetError(); if (err == AL_NO_ERROR) {