Make some local constexpr variables static
[openal-soft.git] / al / effects / null.cpp
blob78c0a61a42575e8cc3dd72fec9822d2f5736b8d9
2 #include "config.h"
4 #include "AL/al.h"
5 #include "AL/efx.h"
7 #include "alc/effects/base.h"
8 #include "effects.h"
10 #ifdef ALSOFT_EAX
11 #include "al/eax_exception.h"
12 #endif // ALSOFT_EAX
15 namespace {
17 void Null_setParami(EffectProps* /*props*/, ALenum param, int /*val*/)
19 switch(param)
21 default:
22 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x",
23 param};
26 void Null_setParamiv(EffectProps *props, ALenum param, const int *vals)
28 switch(param)
30 default:
31 Null_setParami(props, param, vals[0]);
34 void Null_setParamf(EffectProps* /*props*/, ALenum param, float /*val*/)
36 switch(param)
38 default:
39 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect float property 0x%04x",
40 param};
43 void Null_setParamfv(EffectProps *props, ALenum param, const float *vals)
45 switch(param)
47 default:
48 Null_setParamf(props, param, vals[0]);
52 void Null_getParami(const EffectProps* /*props*/, ALenum param, int* /*val*/)
54 switch(param)
56 default:
57 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x",
58 param};
61 void Null_getParamiv(const EffectProps *props, ALenum param, int *vals)
63 switch(param)
65 default:
66 Null_getParami(props, param, vals);
69 void Null_getParamf(const EffectProps* /*props*/, ALenum param, float* /*val*/)
71 switch(param)
73 default:
74 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect float property 0x%04x",
75 param};
78 void Null_getParamfv(const EffectProps *props, ALenum param, float *vals)
80 switch(param)
82 default:
83 Null_getParamf(props, param, vals);
87 EffectProps genDefaultProps() noexcept
89 EffectProps props{};
90 return props;
93 } // namespace
95 DEFINE_ALEFFECT_VTABLE(Null);
97 const EffectProps NullEffectProps{genDefaultProps()};
100 #ifdef ALSOFT_EAX
101 namespace {
103 class EaxNullEffect final :
104 public EaxEffect
106 public:
107 EaxNullEffect();
109 // [[nodiscard]]
110 bool dispatch(
111 const EaxEaxCall& eax_call) override;
112 }; // EaxNullEffect
115 class EaxNullEffectException :
116 public EaxException
118 public:
119 explicit EaxNullEffectException(
120 const char* message)
122 EaxException{"EAX_NULL_EFFECT", message}
125 }; // EaxNullEffectException
128 EaxNullEffect::EaxNullEffect()
129 : EaxEffect{AL_EFFECT_NULL}
133 // [[nodiscard]]
134 bool EaxNullEffect::dispatch(
135 const EaxEaxCall& eax_call)
137 if (eax_call.get_property_id() != 0)
139 throw EaxNullEffectException{"Unsupported property id."};
142 return false;
145 } // namespace
147 EaxEffectUPtr eax_create_eax_null_effect()
149 return std::make_unique<EaxNullEffect>();
152 #endif // ALSOFT_EAX