diff options
author | Chris Robinson <[email protected]> | 2011-08-30 20:13:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-30 20:13:42 -0700 |
commit | 189add1d5a5b1f9f55fba63937f3d92cddc0cea2 (patch) | |
tree | 202a765e0355e2702d9eb9d17ee9200814bf4c21 /Alc | |
parent | 755062fb76148d740681eb33046f8f2a7729eab3 (diff) |
Use a separate array for the auxiliary slots in the mixer
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 7 | ||||
-rw-r--r-- | Alc/ALu.c | 30 |
2 files changed, 21 insertions, 16 deletions
@@ -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)); @@ -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; |