-
Notifications
You must be signed in to change notification settings - Fork 6
/
make_filter.h
171 lines (144 loc) · 4.42 KB
/
make_filter.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#pragma once
/*
Copyright (C) 2014 Tony Kirke
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <spuce/typedefs.h>
#include <spuce/filters/fir_coeff.h>
#include <spuce/filters/iir.h>
#include <spuce/filters/fir.h>
#include <spuce/filters/cutboost.h>
#include <spuce/filters/notch_allpass.h>
//#include <spuce/filters/iir_allpass1.h>
//#include <spuce/filters/nested_iir_allpass_2.h>
//#include <spuce/filters/nested_shelf_allpass_2.h>
#include <spuce/filters/iir_allpass1_sections.h>
#include <spuce/filters/iir_allpass1_sections_variable_delay.h>
#include <spuce/filters/iir_shelf.h>
#include <spuce/filters/shelf_allpass1.h>
#include <spuce/filters/cascaded_cic.h>
#include <spuce/filters/iir_comb.h>
#include <spuce/filters/notch_comb.h>
namespace spuce {
#include "des_filter.h"
enum fil_enum {None,MaxflatHalfband, EllipticHalfband,
Butterworth, Chebyshev, Elliptic,
MaxflatFIR, GaussianFIR, RemezFIR,
RaisedCosine,
NotchIIR, CutBoost, Shelf, RootRaisedCosine};
class make_filter {
enum fil_type {low, high, band};
public:
double elliptic_fc;
double butterworth_fc;
double chebyshev_fc;
double notch_fc;
double remez_pass_edge;
double remez_stop_edge;
double remez_stop_weight;
double cut_stop_db;
double cut_fc;
double rc_fc;
double rrc_fc;
double maxflat_fc;
double gauss_fc;
double elliptic_halfband_ripple;
double variable_ripple;
double elliptic_pass_edge;
double elliptic_stop_edge;
double elliptic_trans;
double remez_trans;
double elliptic_stop_db;
double elliptic_ripple;
double chebyshev_ripple;
double rc_alpha;
double rrc_alpha;
double notch_trans;
double notch50_trans;
double cut_trans;
double shelf_low;
double shelf_high;
double shelf_fc;
double shelf_gain;
double comb_gain;
double notch_comb_gain;
double low_shelf_gain;
double high_shelf_gain;
double nested_k;
bool hpf;
// bool elliptic_halfband_hpf;
int elliptic_halfband_rate;
int maxflat_halfband_rate;
int elliptic_order;
int butterworth_order;
int chebyshev_order;
int gauss_taps;
int remez_taps;
int maxflat_taps;
int rc_taps;
int rrc_taps;
int elliptic_halfband_order;
int maxflat_halfband_order;
int comb_rate;
int notch_comb_rate;
int pts;
int bits;
double fs;
double bpf_freq;
double phase;
typedef double audio_data_type;
fir_coeff<double> Remez_Fir;
fir_coeff<double> Maxflat_Fir;
fir_coeff<double> Gaussian_Fir;
fir_coeff<double> RaisedCosine_Fir;
fir_coeff<double> RootRaisedCosine_Fir;
fir<audio_data_type > R_Fir;
fir<audio_data_type > M_Fir;
fir<audio_data_type > G_Fir;
fir<audio_data_type > RC_Fir;
fir<audio_data_type > RRC_Fir;
iir<audio_data_type > B_IIR;
iir<audio_data_type > C_IIR;
iir<audio_data_type > E_IIR;
cutboost<audio_data_type, double > CUT_B;
notch_allpass<audio_data_type,double> NOTCH;
notch_allpass<audio_data_type,double> N50;
iir_allpass1_sections_variable_delay<audio_data_type,double> B_Sub;
iir_allpass1_sections_variable_delay<audio_data_type,double> E_Sub;
iir_shelf<audio_data_type,double> S_IIR;
shelf_allpass1<audio_data_type,double> Z1_IIR;
fil_enum shape;
fil_enum last_shape;
fil_type pass_type;
double change_center(double f);
double horiz_swipe(int len, bool in_passband);
double get_fc(int len,bool in_passband);
int get_order();
bool is_fir();
bool is_bpf();
double ripple();
double stopdB();
void vertical_swipe(int len, bool in_passband,bool above_stop);
double update(double *w);
double update(double *w, double w_inc);
void sel_filter(const char* sel);
void change_filter(fil_enum f);
double limit(double x, double mx, double min);
make_filter();
~make_filter();
void init(int points);
void reset();
void clear_filters();
void set_filter_type(int h);
void set_fs(double f);
};
} // namespace spuce