Don't use coverage spread for the echo spread

This commit is contained in:
Chris Robinson 2019-05-20 21:30:56 -07:00
parent 6dbd488d13
commit 55845f316d

View File

@ -95,31 +95,23 @@ ALboolean EchoState::deviceUpdate(const ALCdevice *Device)
void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target) void EchoState::update(const ALCcontext *context, const ALeffectslot *slot, const EffectProps *props, const EffectTarget target)
{ {
const ALCdevice *device = context->Device; const ALCdevice *device = context->Device;
ALuint frequency = device->Frequency; const auto frequency = static_cast<ALfloat>(device->Frequency);
ALfloat gainhf, lrpan, spread;
mTap[0].delay = maxi(float2int(props->Echo.Delay*frequency + 0.5f), 1); mTap[0].delay = maxi(float2int(props->Echo.Delay*frequency + 0.5f), 1);
mTap[1].delay = float2int(props->Echo.LRDelay*frequency + 0.5f); mTap[1].delay = float2int(props->Echo.LRDelay*frequency + 0.5f) + mTap[0].delay;
mTap[1].delay += mTap[0].delay;
spread = props->Echo.Spread; const ALfloat gainhf{maxf(1.0f - props->Echo.Damping, 0.0625f)}; /* Limit -24dB */
if(spread < 0.0f) lrpan = -1.0f; mFilter.setParams(BiquadType::HighShelf, gainhf, LOWPASSFREQREF/frequency,
else lrpan = 1.0f; calc_rcpQ_from_slope(gainhf, 1.0f));
/* Convert echo spread (where 0 = omni, +/-1 = directional) to coverage
* spread (where 0 = point, tau = omni).
*/
spread = asinf(1.0f - fabsf(spread))*4.0f;
mFeedGain = props->Echo.Feedback; mFeedGain = props->Echo.Feedback;
gainhf = maxf(1.0f - props->Echo.Damping, 0.0625f); /* Limit -24dB */ /* Convert echo spread (where 0 = center, +/-1 = sides) to angle. */
mFilter.setParams(BiquadType::HighShelf, gainhf, LOWPASSFREQREF/frequency, const ALfloat angle{std::asin(props->Echo.Spread)};
calc_rcpQ_from_slope(gainhf, 1.0f)
);
ALfloat coeffs[2][MAX_AMBI_CHANNELS]; ALfloat coeffs[2][MAX_AMBI_CHANNELS];
CalcAngleCoeffs(al::MathDefs<float>::Pi()*-0.5f*lrpan, 0.0f, spread, coeffs[0]); CalcAngleCoeffs(-angle, 0.0f, 0.0f, coeffs[0]);
CalcAngleCoeffs(al::MathDefs<float>::Pi()* 0.5f*lrpan, 0.0f, spread, coeffs[1]); CalcAngleCoeffs( angle, 0.0f, 0.0f, coeffs[1]);
mOutBuffer = target.Main->Buffer; mOutBuffer = target.Main->Buffer;
mOutChannels = target.Main->NumChannels; mOutChannels = target.Main->NumChannels;