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
This commit is contained in:
Chris Robinson
2009-10-20 12:53:07 -07:00
parent 4461b4c56f
commit 9c0ae597cd
+37
View File
@@ -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)