mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-04 21:43:34 +00:00
Audio source: unqueue before playing
This commit is contained in:
parent
a274eb05d1
commit
e85a9b74c6
|
@ -170,6 +170,12 @@ void lovrSourcePlay(Source* source) {
|
|||
lovrAudioStreamRewind(source->stream);
|
||||
}
|
||||
|
||||
// in case we have some queued buffers, make sure to unqueue them before streaming more data into them.
|
||||
ALint processed;
|
||||
alGetSourcei(lovrSourceGetId(source), AL_BUFFERS_PROCESSED, &processed);
|
||||
ALuint buffers[SOURCE_BUFFERS];
|
||||
alSourceUnqueueBuffers(source->id, processed, buffers);
|
||||
|
||||
lovrSourceStream(source, source->buffers, SOURCE_BUFFERS);
|
||||
alSourcePlay(source->id);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue