diff options
author | Chris Robinson <[email protected]> | 2023-12-22 22:21:33 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-22 22:21:33 -0800 |
commit | c253a4353227be00ecd7995b8c7443ebfcd6d5a9 (patch) | |
tree | c18d4564971c54c12db794030ae377a2bfe68656 /al | |
parent | a80efab1749615e7cc0301ca7515e7a28db93191 (diff) |
Avoid some template hackery for EAX effect type functions
Diffstat (limited to 'al')
-rw-r--r-- | al/eax/effect.h | 156 | ||||
-rw-r--r-- | al/effects/autowah.cpp | 12 | ||||
-rw-r--r-- | al/effects/chorus.cpp | 24 | ||||
-rw-r--r-- | al/effects/compressor.cpp | 12 | ||||
-rw-r--r-- | al/effects/distortion.cpp | 12 | ||||
-rw-r--r-- | al/effects/echo.cpp | 12 | ||||
-rw-r--r-- | al/effects/equalizer.cpp | 12 | ||||
-rw-r--r-- | al/effects/fshifter.cpp | 12 | ||||
-rw-r--r-- | al/effects/modulator.cpp | 12 | ||||
-rw-r--r-- | al/effects/null.cpp | 12 | ||||
-rw-r--r-- | al/effects/pshifter.cpp | 12 | ||||
-rw-r--r-- | al/effects/vmorpher.cpp | 96 |
12 files changed, 169 insertions, 215 deletions
diff --git a/al/eax/effect.h b/al/eax/effect.h index 4108f65f..ce581990 100644 --- a/al/eax/effect.h +++ b/al/eax/effect.h @@ -144,6 +144,10 @@ struct EaxCommitter { [[noreturn]] static void fail(const char *message); [[noreturn]] static void fail_unknown_property_id() { fail(EaxEffectErrorMessages::unknown_property_id()); } +}; + +struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> { + using EaxCommitter<EaxAutowahCommitter>::EaxCommitter; bool commit(const EaxEffectProps &props); @@ -151,42 +155,104 @@ struct EaxCommitter { static void Get(const EaxCall &call, const EaxEffectProps &props); static void Set(const EaxCall &call, EaxEffectProps &props); }; - -struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> { - using EaxCommitter<EaxAutowahCommitter>::EaxCommitter; -}; struct EaxChorusCommitter : public EaxCommitter<EaxChorusCommitter> { using EaxCommitter<EaxChorusCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxCompressorCommitter : public EaxCommitter<EaxCompressorCommitter> { using EaxCommitter<EaxCompressorCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxDistortionCommitter : public EaxCommitter<EaxDistortionCommitter> { using EaxCommitter<EaxDistortionCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxEchoCommitter : public EaxCommitter<EaxEchoCommitter> { using EaxCommitter<EaxEchoCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxEqualizerCommitter : public EaxCommitter<EaxEqualizerCommitter> { using EaxCommitter<EaxEqualizerCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxFlangerCommitter : public EaxCommitter<EaxFlangerCommitter> { using EaxCommitter<EaxFlangerCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxFrequencyShifterCommitter : public EaxCommitter<EaxFrequencyShifterCommitter> { using EaxCommitter<EaxFrequencyShifterCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxModulatorCommitter : public EaxCommitter<EaxModulatorCommitter> { using EaxCommitter<EaxModulatorCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxPitchShifterCommitter : public EaxCommitter<EaxPitchShifterCommitter> { using EaxCommitter<EaxPitchShifterCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxVocalMorpherCommitter : public EaxCommitter<EaxVocalMorpherCommitter> { using EaxCommitter<EaxVocalMorpherCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; struct EaxNullCommitter : public EaxCommitter<EaxNullCommitter> { using EaxCommitter<EaxNullCommitter>::EaxCommitter; + + bool commit(const EaxEffectProps &props); + + static void SetDefaults(EaxEffectProps &props); + static void Get(const EaxCall &call, const EaxEffectProps &props); + static void Set(const EaxCall &call, EaxEffectProps &props); }; template<typename T> @@ -253,43 +319,39 @@ public: State4 state5_{}; - template<typename T, typename ...Args> - void call_set_defaults(Args&& ...args) - { return T::SetDefaults(std::forward<Args>(args)...); } - void call_set_defaults(const ALenum altype, EaxEffectProps &props) { switch(altype) { - case AL_EFFECT_EAXREVERB: return call_set_defaults<EaxReverbCommitter>(props); - case AL_EFFECT_CHORUS: return call_set_defaults<EaxChorusCommitter>(props); - case AL_EFFECT_AUTOWAH: return call_set_defaults<EaxAutowahCommitter>(props); - case AL_EFFECT_COMPRESSOR: return call_set_defaults<EaxCompressorCommitter>(props); - case AL_EFFECT_DISTORTION: return call_set_defaults<EaxDistortionCommitter>(props); - case AL_EFFECT_ECHO: return call_set_defaults<EaxEchoCommitter>(props); - case AL_EFFECT_EQUALIZER: return call_set_defaults<EaxEqualizerCommitter>(props); - case AL_EFFECT_FLANGER: return call_set_defaults<EaxFlangerCommitter>(props); - case AL_EFFECT_FREQUENCY_SHIFTER: return call_set_defaults<EaxFrequencyShifterCommitter>(props); - case AL_EFFECT_RING_MODULATOR: return call_set_defaults<EaxModulatorCommitter>(props); - case AL_EFFECT_PITCH_SHIFTER: return call_set_defaults<EaxPitchShifterCommitter>(props); - case AL_EFFECT_VOCAL_MORPHER: return call_set_defaults<EaxVocalMorpherCommitter>(props); + case AL_EFFECT_EAXREVERB: return EaxReverbCommitter::SetDefaults(props); + case AL_EFFECT_CHORUS: return EaxChorusCommitter::SetDefaults(props); + case AL_EFFECT_AUTOWAH: return EaxAutowahCommitter::SetDefaults(props); + case AL_EFFECT_COMPRESSOR: return EaxCompressorCommitter::SetDefaults(props); + case AL_EFFECT_DISTORTION: return EaxDistortionCommitter::SetDefaults(props); + case AL_EFFECT_ECHO: return EaxEchoCommitter::SetDefaults(props); + case AL_EFFECT_EQUALIZER: return EaxEqualizerCommitter::SetDefaults(props); + case AL_EFFECT_FLANGER: return EaxFlangerCommitter::SetDefaults(props); + case AL_EFFECT_FREQUENCY_SHIFTER: return EaxFrequencyShifterCommitter::SetDefaults(props); + case AL_EFFECT_RING_MODULATOR: return EaxModulatorCommitter::SetDefaults(props); + case AL_EFFECT_PITCH_SHIFTER: return EaxPitchShifterCommitter::SetDefaults(props); + case AL_EFFECT_VOCAL_MORPHER: return EaxVocalMorpherCommitter::SetDefaults(props); case AL_EFFECT_NULL: break; } - return call_set_defaults<EaxNullCommitter>(props); + return EaxNullCommitter::SetDefaults(props); } template<typename T> void init() { - call_set_defaults<EaxReverbCommitter>(state1_.d); + EaxReverbCommitter::SetDefaults(state1_.d); state1_.i = state1_.d; - call_set_defaults<EaxReverbCommitter>(state2_.d); + EaxReverbCommitter::SetDefaults(state2_.d); state2_.i = state2_.d; - call_set_defaults<EaxReverbCommitter>(state3_.d); + EaxReverbCommitter::SetDefaults(state3_.d); state3_.i = state3_.d; - call_set_defaults<T>(state4_.d); + T::SetDefaults(state4_.d); state4_.i = state4_.d; - call_set_defaults<T>(state5_.d); + T::SetDefaults(state5_.d); state5_.i = state5_.d; } @@ -297,9 +359,9 @@ public: { switch(eax_version) { - case 1: call_set_defaults<EaxReverbCommitter>(state1_.d); break; - case 2: call_set_defaults<EaxReverbCommitter>(state2_.d); break; - case 3: call_set_defaults<EaxReverbCommitter>(state3_.d); break; + case 1: EaxReverbCommitter::SetDefaults(state1_.d); break; + case 2: EaxReverbCommitter::SetDefaults(state2_.d); break; + case 3: EaxReverbCommitter::SetDefaults(state3_.d); break; case 4: call_set_defaults(altype, state4_.d); break; case 5: call_set_defaults(altype, state5_.d); break; } @@ -307,14 +369,10 @@ public: } - template<typename T, typename ...Args> - static void call_set(Args&& ...args) - { return T::Set(std::forward<Args>(args)...); } - static void call_set(const EaxCall &call, EaxEffectProps &props) { return std::visit([&](const auto &arg) - { return call_set<CommitterFor<decltype(arg)>>(call, props); }, + { return CommitterFor<decltype(arg)>::Set(call, props); }, props); } @@ -322,9 +380,9 @@ public: { switch(call.get_version()) { - case 1: call_set<EaxReverbCommitter>(call, state1_.d); break; - case 2: call_set<EaxReverbCommitter>(call, state2_.d); break; - case 3: call_set<EaxReverbCommitter>(call, state3_.d); break; + case 1: EaxReverbCommitter::Set(call, state1_.d); break; + case 2: EaxReverbCommitter::Set(call, state2_.d); break; + case 3: EaxReverbCommitter::Set(call, state3_.d); break; case 4: call_set(call, state4_.d); break; case 5: call_set(call, state5_.d); break; } @@ -332,14 +390,10 @@ public: } - template<typename T, typename ...Args> - static void call_get(Args&& ...args) - { return T::Get(std::forward<Args>(args)...); } - static void call_get(const EaxCall &call, const EaxEffectProps &props) { return std::visit([&](const auto &arg) - { return call_get<CommitterFor<decltype(arg)>>(call, props); }, + { return CommitterFor<decltype(arg)>::Get(call, props); }, props); } @@ -347,23 +401,19 @@ public: { switch(call.get_version()) { - case 1: call_get<EaxReverbCommitter>(call, state1_.d); break; - case 2: call_get<EaxReverbCommitter>(call, state2_.d); break; - case 3: call_get<EaxReverbCommitter>(call, state3_.d); break; + case 1: EaxReverbCommitter::Get(call, state1_.d); break; + case 2: EaxReverbCommitter::Get(call, state2_.d); break; + case 3: EaxReverbCommitter::Get(call, state3_.d); break; case 4: call_get(call, state4_.d); break; case 5: call_get(call, state5_.d); break; } } - template<typename T, typename ...Args> - bool call_commit(Args&& ...args) - { return T{props_, al_effect_props_}.commit(std::forward<Args>(args)...); } - bool call_commit(const EaxEffectProps &props) { return std::visit([&](const auto &arg) - { return call_commit<CommitterFor<decltype(arg)>>(props); }, + { return CommitterFor<decltype(arg)>{props_, al_effect_props_}.commit(props); }, props); } @@ -380,15 +430,15 @@ public: { case 1: state1_.i = state1_.d; - ret |= call_commit<EaxReverbCommitter>(state1_.d); + ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state1_.d); break; case 2: state2_.i = state2_.d; - ret |= call_commit<EaxReverbCommitter>(state2_.d); + ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state2_.d); break; case 3: state3_.i = state3_.d; - ret |= call_commit<EaxReverbCommitter>(state3_.d); + ret |= EaxReverbCommitter{props_, al_effect_props_}.commit(state3_.d); break; case 4: state4_.i = state4_.d; diff --git a/al/effects/autowah.cpp b/al/effects/autowah.cpp index 1a8b43fc..c7ddbdb5 100644 --- a/al/effects/autowah.cpp +++ b/al/effects/autowah.cpp @@ -189,8 +189,7 @@ template<> throw Exception{message}; } -template<> -bool AutowahCommitter::commit(const EaxEffectProps &props) +bool EaxAutowahCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -206,8 +205,7 @@ bool AutowahCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void AutowahCommitter::SetDefaults(EaxEffectProps &props) +void EaxAutowahCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXAUTOWAHPROPERTIES defprops{[] { @@ -221,8 +219,7 @@ void AutowahCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void AutowahCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxAutowahCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXAUTOWAHPROPERTIES>(props_); switch(call.get_property_id()) @@ -237,8 +234,7 @@ void AutowahCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -template<> -void AutowahCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxAutowahCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXAUTOWAHPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp index 90b38e4d..61aab28f 100644 --- a/al/effects/chorus.cpp +++ b/al/effects/chorus.cpp @@ -638,29 +638,25 @@ template<> throw Exception{message}; } -template<> -bool ChorusCommitter::commit(const EaxEffectProps &props) +bool EaxChorusCommitter::commit(const EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; return Committer::Commit(props, mEaxProps, mAlProps); } -template<> -void ChorusCommitter::SetDefaults(EaxEffectProps &props) +void EaxChorusCommitter::SetDefaults(EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; Committer::SetDefaults(props); } -template<> -void ChorusCommitter::Get(const EaxCall &call, const EaxEffectProps &props) +void EaxChorusCommitter::Get(const EaxCall &call, const EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; Committer::Get(call, props); } -template<> -void ChorusCommitter::Set(const EaxCall &call, EaxEffectProps &props) +void EaxChorusCommitter::Set(const EaxCall &call, EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; Committer::Set(call, props); @@ -679,29 +675,25 @@ template<> throw Exception{message}; } -template<> -bool FlangerCommitter::commit(const EaxEffectProps &props) +bool EaxFlangerCommitter::commit(const EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; return Committer::Commit(props, mEaxProps, mAlProps); } -template<> -void FlangerCommitter::SetDefaults(EaxEffectProps &props) +void EaxFlangerCommitter::SetDefaults(EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; Committer::SetDefaults(props); } -template<> -void FlangerCommitter::Get(const EaxCall &call, const EaxEffectProps &props) +void EaxFlangerCommitter::Get(const EaxCall &call, const EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; Committer::Get(call, props); } -template<> -void FlangerCommitter::Set(const EaxCall &call, EaxEffectProps &props) +void EaxFlangerCommitter::Set(const EaxCall &call, EaxEffectProps &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; Committer::Set(call, props); diff --git a/al/effects/compressor.cpp b/al/effects/compressor.cpp index ca8af84f..6dc96a20 100644 --- a/al/effects/compressor.cpp +++ b/al/effects/compressor.cpp @@ -115,8 +115,7 @@ template<> throw Exception{message}; } -template<> -bool CompressorCommitter::commit(const EaxEffectProps &props) +bool EaxCompressorCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -127,14 +126,12 @@ bool CompressorCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void CompressorCommitter::SetDefaults(EaxEffectProps &props) +void EaxCompressorCommitter::SetDefaults(EaxEffectProps &props) { props = EAXAGCCOMPRESSORPROPERTIES{EAXAGCCOMPRESSOR_DEFAULTONOFF}; } -template<> -void CompressorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxCompressorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXAGCCOMPRESSORPROPERTIES>(props_); switch(call.get_property_id()) @@ -146,8 +143,7 @@ void CompressorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -template<> -void CompressorCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxCompressorCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXAGCCOMPRESSORPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp index e046d8e7..9142398b 100644 --- a/al/effects/distortion.cpp +++ b/al/effects/distortion.cpp @@ -204,8 +204,7 @@ template<> throw Exception{message}; } -template<> -bool DistortionCommitter::commit(const EaxEffectProps &props) +bool EaxDistortionCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -222,8 +221,7 @@ bool DistortionCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void DistortionCommitter::SetDefaults(EaxEffectProps &props) +void EaxDistortionCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXDISTORTIONPROPERTIES defprops{[] { @@ -238,8 +236,7 @@ void DistortionCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void DistortionCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxDistortionCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXDISTORTIONPROPERTIES>(props_); switch(call.get_property_id()) @@ -255,8 +252,7 @@ void DistortionCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -template<> -void DistortionCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxDistortionCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXDISTORTIONPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/echo.cpp b/al/effects/echo.cpp index 48aacef3..bfec6885 100644 --- a/al/effects/echo.cpp +++ b/al/effects/echo.cpp @@ -201,8 +201,7 @@ template<> throw Exception{message}; } -template<> -bool EchoCommitter::commit(const EaxEffectProps &props) +bool EaxEchoCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -219,8 +218,7 @@ bool EchoCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void EchoCommitter::SetDefaults(EaxEffectProps &props) +void EaxEchoCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXECHOPROPERTIES defprops{[] { @@ -235,8 +233,7 @@ void EchoCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void EchoCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxEchoCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXECHOPROPERTIES>(props_); switch(call.get_property_id()) @@ -252,8 +249,7 @@ void EchoCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -template<> -void EchoCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxEchoCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXECHOPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp index 76d5bdef..b16be2a5 100644 --- a/al/effects/equalizer.cpp +++ b/al/effects/equalizer.cpp @@ -319,8 +319,7 @@ template<> throw Exception{message}; } -template<> -bool EqualizerCommitter::commit(const EaxEffectProps &props) +bool EaxEqualizerCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -342,8 +341,7 @@ bool EqualizerCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void EqualizerCommitter::SetDefaults(EaxEffectProps &props) +void EaxEqualizerCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXEQUALIZERPROPERTIES defprops{[] { @@ -363,8 +361,7 @@ void EqualizerCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void EqualizerCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxEqualizerCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXEQUALIZERPROPERTIES>(props_); switch(call.get_property_id()) @@ -385,8 +382,7 @@ void EqualizerCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -template<> -void EqualizerCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxEqualizerCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXEQUALIZERPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp index 37c372c3..45253563 100644 --- a/al/effects/fshifter.cpp +++ b/al/effects/fshifter.cpp @@ -197,8 +197,7 @@ template<> throw Exception{message}; } -template<> -bool FrequencyShifterCommitter::commit(const EaxEffectProps &props) +bool EaxFrequencyShifterCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -222,8 +221,7 @@ bool FrequencyShifterCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void FrequencyShifterCommitter::SetDefaults(EaxEffectProps &props) +void EaxFrequencyShifterCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXFREQUENCYSHIFTERPROPERTIES defprops{[] { @@ -236,8 +234,7 @@ void FrequencyShifterCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void FrequencyShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxFrequencyShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXFREQUENCYSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) @@ -251,8 +248,7 @@ void FrequencyShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &p } } -template<> -void FrequencyShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxFrequencyShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXFREQUENCYSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp index 366e7ef7..8bab41c9 100644 --- a/al/effects/modulator.cpp +++ b/al/effects/modulator.cpp @@ -203,8 +203,7 @@ template<> throw Exception{message}; } -template<> -bool ModulatorCommitter::commit(const EaxEffectProps &props) +bool EaxModulatorCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -230,8 +229,7 @@ bool ModulatorCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void ModulatorCommitter::SetDefaults(EaxEffectProps &props) +void EaxModulatorCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXRINGMODULATORPROPERTIES defprops{[] { @@ -244,8 +242,7 @@ void ModulatorCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void ModulatorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxModulatorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXRINGMODULATORPROPERTIES>(props_); switch(call.get_property_id()) @@ -259,8 +256,7 @@ void ModulatorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -template<> -void ModulatorCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxModulatorCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXRINGMODULATORPROPERTIES>(props_); switch (call.get_property_id()) diff --git a/al/effects/null.cpp b/al/effects/null.cpp index 1e8787e7..5d8e717e 100644 --- a/al/effects/null.cpp +++ b/al/effects/null.cpp @@ -117,29 +117,25 @@ template<> throw Exception{message}; } -template<> -bool NullCommitter::commit(const EaxEffectProps &props) +bool EaxNullCommitter::commit(const EaxEffectProps &props) { const bool ret{props != mEaxProps}; mEaxProps = props; return ret; } -template<> -void NullCommitter::SetDefaults(EaxEffectProps &props) +void EaxNullCommitter::SetDefaults(EaxEffectProps &props) { props.emplace<std::monostate>(); } -template<> -void NullCommitter::Get(const EaxCall &call, const EaxEffectProps&) +void EaxNullCommitter::Get(const EaxCall &call, const EaxEffectProps&) { if(call.get_property_id() != 0) fail_unknown_property_id(); } -template<> -void NullCommitter::Set(const EaxCall &call, EaxEffectProps&) +void EaxNullCommitter::Set(const EaxCall &call, EaxEffectProps&) { if(call.get_property_id() != 0) fail_unknown_property_id(); diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp index 10824016..93b4fefe 100644 --- a/al/effects/pshifter.cpp +++ b/al/effects/pshifter.cpp @@ -138,8 +138,7 @@ template<> throw Exception{message}; } -template<> -bool PitchShifterCommitter::commit(const EaxEffectProps &props) +bool EaxPitchShifterCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -153,15 +152,13 @@ bool PitchShifterCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void PitchShifterCommitter::SetDefaults(EaxEffectProps &props) +void EaxPitchShifterCommitter::SetDefaults(EaxEffectProps &props) { props = EAXPITCHSHIFTERPROPERTIES{EAXPITCHSHIFTER_DEFAULTCOARSETUNE, EAXPITCHSHIFTER_DEFAULTFINETUNE}; } -template<> -void PitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxPitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXPITCHSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) @@ -174,8 +171,7 @@ void PitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props } } -template<> -void PitchShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxPitchShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXPITCHSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp index f2551229..b747d216 100644 --- a/al/effects/vmorpher.cpp +++ b/al/effects/vmorpher.cpp @@ -352,8 +352,7 @@ template<> throw Exception{message}; } -template<> -bool VocalMorpherCommitter::commit(const EaxEffectProps &props) +bool EaxVocalMorpherCommitter::commit(const EaxEffectProps &props) { if(props == mEaxProps) return false; @@ -418,8 +417,7 @@ bool VocalMorpherCommitter::commit(const EaxEffectProps &props) return true; } -template<> -void VocalMorpherCommitter::SetDefaults(EaxEffectProps &props) +void EaxVocalMorpherCommitter::SetDefaults(EaxEffectProps &props) { static constexpr EAXVOCALMORPHERPROPERTIES defprops{[] { @@ -435,87 +433,37 @@ void VocalMorpherCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -template<> -void VocalMorpherCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxVocalMorpherCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { auto &props = std::get<EAXVOCALMORPHERPROPERTIES>(props_); switch(call.get_property_id()) { - case EAXVOCALMORPHER_NONE: - break; - - case EAXVOCALMORPHER_ALLPARAMETERS: - call.set_value<Exception>(props); - break; - - case EAXVOCALMORPHER_PHONEMEA: - call.set_value<Exception>(props.ulPhonemeA); - break; - - case EAXVOCALMORPHER_PHONEMEACOARSETUNING: - call.set_value<Exception>(props.lPhonemeACoarseTuning); - break; - - case EAXVOCALMORPHER_PHONEMEB: - call.set_value<Exception>(props.ulPhonemeB); - break; - - case EAXVOCALMORPHER_PHONEMEBCOARSETUNING: - call.set_value<Exception>(props.lPhonemeBCoarseTuning); - break; - - case EAXVOCALMORPHER_WAVEFORM: - call.set_value<Exception>(props.ulWaveform); - break; - - case EAXVOCALMORPHER_RATE: - call.set_value<Exception>(props.flRate); - break; - - default: - fail_unknown_property_id(); + case EAXVOCALMORPHER_NONE: break; + case EAXVOCALMORPHER_ALLPARAMETERS: call.set_value<Exception>(props); break; + case EAXVOCALMORPHER_PHONEMEA: call.set_value<Exception>(props.ulPhonemeA); break; + case EAXVOCALMORPHER_PHONEMEACOARSETUNING: call.set_value<Exception>(props.lPhonemeACoarseTuning); break; + case EAXVOCALMORPHER_PHONEMEB: call.set_value<Exception>(props.ulPhonemeB); break; + case EAXVOCALMORPHER_PHONEMEBCOARSETUNING: call.set_value<Exception>(props.lPhonemeBCoarseTuning); break; + case EAXVOCALMORPHER_WAVEFORM: call.set_value<Exception>(props.ulWaveform); break; + case EAXVOCALMORPHER_RATE: call.set_value<Exception>(props.flRate); break; + default: fail_unknown_property_id(); } } -template<> -void VocalMorpherCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxVocalMorpherCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { auto &props = std::get<EAXVOCALMORPHERPROPERTIES>(props_); switch(call.get_property_id()) { - case EAXVOCALMORPHER_NONE: - break; - - case EAXVOCALMORPHER_ALLPARAMETERS: - defer<AllValidator>(call, props); - break; - - case EAXVOCALMORPHER_PHONEMEA: - defer<PhonemeAValidator>(call, props.ulPhonemeA); - break; - - case EAXVOCALMORPHER_PHONEMEACOARSETUNING: - defer<PhonemeACoarseTuningValidator>(call, props.lPhonemeACoarseTuning); - break; - - case EAXVOCALMORPHER_PHONEMEB: - defer<PhonemeBValidator>(call, props.ulPhonemeB); - break; - - case EAXVOCALMORPHER_PHONEMEBCOARSETUNING: - defer<PhonemeBCoarseTuningValidator>(call, props.lPhonemeBCoarseTuning); - break; - - case EAXVOCALMORPHER_WAVEFORM: - defer<WaveformValidator>(call, props.ulWaveform); - break; - - case EAXVOCALMORPHER_RATE: - defer<RateValidator>(call, props.flRate); - break; - - default: - fail_unknown_property_id(); + case EAXVOCALMORPHER_NONE: break; + case EAXVOCALMORPHER_ALLPARAMETERS: defer<AllValidator>(call, props); break; + case EAXVOCALMORPHER_PHONEMEA: defer<PhonemeAValidator>(call, props.ulPhonemeA); break; + case EAXVOCALMORPHER_PHONEMEACOARSETUNING: defer<PhonemeACoarseTuningValidator>(call, props.lPhonemeACoarseTuning); break; + case EAXVOCALMORPHER_PHONEMEB: defer<PhonemeBValidator>(call, props.ulPhonemeB); break; + case EAXVOCALMORPHER_PHONEMEBCOARSETUNING: defer<PhonemeBCoarseTuningValidator>(call, props.lPhonemeBCoarseTuning); break; + case EAXVOCALMORPHER_WAVEFORM: defer<WaveformValidator>(call, props.ulWaveform); break; + case EAXVOCALMORPHER_RATE: defer<RateValidator>(call, props.flRate); break; + default: fail_unknown_property_id(); } } |