diff options
author | Chris Robinson <[email protected]> | 2009-10-20 12:53:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-10-20 12:53:07 -0700 |
commit | 9c0ae597cd371fdd047500abea879cd1d090a36d (patch) | |
tree | f3e65c1ca16a2b4a82ae8d7cf6f200115bdd351c /Alc/ALc.c | |
parent | 4461b4c56f784de375dcd37651fa4a8c740ad1b2 (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
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -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) |