diff options
author | Chris Robinson <[email protected]> | 2020-04-10 20:23:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-04-10 20:23:20 -0700 |
commit | 1d8ac4d61f5717c02e253a741175b037db97de4e (patch) | |
tree | 4a73f0e167283eb405e8551ff48c843b7b156d9f /alc/effects/autowah.cpp | |
parent | 13153bab607e30fb2f676cc6070391453b884faa (diff) |
Throw exceptions for errors in the effect getters/setters
Diffstat (limited to 'alc/effects/autowah.cpp')
-rw-r--r-- | alc/effects/autowah.cpp | 114 |
1 files changed, 60 insertions, 54 deletions
diff --git a/alc/effects/autowah.cpp b/alc/effects/autowah.cpp index 32e366e0..72ce4738 100644 --- a/alc/effects/autowah.cpp +++ b/alc/effects/autowah.cpp @@ -198,78 +198,84 @@ void AutowahState::process(const size_t samplesToDo, const al::span<const FloatB } -void Autowah_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val) +void Autowah_setParamf(EffectProps *props, ALenum param, float val) { switch(param) { - case AL_AUTOWAH_ATTACK_TIME: - if(!(val >= AL_AUTOWAH_MIN_ATTACK_TIME && val <= AL_AUTOWAH_MAX_ATTACK_TIME)) - SETERR_RETURN(context, AL_INVALID_VALUE,,"Autowah attack time out of range"); - props->Autowah.AttackTime = val; - break; - - case AL_AUTOWAH_RELEASE_TIME: - if(!(val >= AL_AUTOWAH_MIN_RELEASE_TIME && val <= AL_AUTOWAH_MAX_RELEASE_TIME)) - SETERR_RETURN(context, AL_INVALID_VALUE,,"Autowah release time out of range"); - props->Autowah.ReleaseTime = val; - break; - - case AL_AUTOWAH_RESONANCE: - if(!(val >= AL_AUTOWAH_MIN_RESONANCE && val <= AL_AUTOWAH_MAX_RESONANCE)) - SETERR_RETURN(context, AL_INVALID_VALUE,,"Autowah resonance out of range"); - props->Autowah.Resonance = val; - break; - - case AL_AUTOWAH_PEAK_GAIN: - if(!(val >= AL_AUTOWAH_MIN_PEAK_GAIN && val <= AL_AUTOWAH_MAX_PEAK_GAIN)) - SETERR_RETURN(context, AL_INVALID_VALUE,,"Autowah peak gain out of range"); - props->Autowah.PeakGain = val; - break; - - default: - context->setError(AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param); + case AL_AUTOWAH_ATTACK_TIME: + if(!(val >= AL_AUTOWAH_MIN_ATTACK_TIME && val <= AL_AUTOWAH_MAX_ATTACK_TIME)) + throw effect_exception{AL_INVALID_VALUE, "Autowah attack time out of range"}; + props->Autowah.AttackTime = val; + break; + + case AL_AUTOWAH_RELEASE_TIME: + if(!(val >= AL_AUTOWAH_MIN_RELEASE_TIME && val <= AL_AUTOWAH_MAX_RELEASE_TIME)) + throw effect_exception{AL_INVALID_VALUE, "Autowah release time out of range"}; + props->Autowah.ReleaseTime = val; + break; + + case AL_AUTOWAH_RESONANCE: + if(!(val >= AL_AUTOWAH_MIN_RESONANCE && val <= AL_AUTOWAH_MAX_RESONANCE)) + throw effect_exception{AL_INVALID_VALUE, "Autowah resonance out of range"}; + props->Autowah.Resonance = val; + break; + + case AL_AUTOWAH_PEAK_GAIN: + if(!(val >= AL_AUTOWAH_MIN_PEAK_GAIN && val <= AL_AUTOWAH_MAX_PEAK_GAIN)) + throw effect_exception{AL_INVALID_VALUE, "Autowah peak gain out of range"}; + props->Autowah.PeakGain = val; + break; + + default: + throw effect_exception{AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param}; } } -void Autowah_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals) -{ Autowah_setParamf(props, context, param, vals[0]); } +void Autowah_setParamfv(EffectProps *props, ALenum param, const float *vals) +{ Autowah_setParamf(props, param, vals[0]); } -void Autowah_setParami(EffectProps*, ALCcontext *context, ALenum param, int) -{ context->setError(AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param); } -void Autowah_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*) -{ context->setError(AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", param); } +void Autowah_setParami(EffectProps*, ALenum param, int) +{ throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param}; } +void Autowah_setParamiv(EffectProps*, ALenum param, const int*) +{ + throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", + param}; +} -void Autowah_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val) +void Autowah_getParamf(const EffectProps *props, ALenum param, float *val) { switch(param) { - case AL_AUTOWAH_ATTACK_TIME: - *val = props->Autowah.AttackTime; - break; + case AL_AUTOWAH_ATTACK_TIME: + *val = props->Autowah.AttackTime; + break; - case AL_AUTOWAH_RELEASE_TIME: - *val = props->Autowah.ReleaseTime; - break; + case AL_AUTOWAH_RELEASE_TIME: + *val = props->Autowah.ReleaseTime; + break; - case AL_AUTOWAH_RESONANCE: - *val = props->Autowah.Resonance; - break; + case AL_AUTOWAH_RESONANCE: + *val = props->Autowah.Resonance; + break; - case AL_AUTOWAH_PEAK_GAIN: - *val = props->Autowah.PeakGain; - break; + case AL_AUTOWAH_PEAK_GAIN: + *val = props->Autowah.PeakGain; + break; - default: - context->setError(AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param); + default: + throw effect_exception{AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param}; } } -void Autowah_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals) -{ Autowah_getParamf(props, context, param, vals); } +void Autowah_getParamfv(const EffectProps *props, ALenum param, float *vals) +{ Autowah_getParamf(props, param, vals); } -void Autowah_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*) -{ context->setError(AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param); } -void Autowah_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*) -{ context->setError(AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", param); } +void Autowah_getParami(const EffectProps*, ALenum param, int*) +{ throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param}; } +void Autowah_getParamiv(const EffectProps*, ALenum param, int*) +{ + throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x", + param}; +} DEFINE_ALEFFECT_VTABLE(Autowah); |