diff options
Diffstat (limited to 'al/effects/null.cpp')
-rw-r--r-- | al/effects/null.cpp | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/al/effects/null.cpp b/al/effects/null.cpp index 8b11f20c..e80ab9f8 100644 --- a/al/effects/null.cpp +++ b/al/effects/null.cpp @@ -100,64 +100,50 @@ const EffectProps NullEffectProps{genDefaultProps()}; #ifdef ALSOFT_EAX namespace { -class EaxNullEffectException : public EaxException -{ -public: - explicit EaxNullEffectException(const char* message) - : EaxException{"EAX_NULL_EFFECT", message} - {} -}; // EaxNullEffectException - -class EaxNullEffect final : public EaxEffect4<EaxNullEffectException> -{ -public: - EaxNullEffect(int eax_version); - -private: - void set_defaults(Props4& props) override; - - void set_efx_defaults() override; +using NullCommitter = EaxCommitter<EaxNullCommitter>; - void get(const EaxCall& call, const Props4& props) override; - void set(const EaxCall& call, Props4& props) override; - bool commit_props(const Props4& props) override; -}; // EaxCompressorEffect +} // namespace -EaxNullEffect::EaxNullEffect(int eax_version) - : EaxEffect4{AL_EFFECT_NULL, eax_version} -{} +template<> +struct NullCommitter::Exception : public EaxException +{ + explicit Exception(const char *message) : EaxException{"EAX_NULL_EFFECT", message} + { } +}; -void EaxNullEffect::set_defaults(Props4& props) +template<> +[[noreturn]] void NullCommitter::fail(const char *message) { - props.mType = EaxEffectType::None; + throw Exception{message}; } -void EaxNullEffect::set_efx_defaults() +template<> +bool NullCommitter::commit(const EaxEffectProps &props) { + const bool ret{props.mType != props_.mType}; + props_ = props; + return ret; } -void EaxNullEffect::get(const EaxCall& call, const Props4&) +template<> +void NullCommitter::SetDefaults(EaxEffectProps &props) { - if(call.get_property_id() != 0) - fail_unknown_property_id(); + props = EaxEffectProps{}; + props.mType = EaxEffectType::None; } -void EaxNullEffect::set(const EaxCall& call, Props4&) +template<> +void NullCommitter::Get(const EaxCall &call, const EaxEffectProps&) { if(call.get_property_id() != 0) fail_unknown_property_id(); } -bool EaxNullEffect::commit_props(const Props4&) +template<> +void NullCommitter::Set(const EaxCall &call, EaxEffectProps&) { - return false; -} - -} // namespace - -EaxEffectUPtr eax_create_eax_null_effect(int eax_version) -{ - return std::make_unique<EaxNullEffect>(eax_version); + if(call.get_property_id() != 0) + fail_unknown_property_id(); } #endif // ALSOFT_EAX |