aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-03-16 02:46:19 -0700
committerChris Robinson <[email protected]>2023-03-16 02:46:19 -0700
commitef5373611fb0411be0e29c463f0e525481011eb0 (patch)
tree5d5e49a0bebe207853803a2406ac815326e0c4b1 /alc
parenta4b1986556f5c21f77b58b619312fcb7d5435e97 (diff)
Commit deferred EAX properties in alcProcessContext
Diffstat (limited to 'alc')
-rw-r--r--alc/context.cpp17
-rw-r--r--alc/context.h8
2 files changed, 11 insertions, 14 deletions
diff --git a/alc/context.cpp b/alc/context.cpp
index 352db31d..b5a9b6f9 100644
--- a/alc/context.cpp
+++ b/alc/context.cpp
@@ -264,6 +264,11 @@ void ALCcontext::applyAllUpdates()
/* busy-wait */
}
+#ifdef ALSOFT_EAX
+ if(eax_needs_commit_)
+ eax_commit();
+#endif
+
if(std::exchange(mPropsDirty, false))
UpdateContextProps(this);
UpdateAllEffectSlotProps(this);
@@ -344,6 +349,7 @@ ALenum ALCcontext::eax_eax_set(
default:
eax_fail_unknown_property_set_id();
}
+ eax_needs_commit_ = true;
if(!call.is_deferred())
{
@@ -391,12 +397,6 @@ ALenum ALCcontext::eax_eax_get(
return AL_NO_ERROR;
}
-void ALCcontext::eax_commit_and_update_sources()
-{
- std::unique_lock<std::mutex> source_lock{mSourceLock};
- ForEachSource(this, std::mem_fn(&ALsource::eax_commit_and_update));
-}
-
void ALCcontext::eax_set_last_error() noexcept
{
eax_last_error_ = EAXERR_INVALID_OPERATION;
@@ -487,10 +487,6 @@ void ALCcontext::eax_initialize()
eax_initialize_fx_slots();
eax_is_initialized_ = true;
- mPropsDirty = true;
-
- if(!mDeferUpdates)
- applyAllUpdates();
}
bool ALCcontext::eax_has_no_default_effect_slot() const noexcept
@@ -997,6 +993,7 @@ void ALCcontext::eax_context_commit()
void ALCcontext::eax_commit()
{
+ eax_needs_commit_ = false;
eax_context_commit();
eax_commit_fx_slots();
eax_update_sources();
diff --git a/alc/context.h b/alc/context.h
index c0f1805c..941a3d80 100644
--- a/alc/context.h
+++ b/alc/context.h
@@ -204,7 +204,6 @@ public:
ALvoid* property_value,
ALuint property_value_size);
- void eax_commit_and_update_sources();
void eax_set_last_error() noexcept;
EaxFxSlotIndex eax_get_primary_fx_slot_index() const noexcept
@@ -215,6 +214,9 @@ public:
ALeffectslot& eax_get_fx_slot(EaxFxSlotIndexValue fx_slot_index)
{ return eax_fx_slots_.get(fx_slot_index); }
+ bool eax_needs_commit() const noexcept { return eax_needs_commit_; }
+ void eax_commit();
+
void eax_commit_fx_slots()
{ eax_fx_slots_.commit(); }
@@ -391,6 +393,7 @@ private:
EaxFxSlots eax_fx_slots_{};
int eax_version_{}; // Current EAX version.
+ bool eax_needs_commit_{};
EaxDirtyFlags eax_df_{}; // Dirty flags for the current EAX version.
Eax5State eax123_{}; // EAX1/EAX2/EAX3 state.
Eax4State eax4_{}; // EAX4 state.
@@ -477,8 +480,6 @@ private:
void eax_context_set_defaults();
void eax_set_defaults();
- void eax_initialize_sources();
-
void eax_dispatch_fx_slot(const EaxCall& call);
void eax_dispatch_source(const EaxCall& call);
@@ -507,7 +508,6 @@ private:
void eax4_context_commit(Eax4State& state, EaxDirtyFlags& dst_df);
void eax5_context_commit(Eax5State& state, EaxDirtyFlags& dst_df);
void eax_context_commit();
- void eax_commit();
#endif // ALSOFT_EAX
};