From f0871c8cfcb329e847fd48256fd32f20d2c7e827 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 24 Apr 2016 21:42:59 -0700 Subject: Improve radius behavior with scaling of ambisonic coefficients --- Alc/effects/echo.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Alc/effects/echo.c') diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index 9fd31864..8600db70 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -85,13 +85,19 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co { ALuint frequency = Device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat gain, lrpan; + ALfloat gain, lrpan, spread; state->Tap[0].delay = fastf2u(Slot->EffectProps.Echo.Delay * frequency) + 1; state->Tap[1].delay = fastf2u(Slot->EffectProps.Echo.LRDelay * frequency); state->Tap[1].delay += state->Tap[0].delay; - lrpan = Slot->EffectProps.Echo.Spread; + spread = Slot->EffectProps.Echo.Spread; + if(spread < 0.0f) lrpan = -1.0f; + else lrpan = 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; state->FeedGain = Slot->EffectProps.Echo.Feedback; @@ -103,11 +109,11 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co gain = Slot->Gain; /* First tap panning */ - CalcXYZCoeffs(-lrpan, 0.0f, 0.0f, coeffs); + CalcXYZCoeffs(-lrpan, 0.0f, 0.0f, spread, coeffs); ComputePanningGains(Device->Dry, coeffs, gain, state->Gain[0]); /* Second tap panning */ - CalcXYZCoeffs( lrpan, 0.0f, 0.0f, coeffs); + CalcXYZCoeffs( lrpan, 0.0f, 0.0f, spread, coeffs); ComputePanningGains(Device->Dry, coeffs, gain, state->Gain[1]); } -- cgit v1.2.3