Limit convolution processing to the output ambisonic order
[openal-soft.git] / alc / filters / splitter.h
blob18ab499875508e2e14d255d05848f5f31fbbe534
1 #ifndef FILTER_SPLITTER_H
2 #define FILTER_SPLITTER_H
4 #include <cstddef>
6 #include "alspan.h"
9 /* Band splitter. Splits a signal into two phase-matching frequency bands. */
10 template<typename Real>
11 class BandSplitterR {
12 Real mCoeff{0.0f};
13 Real mLpZ1{0.0f};
14 Real mLpZ2{0.0f};
15 Real mApZ1{0.0f};
17 public:
18 BandSplitterR() = default;
19 BandSplitterR(const BandSplitterR&) = default;
20 BandSplitterR(Real f0norm) { init(f0norm); }
22 void init(Real f0norm);
23 void clear() noexcept { mLpZ1 = mLpZ2 = mApZ1 = 0.0f; }
24 void process(const al::span<const Real> input, Real *hpout, Real *lpout);
26 void processHfScale(const al::span<Real> samples, const Real hfscale);
28 /* The all-pass portion of the band splitter. Applies the same phase shift
29 * without splitting the signal. Note that each use of this method is
30 * indepedent, it does not track history between calls.
32 void applyAllpass(const al::span<Real> samples) const;
34 using BandSplitter = BandSplitterR<float>;
36 #endif /* FILTER_SPLITTER_H */