Cleanup some formatting in alext.h
[openal-soft.git] / al / effects / null.cpp
blob2fa9cb6d4aa77ffec6946415a3dc0b0cd88e74e0
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/effect.h"
12 #include "al/eax/exception.h"
13 #endif // ALSOFT_EAX
16 namespace {
18 constexpr EffectProps genDefaultProps() noexcept
20 return std::monostate{};
23 } // namespace
25 const EffectProps NullEffectProps{genDefaultProps()};
27 void NullEffectHandler::SetParami(std::monostate& /*props*/, ALenum param, int /*val*/)
29 switch(param)
31 default:
32 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x",
33 param};
36 void NullEffectHandler::SetParamiv(std::monostate &props, ALenum param, const int *vals)
38 switch(param)
40 default:
41 SetParami(props, param, *vals);
44 void NullEffectHandler::SetParamf(std::monostate& /*props*/, ALenum param, float /*val*/)
46 switch(param)
48 default:
49 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect float property 0x%04x",
50 param};
53 void NullEffectHandler::SetParamfv(std::monostate &props, ALenum param, const float *vals)
55 switch(param)
57 default:
58 SetParamf(props, param, *vals);
62 void NullEffectHandler::GetParami(const std::monostate& /*props*/, ALenum param, int* /*val*/)
64 switch(param)
66 default:
67 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x",
68 param};
71 void NullEffectHandler::GetParamiv(const std::monostate &props, ALenum param, int *vals)
73 switch(param)
75 default:
76 GetParami(props, param, vals);
79 void NullEffectHandler::GetParamf(const std::monostate& /*props*/, ALenum param, float* /*val*/)
81 switch(param)
83 default:
84 throw effect_exception{AL_INVALID_ENUM, "Invalid null effect float property 0x%04x",
85 param};
88 void NullEffectHandler::GetParamfv(const std::monostate &props, ALenum param, float *vals)
90 switch(param)
92 default:
93 GetParamf(props, param, vals);
98 #ifdef ALSOFT_EAX
99 namespace {
101 using NullCommitter = EaxCommitter<EaxNullCommitter>;
103 } // namespace
105 template<>
106 struct NullCommitter::Exception : public EaxException
108 explicit Exception(const char *message) : EaxException{"EAX_NULL_EFFECT", message}
112 template<>
113 [[noreturn]] void NullCommitter::fail(const char *message)
115 throw Exception{message};
118 bool EaxNullCommitter::commit(const std::monostate &props)
120 const bool ret{std::holds_alternative<std::monostate>(mEaxProps)};
121 mEaxProps = props;
122 mAlProps = std::monostate{};
123 return ret;
126 void EaxNullCommitter::SetDefaults(EaxEffectProps &props)
128 props = std::monostate{};
131 void EaxNullCommitter::Get(const EaxCall &call, const std::monostate&)
133 if(call.get_property_id() != 0)
134 fail_unknown_property_id();
137 void EaxNullCommitter::Set(const EaxCall &call, std::monostate&)
139 if(call.get_property_id() != 0)
140 fail_unknown_property_id();
143 #endif // ALSOFT_EAX