diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2021-02-06 14:39:30 -0800 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2021-02-06 14:39:30 -0800 |
commit | dfe627133c1d018748bd66ad1f8c72945448a34a (patch) | |
tree | e1b13de1178629836538ccec8e573dc0b67227cc /alc/voice.cpp | |
parent | 72c4dd4d10659fb0e3fa973e68f399c6b34d4b99 (diff) |
Use spans instead of references to arrays
Diffstat (limited to 'alc/voice.cpp')
-rw-r--r-- | alc/voice.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/alc/voice.cpp b/alc/voice.cpp index 310e3f3c..0d1da6ae 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -359,14 +359,14 @@ void DoHrtfMix(const float *samples, const uint DstBufferSize, DirectParams &par const float a{static_cast<float>(fademix) / static_cast<float>(Counter)}; gain = lerp(parms.Hrtf.Old.Gain, TargetGain, a); } - MixHrtfFilter hrtfparams; - hrtfparams.Coeffs = &parms.Hrtf.Target.Coeffs; - hrtfparams.Delay = parms.Hrtf.Target.Delay; - hrtfparams.Gain = 0.0f; - hrtfparams.GainStep = gain / static_cast<float>(fademix); + MixHrtfFilter hrtfparams{ + parms.Hrtf.Target.Coeffs, + parms.Hrtf.Target.Delay, + 0.0f, gain / static_cast<float>(fademix)}; MixHrtfBlendSamples(HrtfSamples, AccumSamples+OutPos, IrSize, &parms.Hrtf.Old, &hrtfparams, fademix); + /* Update the old parameters with the result. */ parms.Hrtf.Old = parms.Hrtf.Target; parms.Hrtf.Old.Gain = gain; @@ -387,12 +387,13 @@ void DoHrtfMix(const float *samples, const uint DstBufferSize, DirectParams &par gain = lerp(parms.Hrtf.Old.Gain, TargetGain, a); } - MixHrtfFilter hrtfparams; - hrtfparams.Coeffs = &parms.Hrtf.Target.Coeffs; - hrtfparams.Delay = parms.Hrtf.Target.Delay; - hrtfparams.Gain = parms.Hrtf.Old.Gain; - hrtfparams.GainStep = (gain - parms.Hrtf.Old.Gain) / static_cast<float>(todo); + MixHrtfFilter hrtfparams{ + parms.Hrtf.Target.Coeffs, + parms.Hrtf.Target.Delay, + parms.Hrtf.Old.Gain, + (gain - parms.Hrtf.Old.Gain) / static_cast<float>(todo)}; MixHrtfSamples(HrtfSamples+fademix, AccumSamples+OutPos, IrSize, &hrtfparams, todo); + /* Store the now-current gain for next time. */ parms.Hrtf.Old.Gain = gain; } |