1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-02 20:43:35 +00:00

Audio source: unqueue before playing

This commit is contained in:
Nevyn Bengtsson 2020-01-04 01:58:03 +01:00
parent a274eb05d1
commit e85a9b74c6

View file

@ -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);
}