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/reverb.c | |
parent | 3e2672ec9f5c2a84a0f871bd0379ee387f9a95ce (diff) |
Organize the dry buffer properties into a struct
Diffstat (limited to 'Alc/effects/reverb.c')
-rw-r--r-- | Alc/effects/reverb.c | 37 |
1 files changed, 20 insertions, 17 deletions
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]); } } |