From 9c0ae597cd371fdd047500abea879cd1d090a36d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Oct 2009 12:53:07 -0700 Subject: [PATCH] Make sure the effect slots and source sends are properly updated Slots need to be updated due to possible frequency changes, and source sends need to be updated in case some active sends were disabled --- Alc/ALc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Alc/ALc.c b/Alc/ALc.c index 1274b824..6eeb3bd8 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1124,6 +1124,7 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint ALuint attrIdx, reqStereoSources; ALCcontext *ALContext; void *temp; + ALuint i; SuspendContext(NULL); @@ -1199,6 +1200,42 @@ ALCAPI ALCcontext* ALCAPIENTRY alcCreateContext(ALCdevice *device, const ALCint return NULL; } + for(i = 0;i < device->NumContexts;i++) + { + ALeffectslot *slot; + ALsource *source; + for(slot = device->Contexts[i]->AuxiliaryEffectSlot;slot != NULL; + slot = slot->next) + { + if(!slot->EffectState) + continue; + + if(ALEffect_DeviceUpdate(slot->EffectState, device) == AL_FALSE) + { + alcSetError(ALC_INVALID_DEVICE); + aluHandleDisconnect(device); + ProcessContext(NULL); + ALCdevice_StopPlayback(device); + return NULL; + } + ALEffect_Update(slot->EffectState, device->Contexts[i], &slot->effect); + } + + for(source = device->Contexts[i]->Source;source != NULL;source = source->next) + { + ALuint s = device->NumAuxSends; + while(s < MAX_SENDS) + { + if(source->Send[s].Slot) + source->Send[s].Slot->refcount--; + source->Send[s].Slot = NULL; + source->Send[s].WetFilter.type = 0; + source->Send[s].WetFilter.filter = 0; + s++; + } + } + } + if(device->Bs2bLevel > 0 && device->Bs2bLevel <= 6) { if(!device->Bs2b) -- 2.11.4.GIT