blob: 669d9d03cbbcb85a4d511f3bb26180692bfc23c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef FILTER_SPLITTER_H
#define FILTER_SPLITTER_H
#include "alMain.h"
#include "almalloc.h"
/* Band splitter. Splits a signal into two phase-matching frequency bands. */
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(Real f0norm);
void clear() noexcept { lp_z1 = lp_z2 = ap_z1 = 0.0f; }
void process(Real *hpout, Real *lpout, const Real *input, const int count);
void applyHfScale(Real *samples, const Real hfscale, const int count);
};
using BandSplitter = BandSplitterR<float>;
/* The all-pass portion of the band splitter. Applies the same phase shift
* without splitting the signal.
*/
template<typename Real>
class SplitterAllpassR {
Real coeff{0.0f};
Real z1{0.0f};
public:
void init(Real f0norm);
void clear() noexcept { z1 = 0.0f; }
void process(Real *samples, int count);
};
using SplitterAllpass = SplitterAllpassR<float>;
struct FrontStablizer {
static constexpr size_t DelayLength{256u};
alignas(16) float DelayBuf[MAX_OUTPUT_CHANNELS][DelayLength];
SplitterAllpass APFilter;
BandSplitter LFilter, RFilter;
alignas(16) float LSplit[2][BUFFERSIZE];
alignas(16) float RSplit[2][BUFFERSIZE];
alignas(16) float TempBuf[BUFFERSIZE + DelayLength];
DEF_NEWDEL(FrontStablizer)
};
#endif /* FILTER_SPLITTER_H */
|