aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-20 12:53:07 -0700
committerChris Robinson <[email protected]>2009-10-20 12:53:07 -0700
commit9c0ae597cd371fdd047500abea879cd1d090a36d (patch)
treef3e65c1ca16a2b4a82ae8d7cf6f200115bdd351c
parent4461b4c56f784de375dcd37651fa4a8c740ad1b2 (diff)
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
-rw-r--r--Alc/ALc.c37
1 files changed, 37 insertions, 0 deletions
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)