diff options
author | Chris Robinson <[email protected]> | 2012-03-13 15:07:38 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-03-13 15:07:38 -0700 |
commit | f7f1dd1346e66e58e474a1c6aba746cedeb43ab8 (patch) | |
tree | e3e41a1063e62b453b82ad8ef94460b2ecb5e83f /Alc/ALc.c | |
parent | 92ccacdc77ff20feae721fc574982a50707fb3d3 (diff) |
Initialize the default effect when opening the device and update it with the other effect slots
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -1332,6 +1332,19 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) context = context->next; } + if(device->DefaultSlot) + { + ALeffectslot *slot = device->DefaultSlot; + + if(ALeffectState_DeviceUpdate(slot->EffectState, device) == AL_FALSE) + { + UnlockDevice(device); + RestoreFPUMode(oldMode); + return ALC_INVALID_DEVICE; + } + slot->NeedsUpdate = AL_FALSE; + ALeffectState_Update(slot->EffectState, device, slot); + } UnlockDevice(device); RestoreFPUMode(oldMode); @@ -2296,10 +2309,6 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin } while(!CompExchangePtr((XchgPtr*)&device->ContextList, ALContext->next, ALContext)); UnlockLists(); - if(device->DefaultSlot) - InitializeEffect(device, device->DefaultSlot, &DefaultEffect); - ALContext->LastError = AL_NO_ERROR; - ALCdevice_DecRef(device); TRACE("Created context %p\n", ALContext); @@ -2618,8 +2627,12 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(DefaultEffect.type != AL_EFFECT_NULL) { device->DefaultSlot = (ALeffectslot*)(device+1); - if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR) + if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR || + InitializeEffect(device, device->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) + { device->DefaultSlot = NULL; + ERR("Failed to initialize the default effect\n"); + } } // Find a playback device to open |