diff options
author | Chris Robinson <[email protected]> | 2016-03-09 23:43:57 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-03-09 23:43:57 -0800 |
commit | a45715751640992e8caeac8c36b5ecb23ba3c190 (patch) | |
tree | 5ae3f2d8611487be37ff1c52eb2eeabfc4b62d69 /Alc/effects | |
parent | 3e2672ec9f5c2a84a0f871bd0379ee387f9a95ce (diff) |
Organize the dry buffer properties into a struct
Diffstat (limited to 'Alc/effects')
-rw-r--r-- | Alc/effects/autowah.c | 2 | ||||
-rw-r--r-- | Alc/effects/chorus.c | 4 | ||||
-rw-r--r-- | Alc/effects/compressor.c | 4 | ||||
-rw-r--r-- | Alc/effects/dedicated.c | 3 | ||||
-rw-r--r-- | Alc/effects/distortion.c | 2 | ||||
-rw-r--r-- | Alc/effects/echo.c | 6 | ||||
-rw-r--r-- | Alc/effects/equalizer.c | 4 | ||||
-rw-r--r-- | Alc/effects/flanger.c | 6 | ||||
-rw-r--r-- | Alc/effects/modulator.c | 4 | ||||
-rw-r--r-- | Alc/effects/reverb.c | 37 |
10 files changed, 40 insertions, 32 deletions
diff --git a/Alc/effects/autowah.c b/Alc/effects/autowah.c index 09aecf15..20ae26e4 100644 --- a/Alc/effects/autowah.c +++ b/Alc/effects/autowah.c @@ -75,7 +75,7 @@ static ALvoid ALautowahState_update(ALautowahState *state, const ALCdevice *devi state->PeakGain = slot->EffectProps.Autowah.PeakGain; state->Resonance = slot->EffectProps.Autowah.Resonance; - ComputeAmbientGains(device->AmbiCoeffs, device->NumChannels, slot->Gain, state->Gain); + ComputeAmbientGains(device->Dry.AmbiCoeffs, device->Dry.NumChannels, slot->Gain, state->Gain); } static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) diff --git a/Alc/effects/chorus.c b/Alc/effects/chorus.c index 1c9efd47..e212cd75 100644 --- a/Alc/effects/chorus.c +++ b/Alc/effects/chorus.c @@ -113,9 +113,9 @@ 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->AmbiCoeffs, Device->NumChannels, coeffs, Slot->Gain, state->Gain[0]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Slot->Gain, state->Gain[0]); CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, Slot->Gain, state->Gain[1]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Slot->Gain, state->Gain[1]); phase = Slot->EffectProps.Chorus.Phase; rate = Slot->EffectProps.Chorus.Rate; diff --git a/Alc/effects/compressor.c b/Alc/effects/compressor.c index e835a5aa..ae859793 100644 --- a/Alc/effects/compressor.c +++ b/Alc/effects/compressor.c @@ -63,7 +63,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice state->Enabled = slot->EffectProps.Compressor.OnOff; - scale = device->AmbiScale; + scale = device->Dry.AmbiScale; aluMatrixfSet(&matrix, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, scale, 0.0f, 0.0f, @@ -71,7 +71,7 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice 0.0f, 0.0f, 0.0f, scale ); for(i = 0;i < 4;i++) - ComputeFirstOrderGains(device->AmbiCoeffs, device->NumChannels, + ComputeFirstOrderGains(device->Dry.AmbiCoeffs, device->Dry.NumChannels, matrix.m[i], slot->Gain, state->Gain[i]); } diff --git a/Alc/effects/dedicated.c b/Alc/effects/dedicated.c index 06aad17c..2706a672 100644 --- a/Alc/effects/dedicated.c +++ b/Alc/effects/dedicated.c @@ -71,7 +71,8 @@ static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice * { ALfloat coeffs[MAX_AMBI_COEFFS]; CalcXYZCoeffs(0.0f, 0.0f, -1.0f, coeffs); - ComputePanningGains(device->AmbiCoeffs, device->NumChannels, coeffs, Gain, state->gains); + ComputePanningGains(device->Dry.AmbiCoeffs, device->Dry.NumChannels, + coeffs, Gain, state->gains); } } } diff --git a/Alc/effects/distortion.c b/Alc/effects/distortion.c index 697758f0..92eb1a6d 100644 --- a/Alc/effects/distortion.c +++ b/Alc/effects/distortion.c @@ -83,7 +83,7 @@ static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); - ComputeAmbientGains(Device->AmbiCoeffs, Device->NumChannels, Slot->Gain, state->Gain); + ComputeAmbientGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, Slot->Gain, state->Gain); } static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) diff --git a/Alc/effects/echo.c b/Alc/effects/echo.c index ebb6cf12..1f5925ef 100644 --- a/Alc/effects/echo.c +++ b/Alc/effects/echo.c @@ -104,11 +104,13 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co /* First tap panning */ CalcXYZCoeffs(-lrpan, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, gain, state->Gain[0]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, + gain, state->Gain[0]); /* Second tap panning */ CalcXYZCoeffs( lrpan, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, gain, state->Gain[1]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, 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/equalizer.c b/Alc/effects/equalizer.c index 051e8c7f..479a8536 100644 --- a/Alc/effects/equalizer.c +++ b/Alc/effects/equalizer.c @@ -103,7 +103,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * aluMatrixf matrix; ALuint i; - gain = device->AmbiScale; + gain = device->Dry.AmbiScale; aluMatrixfSet(&matrix, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, gain, 0.0f, 0.0f, @@ -111,7 +111,7 @@ static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice * 0.0f, 0.0f, 0.0f, gain ); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(device->AmbiCoeffs, device->NumChannels, + ComputeFirstOrderGains(device->Dry.AmbiCoeffs, device->Dry.NumChannels, matrix.m[i], slot->Gain, state->Gain[i]); /* Calculate coefficients for the each type of filter. Note that the shelf diff --git a/Alc/effects/flanger.c b/Alc/effects/flanger.c index 21536f04..d29e0f25 100644 --- a/Alc/effects/flanger.c +++ b/Alc/effects/flanger.c @@ -113,9 +113,11 @@ 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->AmbiCoeffs, Device->NumChannels, coeffs, Slot->Gain, state->Gain[0]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, + Slot->Gain, state->Gain[0]); CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, Slot->Gain, state->Gain[1]); + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, + Slot->Gain, state->Gain[1]); phase = Slot->EffectProps.Flanger.Phase; rate = Slot->EffectProps.Flanger.Rate; diff --git a/Alc/effects/modulator.c b/Alc/effects/modulator.c index cd6ccb22..4183b908 100644 --- a/Alc/effects/modulator.c +++ b/Alc/effects/modulator.c @@ -122,7 +122,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice * state->Filter[i].process = ALfilterState_processC; } - scale = Device->AmbiScale; + scale = Device->Dry.AmbiScale; aluMatrixfSet(&matrix, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, scale, 0.0f, 0.0f, @@ -130,7 +130,7 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice * 0.0f, 0.0f, 0.0f, scale ); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->AmbiCoeffs, Device->NumChannels, + ComputeFirstOrderGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, matrix.m[i], Slot->Gain, state->Gain[i]); } diff --git a/Alc/effects/reverb.c b/Alc/effects/reverb.c index a92fbd5b..a1b27876 100644 --- a/Alc/effects/reverb.c +++ b/Alc/effects/reverb.c @@ -681,7 +681,7 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect if(!(length > FLT_EPSILON)) { for(i = 0;i < Device->RealOut.NumChannels;i++) - State->Early.PanGain[i&3][Device->VirtOut.NumChannels+i] = Gain * EarlyGain; + State->Early.PanGain[i&3][Device->Dry.NumChannels+i] = Gain * EarlyGain; } else { @@ -697,11 +697,11 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->VirtOut.NumChannels, coeffs, Gain, DirGains); - for(i = 0;i < Device->VirtOut.NumChannels;i++) + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, 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++) - State->Early.PanGain[i&3][Device->VirtOut.NumChannels+i] = Gain * EarlyGain * (1.0f-length); + State->Early.PanGain[i&3][Device->Dry.NumChannels+i] = Gain * EarlyGain * (1.0f-length); } memset(State->Late.PanGain, 0, sizeof(State->Late.PanGain)); @@ -709,7 +709,7 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect if(!(length > FLT_EPSILON)) { for(i = 0;i < Device->RealOut.NumChannels;i++) - State->Late.PanGain[i&3][Device->VirtOut.NumChannels+i] = Gain * LateGain; + State->Late.PanGain[i&3][Device->Dry.NumChannels+i] = Gain * LateGain; } else { @@ -721,11 +721,11 @@ static ALvoid UpdateMixedPanning(const ALCdevice *Device, const ALfloat *Reflect length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->VirtOut.NumChannels, coeffs, Gain, DirGains); - for(i = 0;i < Device->VirtOut.NumChannels;i++) + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, 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++) - State->Late.PanGain[i&3][Device->VirtOut.NumChannels+i] = Gain * LateGain * (1.0f-length); + State->Late.PanGain[i&3][Device->Dry.NumChannels+i] = Gain * LateGain * (1.0f-length); } } @@ -738,13 +738,14 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec ALuint i; /* Apply a boost of about 3dB to better match the expected stereo output volume. */ - ComputeAmbientGains(Device->AmbiCoeffs, Device->NumChannels, Gain*1.414213562f, AmbientGains); + ComputeAmbientGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, + Gain*1.414213562f, AmbientGains); memset(State->Early.PanGain, 0, sizeof(State->Early.PanGain)); length = sqrtf(ReflectionsPan[0]*ReflectionsPan[0] + ReflectionsPan[1]*ReflectionsPan[1] + ReflectionsPan[2]*ReflectionsPan[2]); if(!(length > FLT_EPSILON)) { - for(i = 0;i < Device->NumChannels;i++) + for(i = 0;i < Device->Dry.NumChannels;i++) State->Early.PanGain[i&3][i] = AmbientGains[i] * EarlyGain; } else @@ -761,8 +762,9 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, Gain, DirGains); - for(i = 0;i < Device->NumChannels;i++) + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, + Gain, DirGains); + for(i = 0;i < Device->Dry.NumChannels;i++) State->Early.PanGain[i&3][i] = lerp(AmbientGains[i], DirGains[i], length) * EarlyGain; } @@ -770,7 +772,7 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec length = sqrtf(LateReverbPan[0]*LateReverbPan[0] + LateReverbPan[1]*LateReverbPan[1] + LateReverbPan[2]*LateReverbPan[2]); if(!(length > FLT_EPSILON)) { - for(i = 0;i < Device->NumChannels;i++) + for(i = 0;i < Device->Dry.NumChannels;i++) State->Late.PanGain[i&3][i] = AmbientGains[i] * LateGain; } else @@ -783,8 +785,9 @@ static ALvoid UpdateDirectPanning(const ALCdevice *Device, const ALfloat *Reflec length = minf(length, 1.0f); CalcDirectionCoeffs(pan, coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, Gain, DirGains); - for(i = 0;i < Device->NumChannels;i++) + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, + Gain, DirGains); + for(i = 0;i < Device->Dry.NumChannels;i++) State->Late.PanGain[i&3][i] = lerp(AmbientGains[i], DirGains[i], length) * LateGain; } } @@ -833,7 +836,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection for(i = 0;i < 4;i++) { CalcDirectionCoeffs(PanDirs[i], coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Gain*EarlyGain*gain[i], State->Early.PanGain[i]); } @@ -864,7 +867,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection for(i = 0;i < 4;i++) { CalcDirectionCoeffs(PanDirs[i], coeffs); - ComputePanningGains(Device->AmbiCoeffs, Device->NumChannels, coeffs, + ComputePanningGains(Device->Dry.AmbiCoeffs, Device->Dry.NumChannels, coeffs, Gain*LateGain*gain[i], State->Late.PanGain[i]); } } |