aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/distortion.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-03-05 01:14:26 -0800
committerChris Robinson <[email protected]>2022-03-05 01:14:26 -0800
commit2dc9cf170c08f0b7f35ec46cb17c829888e7392c (patch)
tree76865c75ba9cd0dce3452988ff28ac7636a82872 /al/effects/distortion.cpp
parent7bec22abb61fa1b87e157dd6b577ba174d3273d3 (diff)
Simplify committing EAX properties
Based on DirectSound's EAX behavior, committing any EAX property commits *all* deferred property changes, not just the object being changed. So applying EAX changes can be handled in one place.
Diffstat (limited to 'al/effects/distortion.cpp')
-rw-r--r--al/effects/distortion.cpp129
1 files changed, 31 insertions, 98 deletions
diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp
index 0f4b6ed5..13b1f23d 100644
--- a/al/effects/distortion.cpp
+++ b/al/effects/distortion.cpp
@@ -143,10 +143,7 @@ class EaxDistortionEffect final :
public:
EaxDistortionEffect();
-
- // [[nodiscard]]
- bool dispatch(
- const EaxEaxCall& eax_call) override;
+ void dispatch(const EaxEaxCall& eax_call) override;
// [[nodiscard]]
bool apply_deferred() override;
@@ -156,88 +153,39 @@ private:
EAXDISTORTIONPROPERTIES eax_d_{};
EaxDistortionEffectDirtyFlags eax_dirty_flags_{};
-
void set_eax_defaults();
-
void set_efx_edge();
-
void set_efx_gain();
-
void set_efx_lowpass_cutoff();
-
void set_efx_eq_center();
-
void set_efx_eq_bandwidth();
-
void set_efx_defaults();
-
- // [[nodiscard]]
- bool get(
- const EaxEaxCall& eax_call);
-
-
- void validate_edge(
- float flEdge);
-
- void validate_gain(
- long lGain);
-
- void validate_lowpass_cutoff(
- float flLowPassCutOff);
-
- void validate_eq_center(
- float flEQCenter);
-
- void validate_eq_bandwidth(
- float flEQBandwidth);
-
- void validate_all(
- const EAXDISTORTIONPROPERTIES& eax_all);
-
-
- void defer_edge(
- float flEdge);
-
- void defer_gain(
- long lGain);
-
- void defer_low_pass_cutoff(
- float flLowPassCutOff);
-
- void defer_eq_center(
- float flEQCenter);
-
- void defer_eq_bandwidth(
- float flEQBandwidth);
-
- void defer_all(
- const EAXDISTORTIONPROPERTIES& eax_all);
-
-
- void defer_edge(
- const EaxEaxCall& eax_call);
-
- void defer_gain(
- const EaxEaxCall& eax_call);
-
- void defer_low_pass_cutoff(
- const EaxEaxCall& eax_call);
-
- void defer_eq_center(
- const EaxEaxCall& eax_call);
-
- void defer_eq_bandwidth(
- const EaxEaxCall& eax_call);
-
- void defer_all(
- const EaxEaxCall& eax_call);
-
-
- // [[nodiscard]]
- bool set(
- const EaxEaxCall& eax_call);
+ void get(const EaxEaxCall& eax_call);
+
+ void validate_edge(float flEdge);
+ void validate_gain(long lGain);
+ void validate_lowpass_cutoff(float flLowPassCutOff);
+ void validate_eq_center(float flEQCenter);
+ void validate_eq_bandwidth(float flEQBandwidth);
+ void validate_all(const EAXDISTORTIONPROPERTIES& eax_all);
+
+ void defer_edge(float flEdge);
+ void defer_gain(long lGain);
+ void defer_low_pass_cutoff(float flLowPassCutOff);
+ void defer_eq_center(float flEQCenter);
+ void defer_eq_bandwidth(float flEQBandwidth);
+ void defer_all(const EAXDISTORTIONPROPERTIES& eax_all);
+
+ void defer_edge(const EaxEaxCall& eax_call);
+ void defer_gain(const EaxEaxCall& eax_call);
+ void defer_low_pass_cutoff(const EaxEaxCall& eax_call);
+ void defer_eq_center(const EaxEaxCall& eax_call);
+ void defer_eq_bandwidth(const EaxEaxCall& eax_call);
+ void defer_all(const EaxEaxCall& eax_call);
+
+ void set(const EaxEaxCall& eax_call);
}; // EaxDistortionEffect
@@ -261,11 +209,9 @@ EaxDistortionEffect::EaxDistortionEffect()
set_efx_defaults();
}
-// [[nodiscard]]
-bool EaxDistortionEffect::dispatch(
- const EaxEaxCall& eax_call)
+void EaxDistortionEffect::dispatch(const EaxEaxCall& eax_call)
{
- return eax_call.is_get() ? get(eax_call) : set(eax_call);
+ eax_call.is_get() ? get(eax_call) : set(eax_call);
}
void EaxDistortionEffect::set_eax_defaults()
@@ -338,11 +284,9 @@ void EaxDistortionEffect::set_efx_defaults()
set_efx_eq_bandwidth();
}
-// [[nodiscard]]
-bool EaxDistortionEffect::get(
- const EaxEaxCall& eax_call)
+void EaxDistortionEffect::get(const EaxEaxCall& eax_call)
{
- switch (eax_call.get_property_id())
+ switch(eax_call.get_property_id())
{
case EAXDISTORTION_NONE:
break;
@@ -374,8 +318,6 @@ bool EaxDistortionEffect::get(
default:
throw EaxDistortionEffectException{"Unsupported property id."};
}
-
- return false;
}
void EaxDistortionEffect::validate_edge(
@@ -583,11 +525,9 @@ bool EaxDistortionEffect::apply_deferred()
return true;
}
-// [[nodiscard]]
-bool EaxDistortionEffect::set(
- const EaxEaxCall& eax_call)
+void EaxDistortionEffect::set(const EaxEaxCall& eax_call)
{
- switch (eax_call.get_property_id())
+ switch(eax_call.get_property_id())
{
case EAXDISTORTION_NONE:
break;
@@ -619,13 +559,6 @@ bool EaxDistortionEffect::set(
default:
throw EaxDistortionEffectException{"Unsupported property id."};
}
-
- if (!eax_call.is_deferred())
- {
- return apply_deferred();
- }
-
- return false;
}
} // namespace