From 256ea81dbe07f02d008908c90b99896f8eaaf2a5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 8 Feb 2022 20:43:05 -0800 Subject: Combine listener and context updates --- core/context.cpp | 16 ---------------- core/context.h | 22 +++++++--------------- 2 files changed, 7 insertions(+), 31 deletions(-) (limited to 'core') diff --git a/core/context.cpp b/core/context.cpp index 6457a6ec..39fd8522 100644 --- a/core/context.cpp +++ b/core/context.cpp @@ -52,22 +52,6 @@ ContextBase::~ContextBase() delete mVoices.exchange(nullptr, std::memory_order_relaxed); - count = 0; - ListenerProps *lprops{mParams.ListenerUpdate.exchange(nullptr, std::memory_order_relaxed)}; - if(lprops) - { - ++count; - delete lprops; - } - lprops = mFreeListenerProps.exchange(nullptr, std::memory_order_acquire); - while(lprops) - { - std::unique_ptr old{lprops}; - lprops = old->next.load(std::memory_order_relaxed); - ++count; - } - TRACE("Freed %zu listener property object%s\n", count, (count==1)?"":"s"); - if(mAsyncEvents) { count = 0; diff --git a/core/context.h b/core/context.h index f3e05689..5f1f2ae1 100644 --- a/core/context.h +++ b/core/context.h @@ -50,6 +50,13 @@ using WetBufferPtr = std::unique_ptr; struct ContextProps { + std::array Position; + std::array Velocity; + std::array OrientAt; + std::array OrientUp; + float Gain; + float MetersPerUnit; + float DopplerFactor; float DopplerVelocity; float SpeedOfSound; @@ -61,23 +68,9 @@ struct ContextProps { DEF_NEWDEL(ContextProps) }; -struct ListenerProps { - std::array Position; - std::array Velocity; - std::array OrientAt; - std::array OrientUp; - float Gain; - float MetersPerUnit; - - std::atomic next; - - DEF_NEWDEL(ListenerProps) -}; - struct ContextParams { /* Pointer to the most recent property values that are awaiting an update. */ std::atomic ContextUpdate{nullptr}; - std::atomic ListenerUpdate{nullptr}; alu::Vector Position{}; alu::Matrix Matrix{alu::Matrix::Identity()}; @@ -109,7 +102,6 @@ struct ContextBase { * updates. */ std::atomic mFreeContextProps{nullptr}; - std::atomic mFreeListenerProps{nullptr}; std::atomic mFreeVoiceProps{nullptr}; std::atomic mFreeEffectslotProps{nullptr}; -- cgit v1.2.3