Remove some unnecessary uses of mem_fn
[openal-soft.git] / al / effects / dedicated.cpp
blob5776b42be27c580ecbb4e668eb8ab6f74fdab35e
2 #include "config.h"
4 #include <cmath>
6 #include "AL/al.h"
7 #include "AL/alext.h"
9 #include "alc/context.h"
10 #include "alnumeric.h"
11 #include "effects.h"
14 namespace {
16 constexpr EffectProps genDefaultDialogProps() noexcept
18 DedicatedProps props{};
19 props.Target = DedicatedProps::Dialog;
20 props.Gain = 1.0f;
21 return props;
24 constexpr EffectProps genDefaultLfeProps() noexcept
26 DedicatedProps props{};
27 props.Target = DedicatedProps::Lfe;
28 props.Gain = 1.0f;
29 return props;
32 } // namespace
34 const EffectProps DedicatedDialogEffectProps{genDefaultDialogProps()};
36 void DedicatedDialogEffectHandler::SetParami(ALCcontext *context, DedicatedProps&, ALenum param, int)
37 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
38 void DedicatedDialogEffectHandler::SetParamiv(ALCcontext *context, DedicatedProps&, ALenum param, const int*)
39 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
40 void DedicatedDialogEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &props, ALenum param, float val)
42 switch(param)
44 case AL_DEDICATED_GAIN:
45 if(!(val >= 0.0f && std::isfinite(val)))
46 context->throw_error(AL_INVALID_VALUE, "Dedicated gain out of range");
47 props.Gain = val;
48 return;
51 context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
52 as_unsigned(param));
54 void DedicatedDialogEffectHandler::SetParamfv(ALCcontext *context, DedicatedProps &props, ALenum param, const float *vals)
55 { SetParamf(context, props, param, *vals); }
57 void DedicatedDialogEffectHandler::GetParami(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
58 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
59 void DedicatedDialogEffectHandler::GetParamiv(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
60 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
61 void DedicatedDialogEffectHandler::GetParamf(ALCcontext *context, const DedicatedProps &props, ALenum param, float *val)
63 switch(param)
65 case AL_DEDICATED_GAIN: *val = props.Gain; return;
68 context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
69 as_unsigned(param));
71 void DedicatedDialogEffectHandler::GetParamfv(ALCcontext *context, const DedicatedProps &props, ALenum param, float *vals)
72 { GetParamf(context, props, param, vals); }
75 const EffectProps DedicatedLfeEffectProps{genDefaultLfeProps()};
77 void DedicatedLfeEffectHandler::SetParami(ALCcontext *context, DedicatedProps&, ALenum param, int)
78 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
79 void DedicatedLfeEffectHandler::SetParamiv(ALCcontext *context, DedicatedProps&, ALenum param, const int*)
80 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
81 void DedicatedLfeEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &props, ALenum param, float val)
83 switch(param)
85 case AL_DEDICATED_GAIN:
86 if(!(val >= 0.0f && std::isfinite(val)))
87 context->throw_error(AL_INVALID_VALUE, "Dedicated gain out of range");
88 props.Gain = val;
89 return;
92 context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
93 as_unsigned(param));
95 void DedicatedLfeEffectHandler::SetParamfv(ALCcontext *context, DedicatedProps &props, ALenum param, const float *vals)
96 { SetParamf(context, props, param, *vals); }
98 void DedicatedLfeEffectHandler::GetParami(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
99 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
100 void DedicatedLfeEffectHandler::GetParamiv(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
101 { context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
102 void DedicatedLfeEffectHandler::GetParamf(ALCcontext *context, const DedicatedProps &props, ALenum param, float *val)
104 switch(param)
106 case AL_DEDICATED_GAIN: *val = props.Gain; return;
109 context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
110 as_unsigned(param));
112 void DedicatedLfeEffectHandler::GetParamfv(ALCcontext *context, const DedicatedProps &props, ALenum param, float *vals)
113 { GetParamf(context, props, param, vals); }