From da2429a1d0ad184abe24f61aa7e064b81026651c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 16 Jul 2011 02:41:02 -0700 Subject: Allow effect slots to be updated asynchronously Updates when the slot changes effect type is still sychronous, however, to ensure a proper state for the Process method call. Fixing this would essentially require all effects to work from the same state. --- Alc/ALc.c | 5 +++-- Alc/ALu.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'Alc') diff --git a/Alc/ALc.c b/Alc/ALc.c index 0a025bf6..5af83f70 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1414,6 +1414,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ALCcontext *context = device->Contexts[i]; ALsizei pos; + context->UpdateSources = AL_FALSE; for(pos = 0;pos < context->EffectSlotMap.size;pos++) { ALeffectslot *slot = context->EffectSlotMap.array[pos].value; @@ -1425,6 +1426,7 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->Flags &= ~DEVICE_RUNNING; return ALC_FALSE; } + slot->NeedsUpdate = AL_FALSE; ALEffect_Update(slot->EffectState, context, &slot->effect); } @@ -1441,10 +1443,9 @@ static ALCboolean UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) source->Send[s].WetFilter.filter = 0; s++; } - ALsource_Update(source, context); source->NeedsUpdate = AL_FALSE; + ALsource_Update(source, context); } - context->UpdateSources = AL_FALSE; } UnlockDevice(device); diff --git a/Alc/ALu.c b/Alc/ALu.c index 04d894e1..dff205dd 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -1031,6 +1031,12 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) ALEffectSlot->PendingClicks[i] = 0.0f; } + if(ALEffectSlot->NeedsUpdate) + { + ALEffectSlot->NeedsUpdate = AL_FALSE; + ALEffect_Update(ALEffectSlot->EffectState, *ctx, &ALEffectSlot->effect); + } + ALEffect_Process(ALEffectSlot->EffectState, ALEffectSlot, SamplesToDo, ALEffectSlot->WetBuffer, device->DryBuffer); -- cgit v1.2.3