aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2013-05-26 08:54:34 -0700
committerChris Robinson <[email protected]>2013-05-26 08:54:34 -0700
commit82caba6bbe251d50731785e529cd55a6ecf91664 (patch)
treed42e32da57abd999abf34472d969f5ddef9bc6cc
parent8808159d55a65cec92010622f63844e76644722c (diff)
Use the helper macros in more places
-rw-r--r--Alc/effects/chorus.c4
-rw-r--r--Alc/effects/echo.c45
-rw-r--r--Alc/effects/equalizer.c100
-rw-r--r--Alc/effects/flanger.c54
-rw-r--r--Alc/effects/modulator.c33
-rw-r--r--Alc/effects/null.c48
-rw-r--r--Alc/effects/reverb.c296
7 files changed, 237 insertions, 343 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c
index 783e5642..6a1a2d9c 100644
--- a/Alc/effects/chorus.c
+++ b/Alc/effects/chorus.c
@@ -301,8 +301,7 @@ void ALchorus_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALchorus_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
@@ -391,7 +390,6 @@ void ALchorus_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf
default:
SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
- break;
}
}
void ALchorus_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c
index d1f734bf..8e4205fc 100644
--- a/Alc/effects/echo.c
+++ b/Alc/effects/echo.c
@@ -222,7 +222,7 @@ ALeffectStateFactory *ALechoStateFactory_getFactory(void)
void ALecho_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
-{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
+{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); (void)effect;(void)param;(void)val; }
void ALecho_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
{
ALecho_SetParami(effect, context, param, vals[0]);
@@ -233,43 +233,37 @@ void ALecho_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALflo
switch(param)
{
case AL_ECHO_DELAY:
- if(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY)
- props->Echo.Delay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Echo.Delay = val;
break;
case AL_ECHO_LRDELAY:
- if(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY)
- props->Echo.LRDelay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Echo.LRDelay = val;
break;
case AL_ECHO_DAMPING:
- if(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING)
- props->Echo.Damping = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Echo.Damping = val;
break;
case AL_ECHO_FEEDBACK:
- if(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK)
- props->Echo.Feedback = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Echo.Feedback = val;
break;
case AL_ECHO_SPREAD:
- if(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD)
- props->Echo.Spread = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Echo.Spread = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALecho_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
@@ -278,7 +272,7 @@ void ALecho_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, cons
}
void ALecho_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
-{ (void)effect;(void)param;(void)val; alSetError(context, AL_INVALID_ENUM); }
+{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); (void)effect;(void)param;(void)val; }
void ALecho_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
{
ALecho_GetParami(effect, context, param, vals);
@@ -309,8 +303,7 @@ void ALecho_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALflo
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALecho_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
diff --git a/Alc/effects/equalizer.c b/Alc/effects/equalizer.c
index df95716f..441c785f 100644
--- a/Alc/effects/equalizer.c
+++ b/Alc/effects/equalizer.c
@@ -322,17 +322,7 @@ ALeffectStateFactory *ALequalizerStateFactory_getFactory(void)
void ALequalizer_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
-{
- ALeffectProps *props = &effect->Props;
- switch(param)
- {
- default:
- alSetError(context, AL_INVALID_ENUM);
- break;
- }
- (void)props;
- (void)val;
-}
+{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); (void)effect;(void)param;(void)val; }
void ALequalizer_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
{
ALequalizer_SetParami(effect, context, param, vals[0]);
@@ -343,78 +333,67 @@ void ALequalizer_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param,
switch(param)
{
case AL_EQUALIZER_LOW_GAIN:
- if(val >= AL_EQUALIZER_MIN_LOW_GAIN && val <= AL_EQUALIZER_MAX_LOW_GAIN)
- props->Equalizer.LowGain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_LOW_GAIN && val <= AL_EQUALIZER_MAX_LOW_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.LowGain = val;
break;
case AL_EQUALIZER_LOW_CUTOFF:
- if(val >= AL_EQUALIZER_MIN_LOW_CUTOFF && val <= AL_EQUALIZER_MAX_LOW_CUTOFF)
- props->Equalizer.LowCutoff = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_LOW_CUTOFF && val <= AL_EQUALIZER_MAX_LOW_CUTOFF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.LowCutoff = val;
break;
case AL_EQUALIZER_MID1_GAIN:
- if(val >= AL_EQUALIZER_MIN_MID1_GAIN && val <= AL_EQUALIZER_MAX_MID1_GAIN)
- props->Equalizer.Mid1Gain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_MID1_GAIN && val <= AL_EQUALIZER_MAX_MID1_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.Mid1Gain = val;
break;
case AL_EQUALIZER_MID1_CENTER:
- if(val >= AL_EQUALIZER_MIN_MID1_CENTER && val <= AL_EQUALIZER_MAX_MID1_CENTER)
- props->Equalizer.Mid1Center = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_MID1_CENTER && val <= AL_EQUALIZER_MAX_MID1_CENTER))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.Mid1Center = val;
break;
case AL_EQUALIZER_MID1_WIDTH:
- if(val >= AL_EQUALIZER_MIN_MID1_WIDTH && val <= AL_EQUALIZER_MAX_MID1_WIDTH)
- props->Equalizer.Mid1Width = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_MID1_WIDTH && val <= AL_EQUALIZER_MAX_MID1_WIDTH))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.Mid1Width = val;
break;
case AL_EQUALIZER_MID2_GAIN:
- if(val >= AL_EQUALIZER_MIN_MID2_GAIN && val <= AL_EQUALIZER_MAX_MID2_GAIN)
- props->Equalizer.Mid2Gain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_MID2_GAIN && val <= AL_EQUALIZER_MAX_MID2_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.Mid2Gain = val;
break;
case AL_EQUALIZER_MID2_CENTER:
- if(val >= AL_EQUALIZER_MIN_MID2_CENTER && val <= AL_EQUALIZER_MAX_MID2_CENTER)
- props->Equalizer.Mid2Center = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_MID2_CENTER && val <= AL_EQUALIZER_MAX_MID2_CENTER))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.Mid2Center = val;
break;
case AL_EQUALIZER_MID2_WIDTH:
- if(val >= AL_EQUALIZER_MIN_MID2_WIDTH && val <= AL_EQUALIZER_MAX_MID2_WIDTH)
- props->Equalizer.Mid2Width = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_MID2_WIDTH && val <= AL_EQUALIZER_MAX_MID2_WIDTH))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.Mid2Width = val;
break;
case AL_EQUALIZER_HIGH_GAIN:
- if(val >= AL_EQUALIZER_MIN_HIGH_GAIN && val <= AL_EQUALIZER_MAX_HIGH_GAIN)
- props->Equalizer.HighGain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_HIGH_GAIN && val <= AL_EQUALIZER_MAX_HIGH_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.HighGain = val;
break;
case AL_EQUALIZER_HIGH_CUTOFF:
- if(val >= AL_EQUALIZER_MIN_HIGH_CUTOFF && val <= AL_EQUALIZER_MAX_HIGH_CUTOFF)
- props->Equalizer.HighCutoff = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EQUALIZER_MIN_HIGH_CUTOFF && val <= AL_EQUALIZER_MAX_HIGH_CUTOFF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Equalizer.HighCutoff = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALequalizer_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
@@ -423,17 +402,7 @@ void ALequalizer_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param,
}
void ALequalizer_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
-{
- ALeffectProps *props = &effect->Props;
- switch(param)
- {
- default:
- alSetError(context, AL_INVALID_ENUM);
- break;
- }
- (void)props;
- (void)val;
-}
+{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); (void)effect;(void)param;(void)val; }
void ALequalizer_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
{
ALequalizer_GetParami(effect, context, param, vals);
@@ -484,8 +453,7 @@ void ALequalizer_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param,
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALequalizer_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c
index 1983c5e0..db8240ce 100644
--- a/Alc/effects/flanger.c
+++ b/Alc/effects/flanger.c
@@ -289,22 +289,19 @@ void ALflanger_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, AL
switch(param)
{
case AL_FLANGER_WAVEFORM:
- if(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM)
- props->Flanger.Waveform = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Flanger.Waveform = val;
break;
case AL_FLANGER_PHASE:
- if(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE)
- props->Flanger.Phase = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Flanger.Phase = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALflanger_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
@@ -317,36 +314,31 @@ void ALflanger_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL
switch(param)
{
case AL_FLANGER_RATE:
- if(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE)
- props->Flanger.Rate = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Flanger.Rate = val;
break;
case AL_FLANGER_DEPTH:
- if(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH)
- props->Flanger.Depth = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Flanger.Depth = val;
break;
case AL_FLANGER_FEEDBACK:
- if(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK)
- props->Flanger.Feedback = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Flanger.Feedback = val;
break;
case AL_FLANGER_DELAY:
- if(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY)
- props->Flanger.Delay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Flanger.Delay = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALflanger_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
@@ -368,8 +360,7 @@ void ALflanger_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, AL
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALflanger_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
@@ -398,8 +389,7 @@ void ALflanger_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, AL
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALflanger_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c
index bd994adb..a7b84d30 100644
--- a/Alc/effects/modulator.c
+++ b/Alc/effects/modulator.c
@@ -244,22 +244,19 @@ void ALmodulator_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param,
switch(param)
{
case AL_RING_MODULATOR_FREQUENCY:
- if(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY)
- props->Modulator.Frequency = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Modulator.Frequency = val;
break;
case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
- if(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF)
- props->Modulator.HighPassCutoff = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Modulator.HighPassCutoff = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALmodulator_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
@@ -277,15 +274,13 @@ void ALmodulator_SetParami(ALeffect *effect, ALCcontext *context, ALenum param,
break;
case AL_RING_MODULATOR_WAVEFORM:
- if(val >= AL_RING_MODULATOR_MIN_WAVEFORM && val <= AL_RING_MODULATOR_MAX_WAVEFORM)
- props->Modulator.Waveform = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_RING_MODULATOR_MIN_WAVEFORM && val <= AL_RING_MODULATOR_MAX_WAVEFORM))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Modulator.Waveform = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALmodulator_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
@@ -309,8 +304,7 @@ void ALmodulator_GetParami(ALeffect *effect, ALCcontext *context, ALenum param,
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALmodulator_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
@@ -330,8 +324,7 @@ void ALmodulator_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param,
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALmodulator_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
diff --git a/Alc/effects/null.c b/Alc/effects/null.c
index 3d617b64..aed19a82 100644
--- a/Alc/effects/null.c
+++ b/Alc/effects/null.c
@@ -102,84 +102,84 @@ ALeffectStateFactory *ALnullStateFactory_getFactory(void)
void ALnull_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
{
+ (void)effect;
+ (void)val;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)val;
}
void ALnull_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
{
+ (void)effect;
+ (void)vals;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)vals;
}
void ALnull_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val)
{
+ (void)effect;
+ (void)val;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)val;
}
void ALnull_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
{
+ (void)effect;
+ (void)vals;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)vals;
}
void ALnull_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint *val)
{
+ (void)effect;
+ (void)val;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)val;
}
void ALnull_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
{
+ (void)effect;
+ (void)vals;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)vals;
}
void ALnull_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val)
{
+ (void)effect;
+ (void)val;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)val;
}
void ALnull_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
{
+ (void)effect;
+ (void)vals;
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM);
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
- (void)effect;
- (void)vals;
}
DEFINE_ALEFFECT_VTABLE(ALnull);
diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c
index b283b67f..380361e5 100644
--- a/Alc/effects/reverb.c
+++ b/Alc/effects/reverb.c
@@ -1296,15 +1296,13 @@ void ALeaxreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param,
switch(param)
{
case AL_EAXREVERB_DECAY_HFLIMIT:
- if(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT)
- props->Reverb.DecayHFLimit = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayHFLimit = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALeaxreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
@@ -1317,148 +1315,127 @@ void ALeaxreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param,
switch(param)
{
case AL_EAXREVERB_DENSITY:
- if(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY)
- props->Reverb.Density = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.Density = val;
break;
case AL_EAXREVERB_DIFFUSION:
- if(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION)
- props->Reverb.Diffusion = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.Diffusion = val;
break;
case AL_EAXREVERB_GAIN:
- if(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN)
- props->Reverb.Gain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.Gain = val;
break;
case AL_EAXREVERB_GAINHF:
- if(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF)
- props->Reverb.GainHF = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.GainHF = val;
break;
case AL_EAXREVERB_GAINLF:
- if(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF)
- props->Reverb.GainLF = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.GainLF = val;
break;
case AL_EAXREVERB_DECAY_TIME:
- if(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME)
- props->Reverb.DecayTime = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayTime = val;
break;
case AL_EAXREVERB_DECAY_HFRATIO:
- if(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO)
- props->Reverb.DecayHFRatio = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayHFRatio = val;
break;
case AL_EAXREVERB_DECAY_LFRATIO:
- if(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO)
- props->Reverb.DecayLFRatio = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayLFRatio = val;
break;
case AL_EAXREVERB_REFLECTIONS_GAIN:
- if(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN)
- props->Reverb.ReflectionsGain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.ReflectionsGain = val;
break;
case AL_EAXREVERB_REFLECTIONS_DELAY:
- if(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY)
- props->Reverb.ReflectionsDelay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.ReflectionsDelay = val;
break;
case AL_EAXREVERB_LATE_REVERB_GAIN:
- if(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN)
- props->Reverb.LateReverbGain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.LateReverbGain = val;
break;
case AL_EAXREVERB_LATE_REVERB_DELAY:
- if(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY)
- props->Reverb.LateReverbDelay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.LateReverbDelay = val;
break;
case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
- if(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF)
- props->Reverb.AirAbsorptionGainHF = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.AirAbsorptionGainHF = val;
break;
case AL_EAXREVERB_ECHO_TIME:
- if(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME)
- props->Reverb.EchoTime = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.EchoTime = val;
break;
case AL_EAXREVERB_ECHO_DEPTH:
- if(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH)
- props->Reverb.EchoDepth = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.EchoDepth = val;
break;
case AL_EAXREVERB_MODULATION_TIME:
- if(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME)
- props->Reverb.ModulationTime = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.ModulationTime = val;
break;
case AL_EAXREVERB_MODULATION_DEPTH:
- if(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH)
- props->Reverb.ModulationDepth = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.ModulationDepth = val;
break;
case AL_EAXREVERB_HFREFERENCE:
- if(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE)
- props->Reverb.HFReference = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.HFReference = val;
break;
case AL_EAXREVERB_LFREFERENCE:
- if(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE)
- props->Reverb.LFReference = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.LFReference = val;
break;
case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
- if(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR)
- props->Reverb.RoomRolloffFactor = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.RoomRolloffFactor = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALeaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
@@ -1467,28 +1444,22 @@ void ALeaxreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param,
switch(param)
{
case AL_EAXREVERB_REFLECTIONS_PAN:
- if(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))
- {
- LockContext(context);
- props->Reverb.ReflectionsPan[0] = vals[0];
- props->Reverb.ReflectionsPan[1] = vals[1];
- props->Reverb.ReflectionsPan[2] = vals[2];
- UnlockContext(context);
- }
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2])))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ LockContext(context);
+ props->Reverb.ReflectionsPan[0] = vals[0];
+ props->Reverb.ReflectionsPan[1] = vals[1];
+ props->Reverb.ReflectionsPan[2] = vals[2];
+ UnlockContext(context);
break;
case AL_EAXREVERB_LATE_REVERB_PAN:
- if(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))
- {
- LockContext(context);
- props->Reverb.LateReverbPan[0] = vals[0];
- props->Reverb.LateReverbPan[1] = vals[1];
- props->Reverb.LateReverbPan[2] = vals[2];
- UnlockContext(context);
- }
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2])))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ LockContext(context);
+ props->Reverb.LateReverbPan[0] = vals[0];
+ props->Reverb.LateReverbPan[1] = vals[1];
+ props->Reverb.LateReverbPan[2] = vals[2];
+ UnlockContext(context);
break;
default:
@@ -1507,8 +1478,7 @@ void ALeaxreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param,
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALeaxreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
@@ -1601,8 +1571,7 @@ void ALeaxreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param,
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALeaxreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -1639,15 +1608,13 @@ void ALreverb_SetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
- if(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT)
- props->Reverb.DecayHFLimit = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayHFLimit = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALreverb_SetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals)
@@ -1660,92 +1627,79 @@ void ALreverb_SetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf
switch(param)
{
case AL_REVERB_DENSITY:
- if(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY)
- props->Reverb.Density = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.Density = val;
break;
case AL_REVERB_DIFFUSION:
- if(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION)
- props->Reverb.Diffusion = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.Diffusion = val;
break;
case AL_REVERB_GAIN:
- if(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN)
- props->Reverb.Gain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.Gain = val;
break;
case AL_REVERB_GAINHF:
- if(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF)
- props->Reverb.GainHF = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.GainHF = val;
break;
case AL_REVERB_DECAY_TIME:
- if(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME)
- props->Reverb.DecayTime = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayTime = val;
break;
case AL_REVERB_DECAY_HFRATIO:
- if(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO)
- props->Reverb.DecayHFRatio = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.DecayHFRatio = val;
break;
case AL_REVERB_REFLECTIONS_GAIN:
- if(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN)
- props->Reverb.ReflectionsGain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.ReflectionsGain = val;
break;
case AL_REVERB_REFLECTIONS_DELAY:
- if(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY)
- props->Reverb.ReflectionsDelay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.ReflectionsDelay = val;
break;
case AL_REVERB_LATE_REVERB_GAIN:
- if(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN)
- props->Reverb.LateReverbGain = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.LateReverbGain = val;
break;
case AL_REVERB_LATE_REVERB_DELAY:
- if(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY)
- props->Reverb.LateReverbDelay = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.LateReverbDelay = val;
break;
case AL_REVERB_AIR_ABSORPTION_GAINHF:
- if(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF)
- props->Reverb.AirAbsorptionGainHF = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.AirAbsorptionGainHF = val;
break;
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
- if(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR)
- props->Reverb.RoomRolloffFactor = val;
- else
- alSetError(context, AL_INVALID_VALUE);
+ if(!(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR))
+ SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE);
+ props->Reverb.RoomRolloffFactor = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALreverb_SetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals)
@@ -1763,8 +1717,7 @@ void ALreverb_GetParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALreverb_GetParamiv(ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals)
@@ -1825,8 +1778,7 @@ void ALreverb_GetParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf
break;
default:
- alSetError(context, AL_INVALID_ENUM);
- break;
+ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM);
}
}
void ALreverb_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals)