aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/pshifter.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-03-09 19:58:42 -0800
committerChris Robinson <[email protected]>2023-03-09 19:58:42 -0800
commit5b3c27ea587d84c2a49150b032f5d4dec5eb50b9 (patch)
tree76c8dfe3bf3a9a30d0d08ebb730bcf9fd5b5bdd4 /al/effects/pshifter.cpp
parent869778979787320bf254942936f7fb1e951e57ed (diff)
Store the per-version EAX effect state in the base class
This is the start of the refactoring for holding separable per-version EAX effects. Currently the effect state is stored in the effect object, which is instantiated per-type. This makes it impossible for different effects to be assigned on different EAX versions for a given effect slot (e.g. if the app sets a Chorus effect on EAX4 Slot0, it would fail to get or set the EAX1/2/3 reverb properties since it's a Chorus effect object). Seperate per-version effects will allow for switching the OpenAL effect by switching versions. This will provide an extra benefit in being able to delay OpenAL effect initialization until some EAX version has been set, avoiding an extraneous reverb and/or chorus processor for apps that only query some EAX properties but don't set anything (or which only use Slot0, leaving Slot1 with a defaulted Chorus effect running).
Diffstat (limited to 'al/effects/pshifter.cpp')
-rw-r--r--al/effects/pshifter.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp
index 9711da28..ef3fe587 100644
--- a/al/effects/pshifter.cpp
+++ b/al/effects/pshifter.cpp
@@ -100,7 +100,7 @@ public:
{}
}; // EaxPitchShifterEffectException
-class EaxPitchShifterEffect final : public EaxEffect4<EaxPitchShifterEffectException, EAXPITCHSHIFTERPROPERTIES> {
+class EaxPitchShifterEffect final : public EaxEffect4<EaxPitchShifterEffectException> {
public:
EaxPitchShifterEffect(int eax_version);
@@ -128,38 +128,38 @@ private:
}; // FineTuneValidator
struct AllValidator {
- void operator()(const Props& all) const
+ void operator()(const EAXPITCHSHIFTERPROPERTIES& all) const
{
CoarseTuneValidator{}(all.lCoarseTune);
FineTuneValidator{}(all.lFineTune);
}
}; // AllValidator
- void set_defaults(Props& props) override;
+ void set_defaults(Props4& props) override;
void set_efx_coarse_tune() noexcept;
void set_efx_fine_tune() noexcept;
void set_efx_defaults() override;
- void get(const EaxCall& call, const Props& props) override;
- void set(const EaxCall& call, Props& props) override;
- bool commit_props(const Props& old_i) override;
+ void get(const EaxCall& call, const Props4& props) override;
+ void set(const EaxCall& call, Props4& props) override;
+ bool commit_props(const Props4& old_i) override;
}; // EaxPitchShifterEffect
EaxPitchShifterEffect::EaxPitchShifterEffect(int eax_version)
: EaxEffect4{AL_EFFECT_PITCH_SHIFTER, eax_version}
{}
-void EaxPitchShifterEffect::set_defaults(Props& props)
+void EaxPitchShifterEffect::set_defaults(Props4& props)
{
- props.lCoarseTune = EAXPITCHSHIFTER_DEFAULTCOARSETUNE;
- props.lFineTune = EAXPITCHSHIFTER_DEFAULTFINETUNE;
+ props.mPitchShifter.lCoarseTune = EAXPITCHSHIFTER_DEFAULTCOARSETUNE;
+ props.mPitchShifter.lFineTune = EAXPITCHSHIFTER_DEFAULTFINETUNE;
}
void EaxPitchShifterEffect::set_efx_coarse_tune() noexcept
{
al_effect_props_.Pshifter.CoarseTune = clamp(
- static_cast<ALint>(props_.lCoarseTune),
+ static_cast<ALint>(props_.mPitchShifter.lCoarseTune),
AL_PITCH_SHIFTER_MIN_COARSE_TUNE,
AL_PITCH_SHIFTER_MAX_COARSE_TUNE);
}
@@ -167,7 +167,7 @@ void EaxPitchShifterEffect::set_efx_coarse_tune() noexcept
void EaxPitchShifterEffect::set_efx_fine_tune() noexcept
{
al_effect_props_.Pshifter.FineTune = clamp(
- static_cast<ALint>(props_.lFineTune),
+ static_cast<ALint>(props_.mPitchShifter.lFineTune),
AL_PITCH_SHIFTER_MIN_FINE_TUNE,
AL_PITCH_SHIFTER_MAX_FINE_TUNE);
}
@@ -178,41 +178,41 @@ void EaxPitchShifterEffect::set_efx_defaults()
set_efx_fine_tune();
}
-void EaxPitchShifterEffect::get(const EaxCall& call, const Props& props)
+void EaxPitchShifterEffect::get(const EaxCall& call, const Props4& props)
{
switch(call.get_property_id())
{
case EAXPITCHSHIFTER_NONE: break;
- case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props); break;
- case EAXPITCHSHIFTER_COARSETUNE: call.set_value<Exception>(props.lCoarseTune); break;
- case EAXPITCHSHIFTER_FINETUNE: call.set_value<Exception>(props.lFineTune); break;
+ case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props.mPitchShifter); break;
+ case EAXPITCHSHIFTER_COARSETUNE: call.set_value<Exception>(props.mPitchShifter.lCoarseTune); break;
+ case EAXPITCHSHIFTER_FINETUNE: call.set_value<Exception>(props.mPitchShifter.lFineTune); break;
default: fail_unknown_property_id();
}
}
-void EaxPitchShifterEffect::set(const EaxCall& call, Props& props)
+void EaxPitchShifterEffect::set(const EaxCall& call, Props4& props)
{
switch(call.get_property_id())
{
case EAXPITCHSHIFTER_NONE: break;
- case EAXPITCHSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props); break;
- case EAXPITCHSHIFTER_COARSETUNE: defer<CoarseTuneValidator>(call, props.lCoarseTune); break;
- case EAXPITCHSHIFTER_FINETUNE: defer<FineTuneValidator>(call, props.lFineTune); break;
+ case EAXPITCHSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props.mPitchShifter); break;
+ case EAXPITCHSHIFTER_COARSETUNE: defer<CoarseTuneValidator>(call, props.mPitchShifter.lCoarseTune); break;
+ case EAXPITCHSHIFTER_FINETUNE: defer<FineTuneValidator>(call, props.mPitchShifter.lFineTune); break;
default: fail_unknown_property_id();
}
}
-bool EaxPitchShifterEffect::commit_props(const Props& props)
+bool EaxPitchShifterEffect::commit_props(const Props4& props)
{
auto is_dirty = false;
- if (props_.lCoarseTune != props.lCoarseTune)
+ if (props_.mPitchShifter.lCoarseTune != props.mPitchShifter.lCoarseTune)
{
is_dirty = true;
set_efx_coarse_tune();
}
- if (props_.lFineTune != props.lFineTune)
+ if (props_.mPitchShifter.lFineTune != props.mPitchShifter.lFineTune)
{
is_dirty = true;
set_efx_fine_tune();