aboutsummaryrefslogtreecommitdiffstats
path: root/alc/effects/dedicated.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-10 20:23:20 -0700
committerChris Robinson <[email protected]>2020-04-10 20:23:20 -0700
commit1d8ac4d61f5717c02e253a741175b037db97de4e (patch)
tree4a73f0e167283eb405e8551ff48c843b7b156d9f /alc/effects/dedicated.cpp
parent13153bab607e30fb2f676cc6070391453b884faa (diff)
Throw exceptions for errors in the effect getters/setters
Diffstat (limited to 'alc/effects/dedicated.cpp')
-rw-r--r--alc/effects/dedicated.cpp62
1 files changed, 34 insertions, 28 deletions
diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp
index 98a516bd..76dec5e0 100644
--- a/alc/effects/dedicated.cpp
+++ b/alc/effects/dedicated.cpp
@@ -95,45 +95,51 @@ void DedicatedState::process(const size_t samplesToDo, const al::span<const Floa
}
-void Dedicated_setParami(EffectProps*, ALCcontext *context, ALenum param, int)
-{ context->setError(AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); }
-void Dedicated_setParamiv(EffectProps*, ALCcontext *context, ALenum param, const int*)
-{ context->setError(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); }
-void Dedicated_setParamf(EffectProps *props, ALCcontext *context, ALenum param, float val)
+void Dedicated_setParami(EffectProps*, ALenum param, int)
+{ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
+void Dedicated_setParamiv(EffectProps*, ALenum param, const int*)
+{
+ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
+ param};
+}
+void Dedicated_setParamf(EffectProps *props, ALenum param, float val)
{
switch(param)
{
- case AL_DEDICATED_GAIN:
- if(!(val >= 0.0f && std::isfinite(val)))
- SETERR_RETURN(context, AL_INVALID_VALUE,, "Dedicated gain out of range");
- props->Dedicated.Gain = val;
- break;
-
- default:
- context->setError(AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param);
+ case AL_DEDICATED_GAIN:
+ if(!(val >= 0.0f && std::isfinite(val)))
+ throw effect_exception{AL_INVALID_VALUE, "Dedicated gain out of range"};
+ props->Dedicated.Gain = val;
+ break;
+
+ default:
+ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
}
}
-void Dedicated_setParamfv(EffectProps *props, ALCcontext *context, ALenum param, const float *vals)
-{ Dedicated_setParamf(props, context, param, vals[0]); }
-
-void Dedicated_getParami(const EffectProps*, ALCcontext *context, ALenum param, int*)
-{ context->setError(AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); }
-void Dedicated_getParamiv(const EffectProps*, ALCcontext *context, ALenum param, int*)
-{ context->setError(AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); }
-void Dedicated_getParamf(const EffectProps *props, ALCcontext *context, ALenum param, float *val)
+void Dedicated_setParamfv(EffectProps *props, ALenum param, const float *vals)
+{ Dedicated_setParamf(props, param, vals[0]); }
+
+void Dedicated_getParami(const EffectProps*, ALenum param, int*)
+{ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
+void Dedicated_getParamiv(const EffectProps*, ALenum param, int*)
+{
+ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
+ param};
+}
+void Dedicated_getParamf(const EffectProps *props, ALenum param, float *val)
{
switch(param)
{
- case AL_DEDICATED_GAIN:
- *val = props->Dedicated.Gain;
- break;
+ case AL_DEDICATED_GAIN:
+ *val = props->Dedicated.Gain;
+ break;
- default:
- context->setError(AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param);
+ default:
+ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
}
}
-void Dedicated_getParamfv(const EffectProps *props, ALCcontext *context, ALenum param, float *vals)
-{ Dedicated_getParamf(props, context, param, vals); }
+void Dedicated_getParamfv(const EffectProps *props, ALenum param, float *vals)
+{ Dedicated_getParamf(props, param, vals); }
DEFINE_ALEFFECT_VTABLE(Dedicated);