diff options
author | Chris Robinson <[email protected]> | 2011-09-12 01:11:46 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-12 01:11:46 -0700 |
commit | 1d6ecee64f528cbce78dd3b6d8f047decf431938 (patch) | |
tree | 7064d8b73cfa52cbf3f9505484273de6b8316d85 | |
parent | 3ee2826565b76474282879ff741c0f2a70bda4a8 (diff) |
Use the active source list when stopping sources on disconnect
-rw-r--r-- | Alc/ALu.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -1107,22 +1107,22 @@ ALvoid aluHandleDisconnect(ALCdevice *device) Context = device->ContextList; while(Context) { - ALsource *source; - ALsizei pos; + ALsource **src, **src_end; - LockUIntMapRead(&Context->SourceMap); - for(pos = 0;pos < Context->SourceMap.size;pos++) + src = Context->ActiveSources; + src_end = src + Context->ActiveSourceCount; + while(src != src_end) { - source = Context->SourceMap.array[pos].value; - if(source->state == AL_PLAYING) + if((*src)->state == AL_PLAYING) { - source->state = AL_STOPPED; - source->BuffersPlayed = source->BuffersInQueue; - source->position = 0; - source->position_fraction = 0; + (*src)->state = AL_STOPPED; + (*src)->BuffersPlayed = (*src)->BuffersInQueue; + (*src)->position = 0; + (*src)->position_fraction = 0; } + src++; } - UnlockUIntMapRead(&Context->SourceMap); + Context->ActiveSourceCount = 0; Context = Context->next; } |