diff options
author | Chris Robinson <[email protected]> | 2011-06-17 13:21:02 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-06-17 13:21:02 -0700 |
commit | 23ae3c69b5ffb5ac24567e618df2b0404e37748d (patch) | |
tree | bdb7b20397862b3f13be3cbebd42fc4ac59e6d12 /OpenAL32/alSource.c | |
parent | bef9c5e2d56a9a060b4f3423624a6a0c3caadfae (diff) |
Handle the device's disconnected status earlier when playing a source
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index fd163804..9486915e 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1357,7 +1357,9 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) BufferList = BufferList->next; } - if(!BufferList) + /* If there's nothing to play, or device is disconnected, go right to + * stopped */ + if(!BufferList || !Context->Device->Connected) { Source->state = AL_STOPPED; Source->BuffersPlayed = Source->BuffersInQueue; @@ -1394,24 +1396,13 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) if(Source->lOffset) ApplyOffset(Source); - // If device is disconnected, go right to stopped - if(!Context->Device->Connected) + for(j = 0;j < Context->ActiveSourceCount;j++) { - Source->state = AL_STOPPED; - Source->BuffersPlayed = Source->BuffersInQueue; - Source->position = 0; - Source->position_fraction = 0; - } - else - { - for(j = 0;j < Context->ActiveSourceCount;j++) - { - if(Context->ActiveSources[j] == Source) - break; - } - if(j == Context->ActiveSourceCount) - Context->ActiveSources[Context->ActiveSourceCount++] = Source; + if(Context->ActiveSources[j] == Source) + break; } + if(j == Context->ActiveSourceCount) + Context->ActiveSources[Context->ActiveSourceCount++] = Source; } done: |