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
This commit is contained in:
rdb 2018-01-05 13:37:00 +01:00
parent 1073f5abde
commit 5980b0b9ab
1 changed files with 5 additions and 1 deletions

View File

@ -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) {