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/effects | |
parent | a80efab1749615e7cc0301ca7515e7a28db93191 (diff) |
Avoid some template hackery for EAX effect type functions
Diffstat (limited to 'al/effects')
-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 |
11 files changed, 66 insertions, 162 deletions
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(); } } |