mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
Fix raw samples playback with newer openal-soft versions.
Newer openal-soft versions changed the way how the processed buffers are counted when in AL_STOPPED state. Previously only processed buffers were counted, now all buffers are. Change our unqueue logic to match this new behavior. This was debugged and fixed @xorw, I'm just committing the patch. This closes issue #185.
This commit is contained in:
parent
9bc980811f
commit
12fba237c2
1 changed files with 17 additions and 14 deletions
|
@ -90,25 +90,28 @@ AL_StreamUpdate(void)
|
|||
int numBuffers;
|
||||
ALint state;
|
||||
|
||||
/* Un-queue any buffers, and delete them */
|
||||
qalGetSourcei(streamSource, AL_BUFFERS_PROCESSED, &numBuffers);
|
||||
|
||||
while (numBuffers--)
|
||||
{
|
||||
ALuint buffer;
|
||||
qalSourceUnqueueBuffers(streamSource, 1, &buffer);
|
||||
qalDeleteBuffers(1, &buffer);
|
||||
active_buffers--;
|
||||
}
|
||||
|
||||
/* Start the streamSource playing if necessary */
|
||||
qalGetSourcei(streamSource, AL_BUFFERS_QUEUED, &numBuffers);
|
||||
qalGetSourcei(streamSource, AL_SOURCE_STATE, &state);
|
||||
|
||||
if (state == AL_STOPPED)
|
||||
{
|
||||
streamPlaying = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Un-queue any already pleyed buffers and delete them */
|
||||
qalGetSourcei(streamSource, AL_BUFFERS_PROCESSED, &numBuffers);
|
||||
|
||||
while (numBuffers--)
|
||||
{
|
||||
ALuint buffer;
|
||||
qalSourceUnqueueBuffers(streamSource, 1, &buffer);
|
||||
qalDeleteBuffers(1, &buffer);
|
||||
active_buffers--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Start the streamSource playing if necessary */
|
||||
qalGetSourcei(streamSource, AL_BUFFERS_QUEUED, &numBuffers);
|
||||
|
||||
if (!streamPlaying && numBuffers)
|
||||
{
|
||||
|
@ -665,7 +668,7 @@ AL_Update(void)
|
|||
AL_StreamUpdate();
|
||||
AL_IssuePlaysounds();
|
||||
|
||||
oal_update_underwater();
|
||||
oal_update_underwater();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in a new issue