gaoweidong
2026-01-13 c5eeada2c735b0209a061a233483c5cfc29c2230
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
#ifndef _IIRFILETER_HH_8524585704327027602
#define _IIRFILETER_HH_8524585704327027602
 
/// <summary>
/// IIRÂ˲¨Æ÷ÀàÐÍ
/// </summary>
enum IIRFilterType
{
    bessel,
    butterworth,
    linkwitz_riley,
    eq,
};
 
enum IIRBANDType
{
    lowpass,
    highpass,
    bpf_pq, //(constant skirt gain, peak gain = Q)
    bpf_zero, //(constant 0 dB peak gain)
    notch,
    apf,
    peaking_eq,
    lowshelf,
    highshelf,
};
 
class IIRFilter
{
private:
    void call_peaking_eq_with_lowfreq(double fc, double gain, double q, int fs, double* coef_b, double* coef_a);
    void call_peaking_eq(double fc, double gain, double q, int fs, double* coef_b, double* coef_a);
public:
    int eq(IIRBANDType type, int f0, double g, double q, int fs, double(*sos)[6]);
    int butters(IIRBANDType type, int n, int fc, int fs, double g, double (*sos)[6]);
    int linkwitzs(IIRBANDType type, int n, int fc, int fs, double g, double(*sos)[6]);
    int bessels(IIRBANDType type, int n, int fc, int fs,  double g, double(*sos)[6]);
};
 
#endif