aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-06-12 09:40:30 -0700
committerChris Robinson <[email protected]>2014-06-12 09:40:30 -0700
commit19ec7b2ad241a7b4423cfa9df53e78f480ef9b5e (patch)
tree0a3eb19b391a34e4416e62f8d5160cb84a3dcb61 /Alc
parent4c706f59d9b21e1870c9fa4d7705b5bcebb834e6 (diff)
Pre-apply the crossfeed filter gain to the input sample coefficients
Diffstat (limited to 'Alc')
-rw-r--r--Alc/bs2b.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/Alc/bs2b.c b/Alc/bs2b.c
index 3d7e75ec..d936f75a 100644
--- a/Alc/bs2b.c
+++ b/Alc/bs2b.c
@@ -38,7 +38,7 @@ static void init(struct bs2b *bs2b)
{
float Fc_lo, Fc_hi;
float G_lo, G_hi;
- float x;
+ float x, g;
bs2b->srate = clampi(bs2b->srate, 2000, 192000);
@@ -89,21 +89,20 @@ static void init(struct bs2b *bs2b)
break;
} /* switch */
+ g = 1.0f / (1.0f - G_hi + G_lo);
+
/* $fc = $Fc / $s;
* $d = 1 / 2 / pi / $fc;
* $x = exp(-1 / $d);
*/
-
x = expf(-2.0f * F_PI * Fc_lo / bs2b->srate);
bs2b->b1_lo = x;
- bs2b->a0_lo = G_lo * (1.0f - x);
+ bs2b->a0_lo = G_lo * (1.0f - x) * g;
x = expf(-2.0f * F_PI * Fc_hi / bs2b->srate);
bs2b->b1_hi = x;
- bs2b->a0_hi = 1.0f - G_hi * (1.0f - x);
- bs2b->a1_hi = -x;
-
- bs2b->gain = 1.0f / (1.0f - G_hi + G_lo);
+ bs2b->a0_hi = (1.0f - G_hi * (1.0f - x)) * g;
+ bs2b->a1_hi = -x * g;
} /* init */
/* Exported functions.