From 465df3e3ef9dca52077247ca451880bc1c294e3a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Dec 2022 17:57:57 -0800 Subject: Include the reverb delay times in the fade sample count --- alc/effects/reverb.cpp | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'alc/effects/reverb.cpp') diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 3010f678..1173108e 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -1171,19 +1171,19 @@ void ReverbState::update(const ContextBase *Context, const EffectSlot *Slot, props->Reverb.ReflectionsGain*gain, props->Reverb.LateReverbGain*gain, mUpmixOutput, target.Main); - if(!fullUpdate) + /* Calculate the master filters */ + float hf0norm{minf(props->Reverb.HFReference/frequency, 0.49f)}; + pipeline.mFilter[0].Lp.setParamsFromSlope(BiquadType::HighShelf, hf0norm, props->Reverb.GainHF, 1.0f); + float lf0norm{minf(props->Reverb.LFReference/frequency, 0.49f)}; + pipeline.mFilter[0].Hp.setParamsFromSlope(BiquadType::LowShelf, lf0norm, props->Reverb.GainLF, 1.0f); + for(size_t i{1u};i < NUM_LINES;i++) { - /* Calculate the master filters */ - float hf0norm{minf(mParams.HFReference/frequency, 0.49f)}; - pipeline.mFilter[0].Lp.setParamsFromSlope(BiquadType::HighShelf, hf0norm, props->Reverb.GainHF, 1.0f); - float lf0norm{minf(mParams.LFReference/frequency, 0.49f)}; - pipeline.mFilter[0].Hp.setParamsFromSlope(BiquadType::LowShelf, lf0norm, props->Reverb.GainLF, 1.0f); - for(size_t i{1u};i < NUM_LINES;i++) - { - pipeline.mFilter[i].Lp.copyParamsFrom(pipeline.mFilter[0].Lp); - pipeline.mFilter[i].Hp.copyParamsFrom(pipeline.mFilter[0].Hp); - } + pipeline.mFilter[i].Lp.copyParamsFrom(pipeline.mFilter[0].Lp); + pipeline.mFilter[i].Hp.copyParamsFrom(pipeline.mFilter[0].Hp); + } + if(!fullUpdate) + { /* The density-based room size (delay length) multiplier. */ const float density_mult{CalcDelayLengthMult(mParams.Density)}; @@ -1193,16 +1193,6 @@ void ReverbState::update(const ContextBase *Context, const EffectSlot *Slot, } else { - float hf0norm{minf(props->Reverb.HFReference/frequency, 0.49f)}; - pipeline.mFilter[0].Lp.setParamsFromSlope(BiquadType::HighShelf, hf0norm, props->Reverb.GainHF, 1.0f); - float lf0norm{minf(props->Reverb.LFReference/frequency, 0.49f)}; - pipeline.mFilter[0].Hp.setParamsFromSlope(BiquadType::LowShelf, lf0norm, props->Reverb.GainLF, 1.0f); - for(size_t i{1u};i < NUM_LINES;i++) - { - pipeline.mFilter[i].Lp.copyParamsFrom(pipeline.mFilter[0].Lp); - pipeline.mFilter[i].Hp.copyParamsFrom(pipeline.mFilter[0].Hp); - } - const float density_mult{CalcDelayLengthMult(props->Reverb.Density)}; pipeline.updateDelayLine(props->Reverb.ReflectionsDelay, props->Reverb.LateReverbDelay, @@ -1222,10 +1212,11 @@ void ReverbState::update(const ContextBase *Context, const EffectSlot *Slot, /* Update the late lines. */ pipeline.mLate.updateLines(density_mult, props->Reverb.Diffusion, lfDecayTime, props->Reverb.DecayTime, hfDecayTime, lf0norm, hf0norm, frequency); - - const float decayCount{minf(props->Reverb.DecayTime*frequency, 1'000'000.0f)}; - pipeline.mFadeSampleCount = static_cast(decayCount); } + + const float decaySamples{(props->Reverb.ReflectionsDelay + props->Reverb.LateReverbDelay + + props->Reverb.DecayTime) * frequency}; + pipeline.mFadeSampleCount = static_cast(minf(decaySamples, 1'000'000.0f)); } -- cgit v1.2.3