aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-07-19 18:26:46 -0700
committerChris Robinson <[email protected]>2017-07-19 18:26:46 -0700
commitf91445029de76890ff3d917e4c7867e61de1e3fd (patch)
tree3565d476a6fc596fc251679aebe3ea540094fbb9 /Alc/ALc.c
parentfea74124c88e00a27e51b89fdb769d2467bda0e7 (diff)
Fix default effect initialization
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c39
1 files changed, 11 insertions, 28 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index ccad718b..8c032ddf 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -3648,38 +3648,13 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
if(DefaultEffect.type != AL_EFFECT_NULL && device->Type == Playback)
{
ALContext->DefaultSlot = (ALeffectslot*)(ALContext->_listener_mem + sizeof(ALlistener));
- if(InitEffectSlot(ALContext->DefaultSlot) != AL_NO_ERROR)
+ if(InitEffectSlot(ALContext->DefaultSlot) == AL_NO_ERROR)
+ aluInitEffectPanning(ALContext->DefaultSlot);
+ else
{
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();
- }
}
ALCdevice_IncRef(ALContext->Device);
@@ -3709,6 +3684,14 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin
}
almtx_unlock(&device->BackendLock);
+ if(ALContext->DefaultSlot)
+ {
+ if(InitializeEffect(device, ALContext->DefaultSlot, &DefaultEffect) == AL_NO_ERROR)
+ UpdateEffectSlotProps(ALContext->DefaultSlot);
+ else
+ ERR("Failed to initialize the default effect\n");
+ }
+
ALCdevice_DecRef(device);
TRACE("Created context %p\n", ALContext);