From 8346f77af0068d175cc9ecbf4c8894a2d1bcd617 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 22 Dec 2023 01:36:47 -0800 Subject: Replace a series of if statements with a switch --- al/eax/effect.h | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/al/eax/effect.h b/al/eax/effect.h index 14506846..a24f85fa 100644 --- a/al/eax/effect.h +++ b/al/eax/effect.h @@ -239,30 +239,22 @@ public: void call_set_defaults(const ALenum altype, EaxEffectProps &props) { - if(altype == AL_EFFECT_EAXREVERB) - return call_set_defaults(props); - if(altype == AL_EFFECT_CHORUS) - return call_set_defaults(props); - if(altype == AL_EFFECT_AUTOWAH) - return call_set_defaults(props); - if(altype == AL_EFFECT_COMPRESSOR) - return call_set_defaults(props); - if(altype == AL_EFFECT_DISTORTION) - return call_set_defaults(props); - if(altype == AL_EFFECT_ECHO) - return call_set_defaults(props); - if(altype == AL_EFFECT_EQUALIZER) - return call_set_defaults(props); - if(altype == AL_EFFECT_FLANGER) - return call_set_defaults(props); - if(altype == AL_EFFECT_FREQUENCY_SHIFTER) - return call_set_defaults(props); - if(altype == AL_EFFECT_RING_MODULATOR) - return call_set_defaults(props); - if(altype == AL_EFFECT_PITCH_SHIFTER) - return call_set_defaults(props); - if(altype == AL_EFFECT_VOCAL_MORPHER) - return call_set_defaults(props); + switch(altype) + { + case AL_EFFECT_EAXREVERB: return call_set_defaults(props); + case AL_EFFECT_CHORUS: return call_set_defaults(props); + case AL_EFFECT_AUTOWAH: return call_set_defaults(props); + case AL_EFFECT_COMPRESSOR: return call_set_defaults(props); + case AL_EFFECT_DISTORTION: return call_set_defaults(props); + case AL_EFFECT_ECHO: return call_set_defaults(props); + case AL_EFFECT_EQUALIZER: return call_set_defaults(props); + case AL_EFFECT_FLANGER: return call_set_defaults(props); + case AL_EFFECT_FREQUENCY_SHIFTER: return call_set_defaults(props); + case AL_EFFECT_RING_MODULATOR: return call_set_defaults(props); + case AL_EFFECT_PITCH_SHIFTER: return call_set_defaults(props); + case AL_EFFECT_VOCAL_MORPHER: return call_set_defaults(props); + case AL_EFFECT_NULL: break; + } return call_set_defaults(props); } -- cgit v1.2.3