diff options
author | Chris Robinson <[email protected]> | 2014-06-12 09:40:30 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-06-12 09:40:30 -0700 |
commit | 19ec7b2ad241a7b4423cfa9df53e78f480ef9b5e (patch) | |
tree | 0a3eb19b391a34e4416e62f8d5160cb84a3dcb61 /OpenAL32/Include | |
parent | 4c706f59d9b21e1870c9fa4d7705b5bcebb834e6 (diff) |
Pre-apply the crossfeed filter gain to the input sample coefficients
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/bs2b.h | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/OpenAL32/Include/bs2b.h b/OpenAL32/Include/bs2b.h index 47d9d674..f1f3627a 100644 --- a/OpenAL32/Include/bs2b.h +++ b/OpenAL32/Include/bs2b.h @@ -59,9 +59,6 @@ struct bs2b { float a1_hi; float b1_hi; - /* Global gain against overloading */ - float gain; - /* Buffer of last filtered sample. * [0] - first channel, [1] - second channel */ @@ -93,11 +90,9 @@ void bs2b_clear(struct bs2b *bs2b); /* Crossfeeds one stereo sample that are pointed by sample. * [0] - first channel, [1] - second channel. - * Returns crossfided samle by sample pointer. + * Returns crossfided sample by sample pointer. */ - -/* sample points to floats */ -inline void bs2b_cross_feed(struct bs2b *bs2b, float *restrict samples) +inline void bs2b_cross_feed(struct bs2b *bs2b, float *restrict sample) { /* Single pole IIR filter. * O[n] = a0*I[n] + a1*I[n-1] + b1*O[n-1] @@ -110,22 +105,18 @@ inline void bs2b_cross_feed(struct bs2b *bs2b, float *restrict samples) #define hi_filter(in, in_1, out_1) (bs2b->a0_hi*(in) + bs2b->a1_hi*(in_1) + bs2b->b1_hi*(out_1)) /* Lowpass filter */ - bs2b->last_sample.lo[0] = lo_filter(samples[0], bs2b->last_sample.lo[0]); - bs2b->last_sample.lo[1] = lo_filter(samples[1], bs2b->last_sample.lo[1]); + bs2b->last_sample.lo[0] = lo_filter(sample[0], bs2b->last_sample.lo[0]); + bs2b->last_sample.lo[1] = lo_filter(sample[1], bs2b->last_sample.lo[1]); /* Highboost filter */ - bs2b->last_sample.hi[0] = hi_filter(samples[0], bs2b->last_sample.asis[0], bs2b->last_sample.hi[0]); - bs2b->last_sample.hi[1] = hi_filter(samples[1], bs2b->last_sample.asis[1], bs2b->last_sample.hi[1]); - bs2b->last_sample.asis[0] = samples[0]; - bs2b->last_sample.asis[1] = samples[1]; + bs2b->last_sample.hi[0] = hi_filter(sample[0], bs2b->last_sample.asis[0], bs2b->last_sample.hi[0]); + bs2b->last_sample.hi[1] = hi_filter(sample[1], bs2b->last_sample.asis[1], bs2b->last_sample.hi[1]); + bs2b->last_sample.asis[0] = sample[0]; + bs2b->last_sample.asis[1] = sample[1]; /* Crossfeed */ - samples[0] = bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1]; - samples[1] = bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0]; - - /* Bass boost cause allpass attenuation */ - samples[0] *= bs2b->gain; - samples[1] *= bs2b->gain; + sample[0] = bs2b->last_sample.hi[0] + bs2b->last_sample.lo[1]; + sample[1] = bs2b->last_sample.hi[1] + bs2b->last_sample.lo[0]; #undef hi_filter #undef lo_filter } /* bs2b_cross_feed */ |