aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-08-30 20:13:42 -0700
committerChris Robinson <[email protected]>2011-08-30 20:13:42 -0700
commit189add1d5a5b1f9f55fba63937f3d92cddc0cea2 (patch)
tree202a765e0355e2702d9eb9d17ee9200814bf4c21 /Alc
parent755062fb76148d740681eb33046f8f2a7729eab3 (diff)
Use a separate array for the auxiliary slots in the mixer
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c7
-rw-r--r--Alc/ALu.c30
2 files changed, 21 insertions, 16 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index bae464cc..ace230d2 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1358,10 +1358,15 @@ static ALCvoid FreeContext(ALCcontext *context)
}
ResetUIntMap(&context->EffectSlotMap);
+ context->ActiveSourceCount = 0;
free(context->ActiveSources);
context->ActiveSources = NULL;
context->MaxActiveSources = 0;
- context->ActiveSourceCount = 0;
+
+ context->ActiveEffectSlotCount = 0;
+ free(context->ActiveEffectSlots);
+ context->ActiveEffectSlots = NULL;
+ context->MaxActiveEffectSlots = 0;
//Invalidate context
memset(context, 0, sizeof(ALCcontext));
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ae950f32..f2658da7 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -949,12 +949,11 @@ DECL_TEMPLATE(ALbyte)
ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
{
ALuint SamplesToDo;
- ALeffectslot *ALEffectSlot;
+ ALeffectslot **slot, **slot_end;
ALsource **src, **src_end;
ALCcontext *ctx;
int fpuState;
ALuint i, c;
- ALsizei e;
#if defined(HAVE_FESETROUND)
fpuState = fegetround();
@@ -1004,30 +1003,31 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size)
}
/* effect slot processing */
- for(e = 0;e < ctx->EffectSlotMap.size;e++)
+ slot = ctx->ActiveEffectSlots;
+ slot_end = slot + ctx->ActiveEffectSlotCount;
+ while(slot != slot_end)
{
- ALEffectSlot = ctx->EffectSlotMap.array[e].value;
-
for(i = 0;i < SamplesToDo;i++)
{
- ALEffectSlot->WetBuffer[i] += ALEffectSlot->ClickRemoval[0];
- ALEffectSlot->ClickRemoval[0] -= ALEffectSlot->ClickRemoval[0] / 256.0f;
+ (*slot)->WetBuffer[i] += (*slot)->ClickRemoval[0];
+ (*slot)->ClickRemoval[0] -= (*slot)->ClickRemoval[0] / 256.0f;
}
for(i = 0;i < 1;i++)
{
- ALEffectSlot->ClickRemoval[i] += ALEffectSlot->PendingClicks[i];
- ALEffectSlot->PendingClicks[i] = 0.0f;
+ (*slot)->ClickRemoval[i] += (*slot)->PendingClicks[i];
+ (*slot)->PendingClicks[i] = 0.0f;
}
- if(!DeferUpdates && ExchangeInt(&ALEffectSlot->NeedsUpdate, AL_FALSE))
- ALEffect_Update(ALEffectSlot->EffectState, ctx, ALEffectSlot);
+ if(!DeferUpdates && ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE))
+ ALEffect_Update((*slot)->EffectState, ctx, *slot);
- ALEffect_Process(ALEffectSlot->EffectState, ALEffectSlot,
- SamplesToDo, ALEffectSlot->WetBuffer,
- device->DryBuffer);
+ ALEffect_Process((*slot)->EffectState, *slot, SamplesToDo,
+ (*slot)->WetBuffer, device->DryBuffer);
for(i = 0;i < SamplesToDo;i++)
- ALEffectSlot->WetBuffer[i] = 0.0f;
+ (*slot)->WetBuffer[i] = 0.0f;
+
+ slot++;
}
ctx = ctx->next;