Add options to reverse local X and Y coordinates
[openal-soft.git] / al / effects / dedicated.cpp
blobdb57003c2af9fe27eeba2f7c7b054a0d5e7e5696
2 #include "config.h"
4 #include <cmath>
6 #include "AL/al.h"
7 #include "AL/alext.h"
9 #include "alc/effects/base.h"
10 #include "effects.h"
13 namespace {
15 void Dedicated_setParami(EffectProps*, ALenum param, int)
16 { throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
17 void Dedicated_setParamiv(EffectProps*, ALenum param, const int*)
19 throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
20 param};
22 void Dedicated_setParamf(EffectProps *props, ALenum param, float val)
24 switch(param)
26 case AL_DEDICATED_GAIN:
27 if(!(val >= 0.0f && std::isfinite(val)))
28 throw effect_exception{AL_INVALID_VALUE, "Dedicated gain out of range"};
29 props->Dedicated.Gain = val;
30 break;
32 default:
33 throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
36 void Dedicated_setParamfv(EffectProps *props, ALenum param, const float *vals)
37 { Dedicated_setParamf(props, param, vals[0]); }
39 void Dedicated_getParami(const EffectProps*, ALenum param, int*)
40 { throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
41 void Dedicated_getParamiv(const EffectProps*, ALenum param, int*)
43 throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
44 param};
46 void Dedicated_getParamf(const EffectProps *props, ALenum param, float *val)
48 switch(param)
50 case AL_DEDICATED_GAIN:
51 *val = props->Dedicated.Gain;
52 break;
54 default:
55 throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
58 void Dedicated_getParamfv(const EffectProps *props, ALenum param, float *vals)
59 { Dedicated_getParamf(props, param, vals); }
61 EffectProps genDefaultProps() noexcept
63 EffectProps props{};
64 props.Dedicated.Gain = 1.0f;
65 return props;
68 } // namespace
70 DEFINE_ALEFFECT_VTABLE(Dedicated);
72 const EffectProps DedicatedEffectProps{genDefaultProps()};