aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-08-14 22:58:24 -0700
committerChris Robinson <[email protected]>2017-08-14 22:58:24 -0700
commit0604b003605e03e3657e2b6a11706fca46feec38 (patch)
tree9b66e5e72d50df3b97e9abc4c865d650c47ce185 /Alc
parenta931314d3f455f4fda0666d91c39fc12f842e521 (diff)
Check the source type once when mixing
Diffstat (limited to 'Alc')
-rw-r--r--Alc/mixer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 5105a2d7..ff16452f 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -294,11 +294,13 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
ALsizei IrSize;
bool isplaying;
bool firstpass;
+ bool isstatic;
ALsizei chan;
ALsizei send;
/* Get source info */
isplaying = true; /* Will only be called while playing. */
+ isstatic = Source->SourceType == AL_STATIC;
DataPosInt = ATOMIC_LOAD(&voice->position, almemory_order_acquire);
DataPosFrac = ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed);
BufferListItem = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed);
@@ -352,7 +354,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
memcpy(SrcData, voice->PrevSamples[chan], MAX_PRE_SAMPLES*sizeof(ALfloat));
SrcDataSize = MAX_PRE_SAMPLES;
- if(Source->SourceType == AL_STATIC)
+ if(isstatic)
{
const ALbuffer *ALBuffer = BufferListItem->buffer;
const ALubyte *Data = ALBuffer->data;
@@ -636,7 +638,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
break;
}
- if(BufferLoopItem && Source->SourceType == AL_STATIC)
+ if(isstatic && BufferLoopItem)
{
assert(LoopEnd > LoopStart);
DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart;