aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-06-19 07:59:08 -0700
committerChris Robinson <[email protected]>2022-06-19 08:04:30 -0700
commitaf690871b13affba189362a59af7b941d7e4cea2 (patch)
tree91f21c06c7744f314dd0209285a73aaa0efe2fd8 /al/effects
parenta6c099c63e87b4e3c91bbdcd102a3df2d4d05c8e (diff)
Combine multiple individual flags
Diffstat (limited to 'al/effects')
-rw-r--r--al/effects/reverb.cpp86
1 files changed, 34 insertions, 52 deletions
diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp
index 044430d4..a0e62da9 100644
--- a/al/effects/reverb.cpp
+++ b/al/effects/reverb.cpp
@@ -593,21 +593,18 @@ private:
struct State1
{
- bool changed{false};
Props1 i; // Immediate.
Props1 d; // Deferred.
}; // State1
struct State2
{
- bool changed{false};
Props2 i; // Immediate.
Props2 d; // Deferred.
}; // State2
struct State3
{
- bool changed{false};
Props3 i; // Immediate.
Props3 d; // Deferred.
}; // State3
@@ -1112,6 +1109,7 @@ private:
}; // EnvironmentSizeDeferrer3
int version_;
+ bool changed_{};
Props3 props_{};
State1 state1_{};
State2 state2_{};
@@ -1563,51 +1561,36 @@ void EaxReverbEffect::get(const EaxCall& call)
/*[[nodiscard]]*/ bool EaxReverbEffect::commit()
{
- if((version_ == 1 && !state1_.changed)
- || (version_ == 2 && !state2_.changed)
- || (version_ == 3 && !state3_.changed)
- || (version_ == 4 && !state4_.changed)
- || (version_ == 5 && !state5_.changed))
- {
+ if(!changed_)
return false;
- }
+ changed_ = false;
const auto props = props_;
-
- switch (version_)
+ switch(version_)
{
- case 1:
- state1_.changed = false;
- state1_.i = state1_.d;
- translate(state1_.d, props_);
- break;
-
- case 2:
- state2_.changed = false;
- state2_.i = state2_.d;
- translate(state2_.d, props_);
- break;
-
- case 3:
- state3_.changed = false;
- state3_.i = state3_.d;
- props_ = state3_.d;
- break;
-
- case 4:
- state4_.changed = false;
- state4_.i = state4_.d;
- props_ = state4_.d;
- break;
-
- case 5:
- state5_.changed = false;
- state5_.i = state5_.d;
- props_ = state5_.d;
- break;
+ case 1:
+ state1_.i = state1_.d;
+ translate(state1_.d, props_);
+ break;
+ case 2:
+ state2_.i = state2_.d;
+ translate(state2_.d, props_);
+ break;
+ case 3:
+ state3_.i = state3_.d;
+ props_ = state3_.d;
+ break;
+ case 4:
+ state4_.i = state4_.d;
+ props_ = state4_.d;
+ break;
+ case 5:
+ state5_.i = state5_.d;
+ props_ = state5_.d;
+ break;
- default:
- fail_unknown_version();
+ default:
+ fail_unknown_version();
}
auto is_dirty = false;
@@ -1953,17 +1936,16 @@ void EaxReverbEffect::set3(const EaxCall& call, Props3& props)
void EaxReverbEffect::set(const EaxCall& call)
{
const auto version = call.get_version();
-
- switch (version)
+ switch(version)
{
- case 1: set1(call, state1_.d); state1_.changed = true; break;
- case 2: set2(call, state2_.d); state2_.changed = true; break;
- case 3: set3(call, state3_.d); state3_.changed = true; break;
- case 4: set3(call, state4_.d); state4_.changed = true; break;
- case 5: set3(call, state5_.d); state5_.changed = true; break;
- default: fail_unknown_version();
+ case 1: set1(call, state1_.d); break;
+ case 2: set2(call, state2_.d); break;
+ case 3: set3(call, state3_.d); break;
+ case 4: set3(call, state4_.d); break;
+ case 5: set3(call, state5_.d); break;
+ default: fail_unknown_version();
}
-
+ changed_ = true;
version_ = version;
}