Pass the voice state as a parameter instead of reloading it
This commit is contained in:
parent
e0daad6a16
commit
30a7c6d86f
@ -1451,12 +1451,12 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo)
|
||||
std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire),
|
||||
[SamplesToDo,ctx](ALvoice *voice) -> void
|
||||
{
|
||||
if(voice->mPlayState.load(std::memory_order_acquire) == ALvoice::Stopped)
|
||||
return;
|
||||
ALuint sid{voice->mSourceID.load(std::memory_order_relaxed)};
|
||||
const ALvoice::State vstate{voice->mPlayState.load(std::memory_order_acquire)};
|
||||
if(vstate == ALvoice::Stopped) return;
|
||||
const ALuint sid{voice->mSourceID.load(std::memory_order_relaxed)};
|
||||
if(voice->mStep < 1) return;
|
||||
|
||||
MixSource(voice, sid, ctx, SamplesToDo);
|
||||
MixVoice(voice, vstate, sid, ctx, SamplesToDo);
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -442,14 +442,13 @@ ALsizei LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *Buff
|
||||
|
||||
} // namespace
|
||||
|
||||
void MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context, const ALsizei SamplesToDo)
|
||||
void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCcontext *Context, const ALsizei SamplesToDo)
|
||||
{
|
||||
static constexpr ALfloat SilentTarget[MAX_OUTPUT_CHANNELS]{};
|
||||
|
||||
ASSUME(SamplesToDo > 0);
|
||||
|
||||
/* Get source info */
|
||||
ALvoice::State vstate{voice->mPlayState.load(std::memory_order_acquire)};
|
||||
/* Get voice info */
|
||||
const bool isstatic{(voice->mFlags&VOICE_IS_STATIC) != 0};
|
||||
ALsizei DataPosInt{static_cast<ALsizei>(voice->mPosition.load(std::memory_order_relaxed))};
|
||||
ALsizei DataPosFrac{voice->mPositionFrac.load(std::memory_order_relaxed)};
|
||||
@ -822,7 +821,7 @@ void MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context, const
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update source info */
|
||||
/* Update voice info */
|
||||
voice->mPosition.store(DataPosInt, std::memory_order_relaxed);
|
||||
voice->mPositionFrac.store(DataPosFrac, std::memory_order_relaxed);
|
||||
voice->mCurrentBuffer.store(BufferListItem, std::memory_order_relaxed);
|
||||
|
@ -446,7 +446,7 @@ inline std::array<ALfloat,MAX_AMBI_CHANNELS> GetAmbiIdentityRow(size_t i) noexce
|
||||
}
|
||||
|
||||
|
||||
void MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context, const ALsizei SamplesToDo);
|
||||
void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCcontext *Context, const ALsizei SamplesToDo);
|
||||
|
||||
void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples);
|
||||
/* Caller must lock the device state, and the mixer must not be running. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user