aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-06-18 20:12:15 -0700
committerChris Robinson <[email protected]>2022-06-19 07:44:01 -0700
commita6c099c63e87b4e3c91bbdcd102a3df2d4d05c8e (patch)
treec03c132f06154e19d1db49b6e27582521781aecf
parent3f05208c50f09abbb0bc66a3f2f9775c45d083b4 (diff)
Track EAX1 source changes
Even though it's only a single value, this allows for not having to explicitly track version changes, since the version being changed to will always have a property change, implicitly marking an EAX update/commit for the source.
-rw-r--r--al/eax/api.h3
-rw-r--r--al/source.cpp15
-rw-r--r--al/source.h2
3 files changed, 7 insertions, 13 deletions
diff --git a/al/eax/api.h b/al/eax/api.h
index 6d9d544d..a436acb2 100644
--- a/al/eax/api.h
+++ b/al/eax/api.h
@@ -65,9 +65,6 @@ struct EAXBUFFER_REVERBPROPERTIES {
float fMix;
};
-inline bool operator==(const EAXBUFFER_REVERBPROPERTIES& lhs, const EAXBUFFER_REVERBPROPERTIES& rhs) noexcept
-{ return lhs.fMix == rhs.fMix; }
-
constexpr auto EAX_BUFFER_MINREVERBMIX = 0.0F;
constexpr auto EAX_BUFFER_MAXREVERBMIX = 1.0F;
constexpr auto EAX_REVERBMIX_USEDISTANCE = -1.0F;
diff --git a/al/source.cpp b/al/source.cpp
index 6b8baa8e..fd2d624b 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -4475,14 +4475,13 @@ void ALsource::eax_set(const EaxCall& call)
const auto eax_version = call.get_version();
switch(eax_version)
{
- case 1: eax1_set(call, eax1_.d); break;
+ case 1: eax1_set(call, eax1_.d); eax1_.changed = true; break;
case 2: eax2_set(call, eax2_.d); eax2_.changed = true; break;
case 3: eax3_set(call, eax3_.d); eax3_.changed = true; break;
case 4: eax4_set(call, eax4_.d); eax4_.changed = true; break;
case 5: eax5_set(call, eax5_.d); eax5_.changed = true; break;
default: eax_fail_unknown_property_id();
}
- eax_is_version_changed_ |= (eax_version_ == eax_version);
eax_version_ = eax_version;
}
@@ -4895,18 +4894,16 @@ void ALsource::eax_commit(EaxCommitType commit_type)
const auto primary_fx_slot_id = eax_al_context_->eax_get_primary_fx_slot_index();
const auto is_primary_fx_slot_id_changed = (eax_primary_fx_slot_id_ != primary_fx_slot_id);
- const auto is_forced = (
- eax_is_version_changed_ ||
- is_primary_fx_slot_id_changed ||
- commit_type == EaxCommitType::forced);
+ const auto is_forced = is_primary_fx_slot_id_changed || commit_type == EaxCommitType::forced;
- eax_is_version_changed_ = false;
eax_primary_fx_slot_id_ = primary_fx_slot_id;
- switch (eax_version_) {
+ switch(eax_version_)
+ {
case 1:
- if(!is_forced && eax1_.i == eax1_.d)
+ if(!is_forced && !eax1_.changed)
return;
+ eax1_.changed = false;
eax1_.i = eax1_.d;
eax1_translate(eax1_.i, eax_);
break;
diff --git a/al/source.h b/al/source.h
index 850ce64f..5bfa6616 100644
--- a/al/source.h
+++ b/al/source.h
@@ -200,6 +200,7 @@ private:
using Eax1Props = EAXBUFFER_REVERBPROPERTIES;
struct Eax1State {
+ bool changed{false};
Eax1Props i; // Immediate.
Eax1Props d; // Deferred.
};
@@ -258,7 +259,6 @@ private:
ALCcontext* eax_al_context_{};
EaxFxSlotIndex eax_primary_fx_slot_id_{};
EaxActiveFxSlots eax_active_fx_slots_{};
- bool eax_is_version_changed_{};
int eax_version_{};
Eax1State eax1_{};
Eax2State eax2_{};