aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-24 15:30:28 -0800
committerChris Robinson <[email protected]>2018-11-24 15:30:28 -0800
commit16a60dc371254ba4936f4f5c13c32d060b9911ac (patch)
tree07f62911ee5296d0eab1a6b0214e7a144afdce2e /Alc
parentbd8db0d27b50644dad97aa74f8f207d30d6b9490 (diff)
Avoid an extraneous boolean
Diffstat (limited to 'Alc')
-rw-r--r--Alc/mixvoice.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp
index 9620b214..c902c66a 100644
--- a/Alc/mixvoice.cpp
+++ b/Alc/mixvoice.cpp
@@ -315,7 +315,6 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
ALsizei OutPos;
ALsizei IrSize;
bool isplaying;
- bool firstpass;
bool isstatic;
ALsizei chan;
ALsizei send;
@@ -337,7 +336,6 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
Resample_copy_C : voice->Resampler);
Counter = (voice->Flags&VOICE_IS_FADING) ? SamplesToDo : 0;
- firstpass = true;
OutPos = 0;
do {
@@ -595,11 +593,9 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
parms->Hrtf.Old = parms->Hrtf.Target;
parms->Hrtf.Old.Gain = 0.0f;
}
- else if(firstpass)
+ else if(OutPos == 0)
{
- ALfloat gain;
-
- /* Fade between the coefficients over 128 samples. */
+ /* First mixing pass, fade between the coefficients. */
fademix = mini(DstBufferSize, 128);
/* The new coefficients need to fade in completely
@@ -608,8 +604,8 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
* and new target gains given how much of the fade time
* this mix handles.
*/
- gain = lerp(parms->Hrtf.Old.Gain, parms->Hrtf.Target.Gain,
- minf(1.0f, (ALfloat)fademix/Counter));
+ ALfloat gain{lerp(parms->Hrtf.Old.Gain, parms->Hrtf.Target.Gain,
+ minf(1.0f, (ALfloat)fademix/Counter))};
hrtfparams.Coeffs = parms->Hrtf.Target.Coeffs;
hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0];
hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1];
@@ -689,7 +685,6 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
OutPos += DstBufferSize;
voice->Offset += DstBufferSize;
Counter = maxi(DstBufferSize, Counter) - DstBufferSize;
- firstpass = false;
if(isstatic)
{