From 1d6ecee64f528cbce78dd3b6d8f047decf431938 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 12 Sep 2011 01:11:46 -0700 Subject: Use the active source list when stopping sources on disconnect --- Alc/ALu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index 716b6fb4..4b4f6778 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -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; } -- cgit v1.2.3