Set AL_STOPPED after setting AL_PLAYING when a source has nothing to play

This commit is contained in:
Chris Robinson
2011-10-15 10:33:30 -07:00
parent 0fba3b0e1e
commit 628356a294
+8 -8
View File
@@ -1871,14 +1871,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
BufferList = BufferList->next;
}
/* If there's nothing to play, or device is disconnected, go right to
* stopped */
if(!BufferList || !Context->Device->Connected)
{
SetSourceState(Source, Context, AL_STOPPED);
return;
}
if(Source->state != AL_PLAYING)
{
for(j = 0;j < MAXCHANNELS;j++)
@@ -1907,6 +1899,14 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
if(Source->lOffset != -1)
ApplyOffset(Source);
/* If there's nothing to play, or device is disconnected, go right to
* stopped */
if(!BufferList || !Context->Device->Connected)
{
SetSourceState(Source, Context, AL_STOPPED);
return;
}
for(j = 0;j < Context->ActiveSourceCount;j++)
{
if(Context->ActiveSources[j] == Source)