diff options
author | Chris Robinson <[email protected]> | 2016-04-15 17:31:04 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-04-15 17:31:04 -0700 |
commit | bd65f64d0506be6f20d69311c9a6ade3d0a8d01d (patch) | |
tree | 7c4fb19c07978556b815dc666f4b90bde4003522 /Alc/effects | |
parent | e27fad90dec951f75b40004dcd32470ca404921d (diff) |
Avoid mixing all coefficients together when only some are used
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/chorus.c | 8 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 2 | ||||
-rw-r--r-- | Alc/effects/echo.c | 8 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 10 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 24 |
5 files changed, 31 insertions, 21 deletions
diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index e212cd75..a55983ab 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -113,9 +113,13 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device /* Gains for left and right sides */ CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Slot->Gain, state->Gain[0]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Slot->Gain, state->Gain[0] + ); CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Slot->Gain, state->Gain[1]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Slot->Gain, state->Gain[1] + ); phase = Slot->EffectProps.Chorus.Phase; rate = Slot->EffectProps.Chorus.Rate; diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 893f3abc..9fd10177 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -84,7 +84,7 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice * ALfloat coeffs[MAX_AMBI_COEFFS]; CalcXYZCoeffs(0.0f, 0.0f, -1.0f, coeffs); ComputePanningGains(device->Dry.AmbiCoeffs, device->Dry.NumChannels, - coeffs, Gain, state->gains); + device->Dry.CoeffCount, coeffs, Gain, state->gains); } 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 1f5925ef..00bf5d9f 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -104,13 +104,13 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co /* First tap panning */ CalcXYZCoeffs(-lrpan, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - gain, state->Gain[0]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, gain, state->Gain[0]); /* Second tap panning */ CalcXYZCoeffs( lrpan, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - gain, state->Gain[1]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, gain, state->Gain[1]); } static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index d29e0f25..c323c17a 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -113,11 +113,13 @@ static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Devi /* Gains for left and right sides */ CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - Slot->Gain, state->Gain[0]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Slot->Gain, state->Gain[0] + ); CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - Slot->Gain, state->Gain[1]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Slot->Gain, state->Gain[1] + ); phase = Slot->EffectProps.Flanger.Phase; rate = Slot->EffectProps.Flanger.Rate; diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index 2aea0763..e5c19d82 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -720,7 +720,8 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Gain, DirGains); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Early.PanGain[3][i] = DirGains[i] * EarlyGain * length; for(i = 0;i < Device->RealOut.NumChannels;i++) @@ -744,7 +745,8 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Gain, DirGains); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Late.PanGain[3][i] = DirGains[i] * LateGain * length; for(i = 0;i < Device->RealOut.NumChannels;i++) @@ -785,8 +787,8 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - Gain, DirGains); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Early.PanGain[i&3][i] = lerp(AmbientGains[i], DirGains[i], length) * EarlyGain; } @@ -808,8 +810,8 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - Gain, DirGains); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Gain, DirGains); for(i = 0;i < Device->Dry.NumChannels;i++) State->Late.PanGain[i&3][i] = lerp(AmbientGains[i], DirGains[i], length) * LateGain; } @@ -859,8 +861,9 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection for(i = 0;i < 4;i++) { CalcDirectionCoeffs(PanDirs[i], coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - Gain*EarlyGain*gain[i], State->Early.PanGain[i]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Gain*EarlyGain*gain[i], + State->Early.PanGain[i]); } gain[0] = gain[1] = gain[2] = gain[3] = 0.5f; @@ -890,8 +893,9 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection for(i = 0;i < 4;i++) { CalcDirectionCoeffs(PanDirs[i], coeffs); - ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, - Gain*LateGain*gain[i], State->Late.PanGain[i]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Device->Dry.CoeffCount, coeffs, Gain*LateGain*gain[i], + State->Late.PanGain[i]); } } |