diff options
author | Chris Robinson <[email protected]> | 2020-11-24 10:49:53 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-11-24 10:49:53 -0800 |
commit | a913aa6ba86db006a42f12781c0bbf9faa6d9b4e (patch) | |
tree | de2dd5156fa407936f0a56c323c51d8ae31a734a | |
parent | 7632dfb51a24a00836798a419b77bd4367baef1d (diff) |
Make sure batched source updates are with the proper voice
-rw-r--r-- | al/source.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/al/source.cpp b/al/source.cpp index b8b8c965..1af39da2 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -3435,15 +3435,18 @@ void UpdateAllSourceProps(ALCcontext *context) { std::lock_guard<std::mutex> _{context->mSourceLock}; auto voicelist = context->getVoicesSpan(); - std::for_each(voicelist.begin(), voicelist.end(), - [context](Voice *voice) -> void + ALuint vidx{0u}; + for(Voice *voice : voicelist) + { + ALuint sid{voice->mSourceID.load(std::memory_order_acquire)}; + ALsource *source = sid ? LookupSource(context, sid) : nullptr; + if(source && source->VoiceIdx == vidx) { - ALuint sid{voice->mSourceID.load(std::memory_order_acquire)}; - ALsource *source = sid ? LookupSource(context, sid) : nullptr; - if(source && !source->PropsClean.test_and_set(std::memory_order_acq_rel)) + if(!source->PropsClean.test_and_set(std::memory_order_acq_rel)) UpdateSourceProps(source, voice, context); } - ); + ++vidx; + } } SourceSubList::~SourceSubList() |