diff options
author | Chris Robinson <[email protected]> | 2012-03-13 19:02:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-03-13 19:02:26 -0700 |
commit | 3b517bfa599a589afff2a96f3b169935e1865cb0 (patch) | |
tree | b6a638996263357e31cc68e642028fca9e4146a6 | |
parent | e356527a886dc412e023c3e500f199cd3b9c814e (diff) |
Initialize the default effect after opening the device
-rw-r--r-- | Alc/ALc.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -2622,17 +2622,6 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->NumStereoSources = 1; device->NumMonoSources = device->MaxNoOfSources - device->NumStereoSources; - if(DefaultEffect.type != AL_EFFECT_NULL) - { - device->DefaultSlot = (ALeffectslot*)(device+1); - 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 LockLists(); if((err=ALCdevice_OpenPlayback(device, deviceName)) != ALC_NO_ERROR) @@ -2645,6 +2634,22 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) } UnlockLists(); + if(DefaultEffect.type != AL_EFFECT_NULL) + { + device->DefaultSlot = (ALeffectslot*)(device+1); + if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR) + { + device->DefaultSlot = NULL; + ERR("Failed to initialize the default effect slot\n"); + } + else if(InitializeEffect(device, device->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) + { + ALeffectState_Destroy(device->DefaultSlot->EffectState); + device->DefaultSlot = NULL; + ERR("Failed to initialize the default effect\n"); + } + } + do { device->next = DeviceList; } while(!CompExchangePtr((XchgPtr*)&DeviceList, device->next, device)); |