diff options
author | Chris Robinson <[email protected]> | 2022-02-08 20:43:05 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-02-08 20:43:05 -0800 |
commit | 256ea81dbe07f02d008908c90b99896f8eaaf2a5 (patch) | |
tree | e58348ee7808310f7c231934b91ad399c3af4d62 /core | |
parent | de87cc98d5eef40eeb565b781ac90c1c6f55b42e (diff) |
Combine listener and context updates
Diffstat (limited to 'core')
-rw-r--r-- | core/context.cpp | 16 | ||||
-rw-r--r-- | core/context.h | 22 |
2 files changed, 7 insertions, 31 deletions
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<ListenerProps> 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<WetBuffer>; struct ContextProps { + std::array<float,3> Position; + std::array<float,3> Velocity; + std::array<float,3> OrientAt; + std::array<float,3> OrientUp; + float Gain; + float MetersPerUnit; + float DopplerFactor; float DopplerVelocity; float SpeedOfSound; @@ -61,23 +68,9 @@ struct ContextProps { DEF_NEWDEL(ContextProps) }; -struct ListenerProps { - std::array<float,3> Position; - std::array<float,3> Velocity; - std::array<float,3> OrientAt; - std::array<float,3> OrientUp; - float Gain; - float MetersPerUnit; - - std::atomic<ListenerProps*> next; - - DEF_NEWDEL(ListenerProps) -}; - struct ContextParams { /* Pointer to the most recent property values that are awaiting an update. */ std::atomic<ContextProps*> ContextUpdate{nullptr}; - std::atomic<ListenerProps*> ListenerUpdate{nullptr}; alu::Vector Position{}; alu::Matrix Matrix{alu::Matrix::Identity()}; @@ -109,7 +102,6 @@ struct ContextBase { * updates. */ std::atomic<ContextProps*> mFreeContextProps{nullptr}; - std::atomic<ListenerProps*> mFreeListenerProps{nullptr}; std::atomic<VoicePropsItem*> mFreeVoiceProps{nullptr}; std::atomic<EffectSlotProps*> mFreeEffectslotProps{nullptr}; |