diff options
author | Chris Robinson <[email protected]> | 2017-07-13 22:33:13 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-07-13 22:35:37 -0700 |
commit | 249afde5f9363384649fc3993bde9dc26c75df4c (patch) | |
tree | 125624491d70b7c8388f11c211cc7b8f73708b04 /Alc | |
parent | a535169bbdd6766cbc6b53188065fbee6d4da1bc (diff) |
Initialize the default effect after device update
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 66 |
1 files changed, 31 insertions, 35 deletions
@@ -3617,33 +3617,10 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ATOMIC_INIT(&ALContext->ActiveAuxSlots, NULL); ALContext->Device = device; - if(DefaultEffect.type != AL_EFFECT_NULL) - { - ALContext->DefaultSlot = (ALeffectslot*)(ALContext->_listener_mem + sizeof(ALlistener)); - if(InitEffectSlot(ALContext->DefaultSlot) != AL_NO_ERROR) - { - ALContext->DefaultSlot = NULL; - ERR("Failed to initialize the default effect slot\n"); - } - else - { - aluInitEffectPanning(ALContext->DefaultSlot); - if(InitializeEffect(device, ALContext->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) - { - DeinitEffectSlot(ALContext->DefaultSlot); - ALContext->DefaultSlot = NULL; - ERR("Failed to initialize the default effect\n"); - } - } - } - if((err=UpdateDeviceParams(device, attrList)) != ALC_NO_ERROR) { almtx_unlock(&device->BackendLock); - al_free(ALContext->Voices); - ALContext->Voices = NULL; - al_free(ALContext); ALContext = NULL; @@ -3659,22 +3636,41 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin } AllocateVoices(ALContext, 256, device->NumAuxSends); - if(ALContext->DefaultSlot) + if(DefaultEffect.type != AL_EFFECT_NULL && device->Type == Playback) { - ALeffectslot *slot = ALContext->DefaultSlot; - ALeffectState *state = slot->Effect.State; - - START_MIXER_MODE(); - state->OutBuffer = device->Dry.Buffer; - state->OutChannels = device->Dry.NumChannels; - if(V(state,deviceUpdate)(device) != AL_FALSE) - UpdateEffectSlotProps(slot); - else + ALContext->DefaultSlot = (ALeffectslot*)(ALContext->_listener_mem + sizeof(ALlistener)); + if(InitEffectSlot(ALContext->DefaultSlot) != AL_NO_ERROR) { - DeinitEffectSlot(ALContext->DefaultSlot); ALContext->DefaultSlot = NULL; + ERR("Failed to initialize the default effect slot\n"); + } + else + { + aluInitEffectPanning(ALContext->DefaultSlot); + if(InitializeEffect(device, ALContext->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) + { + DeinitEffectSlot(ALContext->DefaultSlot); + ALContext->DefaultSlot = NULL; + ERR("Failed to initialize the default effect\n"); + } + } + if(ALContext->DefaultSlot) + { + ALeffectslot *slot = ALContext->DefaultSlot; + ALeffectState *state = slot->Effect.State; + + START_MIXER_MODE(); + state->OutBuffer = device->Dry.Buffer; + state->OutChannels = device->Dry.NumChannels; + if(V(state,deviceUpdate)(device) != AL_FALSE) + UpdateEffectSlotProps(slot); + else + { + DeinitEffectSlot(ALContext->DefaultSlot); + ALContext->DefaultSlot = NULL; + } + END_MIXER_MODE(); } - END_MIXER_MODE(); } ALCdevice_IncRef(ALContext->Device); |