From d2e34e509bfc3d99c8db03dccf43806c5957bc23 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 6 Jan 2019 04:45:35 -0800 Subject: Make the band-splitter and splitter-allpass filters templated With float and double explicit instantiations --- Alc/filters/splitter.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'Alc/filters/splitter.h') diff --git a/Alc/filters/splitter.h b/Alc/filters/splitter.h index b39c3491..e1122577 100644 --- a/Alc/filters/splitter.h +++ b/Alc/filters/splitter.h @@ -6,30 +6,34 @@ /* Band splitter. Splits a signal into two phase-matching frequency bands. */ -class BandSplitter { - float coeff{0.0f}; - float lp_z1{0.0f}; - float lp_z2{0.0f}; - float ap_z1{0.0f}; +template +class BandSplitterR { + Real coeff{0.0f}; + Real lp_z1{0.0f}; + Real lp_z2{0.0f}; + Real ap_z1{0.0f}; public: - void init(float f0norm); + void init(Real f0norm); void clear() noexcept { lp_z1 = lp_z2 = ap_z1 = 0.0f; } - void process(float *RESTRICT hpout, float *RESTRICT lpout, const float *input, int count); + void process(Real *RESTRICT hpout, Real *RESTRICT lpout, const Real *input, int count); }; +using BandSplitter = BandSplitterR; /* The all-pass portion of the band splitter. Applies the same phase shift * without splitting the signal. */ -class SplitterAllpass { - float coeff{0.0f}; - float z1{0.0f}; +template +class SplitterAllpassR { + Real coeff{0.0f}; + Real z1{0.0f}; public: - void init(float f0norm); + void init(Real f0norm); void clear() noexcept { z1 = 0.0f; } - void process(float *RESTRICT samples, int count); + void process(Real *RESTRICT samples, int count); }; +using SplitterAllpass = SplitterAllpassR; struct FrontStablizer { -- cgit v1.2.3