mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-16 18:53:36 +00:00
Source: Stop, then unqueue buffers
Doing it the other way around is illegal; you may not unqueue unprocessed buffers, so we need to stop first.
This commit is contained in:
parent
b3fb31f5a4
commit
1db932d856
|
@ -281,15 +281,15 @@ void lovrSourceStop(Source* source) {
|
||||||
|
|
||||||
case SOURCE_STREAM: {
|
case SOURCE_STREAM: {
|
||||||
|
|
||||||
|
// Stop the source
|
||||||
|
alSourceStop(source->id);
|
||||||
|
alSourcei(source->id, AL_BUFFER, AL_NONE);
|
||||||
|
|
||||||
// Empty the buffers
|
// Empty the buffers
|
||||||
int count = 0;
|
int count = 0;
|
||||||
alGetSourcei(source->id, AL_BUFFERS_QUEUED, &count);
|
alGetSourcei(source->id, AL_BUFFERS_QUEUED, &count);
|
||||||
alSourceUnqueueBuffers(source->id, count, NULL);
|
alSourceUnqueueBuffers(source->id, count, NULL);
|
||||||
|
|
||||||
// Stop the source
|
|
||||||
alSourceStop(source->id);
|
|
||||||
alSourcei(source->id, AL_BUFFER, AL_NONE);
|
|
||||||
|
|
||||||
// Rewind the decoder
|
// Rewind the decoder
|
||||||
if (!lovrAudioStreamIsRaw(source->stream)) {
|
if (!lovrAudioStreamIsRaw(source->stream)) {
|
||||||
lovrAudioStreamRewind(source->stream);
|
lovrAudioStreamRewind(source->stream);
|
||||||
|
|
Loading…
Reference in a new issue