diff options
author | Chris Robinson <[email protected]> | 2009-05-31 11:54:49 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-05-31 11:54:49 -0700 |
commit | 3c122b0bef6f718f2a55e0b27f712e7accf89376 (patch) | |
tree | 10cb82b38f2b870f5d5cba442f48950c1e434afd /OpenAL32/alAuxEffectSlot.c | |
parent | 7940003d0624d76e798523577d3d97cf99b73c83 (diff) |
Set an error if effect creation fails
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r-- | OpenAL32/alAuxEffectSlot.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c index 62d153c1..f606a099 100644 --- a/OpenAL32/alAuxEffectSlot.c +++ b/OpenAL32/alAuxEffectSlot.c @@ -471,9 +471,22 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, { if((!effect) || (effect->type != ALEffectSlot->effect.type)) { + ALeffectState *NewState = NULL; + if(effect) + { + if(effect->type == AL_EFFECT_EAXREVERB) + NewState = EAXVerbCreate(Context); + else if(effect->type == AL_EFFECT_REVERB) + NewState = VerbCreate(Context); + else if(effect->type == AL_EFFECT_ECHO) + NewState = EchoCreate(Context); + /* No new state? An error occured.. */ + if(!NewState) + return; + } if(ALEffectSlot->EffectState) ALEffect_Destroy(ALEffectSlot->EffectState); - ALEffectSlot->EffectState = NULL; + ALEffectSlot->EffectState = NewState; } if(!effect) { @@ -481,16 +494,6 @@ static ALvoid InitializeEffect(ALCcontext *Context, ALeffectslot *ALEffectSlot, return; } memcpy(&ALEffectSlot->effect, effect, sizeof(*effect)); - - if(!ALEffectSlot->EffectState) - { - if(effect->type == AL_EFFECT_EAXREVERB) - ALEffectSlot->EffectState = EAXVerbCreate(Context); - else if(effect->type == AL_EFFECT_REVERB) - ALEffectSlot->EffectState = VerbCreate(Context); - else if(effect->type == AL_EFFECT_ECHO) - ALEffectSlot->EffectState = EchoCreate(Context); - } ALEffect_Update(ALEffectSlot->EffectState, Context, effect); } |