Skip to content

Commit

Permalink
Make sure batched source updates are with the proper voice
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Nov 24, 2020
1 parent 7632dfb commit a913aa6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions al/source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a913aa6

Please sign in to comment.