diff options
author | Chris Robinson <[email protected]> | 2016-04-24 21:42:59 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-04-24 21:42:59 -0700 |
commit | f0871c8cfcb329e847fd48256fd32f20d2c7e827 (patch) | |
tree | 6094609d7c173efa66894705d63d1f018bbf0f63 /Alc/effects | |
parent | fdee577940a4669e9723a16c4c625567694589ec (diff) |
Improve radius behavior with scaling of ambisonic coefficients
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/chorus.c | 4 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 2 | ||||
-rw-r--r-- | Alc/effects/echo.c | 14 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 4 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 12 |
5 files changed, 21 insertions, 15 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 94c9fc47..9deb2a1f 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -112,9 +112,9 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device state->delay = fastf2i(Slot->EffectProps.Chorus.Delay * frequency); /* Gains for left and right sides */ - CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, coeffs); + CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Slot->Gain, state->Gain[0]); - CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, coeffs); + CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Slot->Gain, state->Gain[1]); phase = Slot->EffectProps.Chorus.Phase; diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 12b16137..f510e8fe 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -78,7 +78,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice * else { ALfloat coeffs[MAX_AMBI_COEFFS]; - CalcXYZCoeffs(0.0f, 0.0f, -1.0f, coeffs); + CalcXYZCoeffs(0.0f, 0.0f, -1.0f, 0.0f, coeffs); STATIC_CAST(ALeffectState,state)->OutBuffer = device->Dry.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->Dry.NumChannels; 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]); } diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index e394f9f2..a71eb9c2 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -112,9 +112,9 @@ static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Devi state->delay = fastf2i(Slot->EffectProps.Flanger.Delay * frequency); /* Gains for left and right sides */ - CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, coeffs); + CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Slot->Gain, state->Gain[0]); - CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, coeffs); + CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Slot->Gain, state->Gain[1]); phase = Slot->EffectProps.Flanger.Phase; diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index bb980ac2..ef3ab6c3 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -719,7 +719,7 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect }; length = minf(length, 1.0f); - CalcDirectionCoeffs(pan, coeffs); + CalcDirectionCoeffs(pan, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Early.PanGain[3][i] = DirGains[i] * EarlyGain * length; @@ -743,7 +743,7 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect }; length = minf(length, 1.0f); - CalcDirectionCoeffs(pan, coeffs); + CalcDirectionCoeffs(pan, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Late.PanGain[3][i] = DirGains[i] * LateGain * length; @@ -783,7 +783,7 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec }; length = minf(length, 1.0f); - CalcDirectionCoeffs(pan, coeffs); + CalcDirectionCoeffs(pan, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Early.PanGain[i&3][i] = lerp(AmbientGains[i], DirGains[i], length) * EarlyGain; @@ -805,7 +805,7 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec }; length = minf(length, 1.0f); - CalcDirectionCoeffs(pan, coeffs); + CalcDirectionCoeffs(pan, 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Late.PanGain[i&3][i] = lerp(AmbientGains[i], DirGains[i], length) * LateGain; @@ -855,7 +855,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection } for(i = 0;i < 4;i++) { - CalcDirectionCoeffs(PanDirs[i], coeffs); + CalcDirectionCoeffs(PanDirs[i], 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Gain*EarlyGain*gain[i], State->Early.PanGain[i]); } @@ -886,7 +886,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection } for(i = 0;i < 4;i++) { - CalcDirectionCoeffs(PanDirs[i], coeffs); + CalcDirectionCoeffs(PanDirs[i], 0.0f, coeffs); ComputePanningGains(Device->Dry, coeffs, Gain*LateGain*gain[i], State->Late.PanGain[i]); } |