aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/filters/splitter.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-06 04:45:35 -0800
committerChris Robinson <[email protected]>2019-01-06 04:45:35 -0800
commitd2e34e509bfc3d99c8db03dccf43806c5957bc23 (patch)
tree676b9c3f22fae8863a2a28e94201b59cf46a114c /Alc/filters/splitter.h
parentda3a916042a7ba9426af1d6f03e689dbd7760191 (diff)
Make the band-splitter and splitter-allpass filters templated
With float and double explicit instantiations
Diffstat (limited to 'Alc/filters/splitter.h')
-rw-r--r--Alc/filters/splitter.h28
1 files changed, 16 insertions, 12 deletions
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<typename Real>
+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<float>;
/* 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<typename Real>
+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<float>;
struct FrontStablizer {