From b1d4508d90eeb245bfc0f720fa9c0da7df8444fa Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 12 Mar 2011 20:54:49 -0800 Subject: Use a loop to make sure the requested effect is not disabled --- OpenAL32/Include/alMain.h | 1 + OpenAL32/alEffect.c | 15 ++++++++------- OpenAL32/alExtension.c | 14 +++++++------- 3 files changed, 16 insertions(+), 14 deletions(-) (limited to 'OpenAL32') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 43f36b04..74f50e8f 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -375,6 +375,7 @@ extern const struct EffectList { const char *name; int type; const char *ename; + ALenum val; } EffectList[]; diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 69a5b32d..b5f7a8b0 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -167,13 +167,14 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) { if(param == AL_EFFECT_TYPE) { - ALboolean isOk = (iValue == AL_EFFECT_NULL || - (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) || - (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) || - (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO]) || - (iValue == AL_EFFECT_RING_MODULATOR && !DisabledEffects[MODULATOR]) || - ((iValue == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT || - iValue == AL_EFFECT_DEDICATED_DIALOGUE) && !DisabledEffects[DEDICATED])); + ALboolean isOk = (iValue == AL_EFFECT_NULL); + ALint i; + for(i = 0;!isOk && EffectList[i].val;i++) + { + if(iValue == EffectList[i].val && + !DisabledEffects[EffectList[i].type]) + isOk = AL_TRUE; + } if(isOk) InitEffectParams(ALEffect, iValue); diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c index 9f5cad65..67d12050 100644 --- a/OpenAL32/alExtension.c +++ b/OpenAL32/alExtension.c @@ -276,13 +276,13 @@ static const ALenums enumeration[] = { const struct EffectList EffectList[] = { - { "eaxreverb", EAXREVERB, "AL_EFFECT_EAXREVERB" }, - { "reverb", REVERB, "AL_EFFECT_REVERB" }, - { "echo", ECHO, "AL_EFFECT_ECHO" }, - { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR" }, - { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT" }, - { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE" }, - { NULL, 0, NULL } + { "eaxreverb", EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB }, + { "reverb", REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB }, + { "echo", ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO }, + { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR }, + { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT }, + { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE }, + { NULL, 0, NULL, (ALenum)0 } }; -- cgit v1.2.3