summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-01-05 03:51:24 -0800
committerChris Robinson <[email protected]>2008-01-05 03:51:24 -0800
commit312108a0d32190289a1e59a3797b7075d6d745d3 (patch)
tree7baac9b59defd45a5af6ddb92952b0a8367eeaec
parent5e48be27b840ff0a8b90baaae41e2809f7ca99ab (diff)
Try a different low-pass filter
Seems to be more correct, although it's not as powerful as the previous (which may be a good thing)
-rw-r--r--Alc/ALu.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ce669791..eefab9ee 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -211,8 +211,9 @@ static __inline ALfloat aluComputeDrySample(ALsource *source, ALfloat DryGainHF,
{
if(DryGainHF < 1.0f)
{
- sample *= DryGainHF;
- sample += source->LastDrySample * (1.0f - DryGainHF);
+ ALfloat u = sample + source->LastDrySample;
+ ALfloat v = sample - source->LastDrySample;
+ sample = (u + (v*DryGainHF)) * 0.5;
}
source->LastDrySample = sample;
@@ -223,8 +224,9 @@ static __inline ALfloat aluComputeWetSample(ALsource *source, ALfloat WetGainHF,
{
if(WetGainHF < 1.0f)
{
- sample *= WetGainHF;
- sample += source->LastWetSample * (1.0f - WetGainHF);
+ ALfloat u = sample + source->LastWetSample;
+ ALfloat v = sample - source->LastWetSample;
+ sample = (u + (v*WetGainHF)) * 0.5;
}
source->LastWetSample = sample;