summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-13 19:02:26 -0700
committerChris Robinson <[email protected]>2012-03-13 19:02:26 -0700
commit3b517bfa599a589afff2a96f3b169935e1865cb0 (patch)
treeb6a638996263357e31cc68e642028fca9e4146a6
parente356527a886dc412e023c3e500f199cd3b9c814e (diff)
Initialize the default effect after opening the device
-rw-r--r--Alc/ALc.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index c2c3cebd..001ab4a6 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -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));