diff options
author | Chris Robinson <[email protected]> | 2011-03-12 20:54:49 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-03-12 20:54:49 -0800 |
commit | b1d4508d90eeb245bfc0f720fa9c0da7df8444fa (patch) | |
tree | 12e9d11a4fb137465db191073f71044925eacdda /OpenAL32 | |
parent | 8249dc8559aae9762fd3047120abeef0ae0303b6 (diff) |
Use a loop to make sure the requested effect is not disabled
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 1 | ||||
-rw-r--r-- | OpenAL32/alEffect.c | 15 | ||||
-rw-r--r-- | OpenAL32/alExtension.c | 14 |
3 files changed, 16 insertions, 14 deletions
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 } }; |