aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-03-18 19:56:25 -0700
committerChris Robinson <[email protected]>2014-03-18 19:56:25 -0700
commitd6f7aac1bbc2c51dbe53e30a50275d550a020df6 (patch)
treeeff721968bc56422bca8e565c3842d1c1422bcc8 /Alc/ALu.c
parent71b177918d2e5864edf45088bf1e5f59d2cd8871 (diff)
Use a separate struct for tracking active sources
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 5e1965f9..6c92bf5d 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1025,7 +1025,7 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
ALuint SamplesToDo;
ALeffectslot **slot, **slot_end;
- ALsource **src, **src_end;
+ ALactivesource **src, **src_end;
ALCcontext *ctx;
FPUCtl oldMode;
ALuint i, c;
@@ -1058,18 +1058,22 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
src_end = src + ctx->ActiveSourceCount;
while(src != src_end)
{
- if((*src)->state != AL_PLAYING)
+ ALsource *source = (*src)->Source;
+
+ if(source->state != AL_PLAYING)
{
+ ALactivesource *temp = *(--src_end);
+ *src_end = *src;
+ *src = temp;
--(ctx->ActiveSourceCount);
- *src = *(--src_end);
continue;
}
- if(!DeferUpdates && (ExchangeInt(&(*src)->NeedsUpdate, AL_FALSE) ||
+ if(!DeferUpdates && (ExchangeInt(&source->NeedsUpdate, AL_FALSE) ||
UpdateSources))
- ALsource_Update(*src, ctx);
+ ALsource_Update(source, ctx);
- MixSource(*src, device, SamplesToDo);
+ MixSource(source, device, SamplesToDo);
src++;
}
@@ -1233,18 +1237,19 @@ ALvoid aluHandleDisconnect(ALCdevice *device)
Context = device->ContextList;
while(Context)
{
- ALsource **src, **src_end;
+ ALactivesource **src, **src_end;
src = Context->ActiveSources;
src_end = src + Context->ActiveSourceCount;
while(src != src_end)
{
- if((*src)->state == AL_PLAYING)
+ ALsource *source = (*src)->Source;
+ if(source->state == AL_PLAYING)
{
- (*src)->state = AL_STOPPED;
- (*src)->BuffersPlayed = (*src)->BuffersInQueue;
- (*src)->position = 0;
- (*src)->position_fraction = 0;
+ source->state = AL_STOPPED;
+ source->BuffersPlayed = source->BuffersInQueue;
+ source->position = 0;
+ source->position_fraction = 0;
}
src++;
}