Skip mixing the fade out step when starting silent

Unfortunately it can't skip mixing the fade in when going to silence because
the history needs to be up to date.
This commit is contained in:
Chris Robinson 2017-04-25 22:10:27 -07:00
parent a0a41921fc
commit ad782c0000

View File

@ -507,14 +507,20 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
}
else
{
HrtfState backupstate = parms->Hrtf.State;
ALfloat gain;
/* The old coefficients need to fade to silence
* completely since they'll be replaced after the mix.
* So it needs to fade out over DstBufferSize instead
* of Counter.
*
* Don't bother with the fade out when starting from
* silence.
*/
if(parms->Hrtf.Old.Gain > GAIN_SILENCE_THRESHOLD)
{
HrtfState backupstate = parms->Hrtf.State;
hrtfparams.Coeffs = SAFE_CONST(ALfloat2*,parms->Hrtf.Old.Coeffs);
hrtfparams.Delay[0] = parms->Hrtf.Old.Delay[0];
hrtfparams.Delay[1] = parms->Hrtf.Old.Delay[1];
@ -526,6 +532,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
samples, voice->Offset, OutPos, IrSize, &hrtfparams,
&backupstate, DstBufferSize
);
}
/* The new coefficients need to fade in completely
* since they're replacing the old ones. To keep the