Nu:Tekt NTS-1 digital SDK
v1.1-0
|
Go to the documentation of this file.
76 ff0(0), ff1(0), ff2(0),
88 static inline __attribute__((optimize(
"Ofast"),always_inline))
89 float
wc(const
float fc, const
float fsrecip) {
100 inline __attribute__((optimize(
"Ofast"),always_inline))
104 fb2 = ff2 = ff1 = 0.f;
112 inline __attribute__((optimize(
"Ofast"),always_inline))
116 fb2 = ff2 = ff1 = 0.f;
124 inline __attribute__((optimize(
"Ofast"),always_inline))
137 inline __attribute__((optimize(
"Ofast"),always_inline))
139 const float kp1 = k+1.f;
140 const float km1 = k-1.f;
151 inline __attribute__((optimize(
"Ofast"),always_inline))
154 const float kp1 = k+1.f;
155 const float km1 = k-1.f;
167 inline __attribute__((optimize(
"Ofast"),always_inline))
170 const float kp1 = k+1.f;
171 const float km1 = k-1.f;
172 ff0 = fb1 = km1 / kp1;
184 inline __attribute__((optimize(
"Ofast"),always_inline))
187 const float g1 = 1.f -
wc;
199 inline __attribute__((optimize(
"Ofast"),always_inline))
213 inline __attribute__((optimize(
"Ofast"),always_inline))
217 const float qk2 = q * k * k;
218 const float qk2_k_q_r = 1.f / (qk2 + k + q);
219 ff0 = ff2 = qk2 * qk2_k_q_r;
221 fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
222 fb2 = (qk2 - k + q) * qk2_k_q_r;
231 inline __attribute__((optimize(
"Ofast"),always_inline))
235 const float qk2 = q * k * k;
236 const float qk2_k_q_r = 1.f / (qk2 + k + q);
237 ff0 = ff2 = q * qk2_k_q_r;
239 fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
240 fb2 = (qk2 - k + q) * qk2_k_q_r;
249 inline __attribute__((optimize(
"Ofast"),always_inline))
253 const float qk2 = q * k * k;
254 const float qk2_k_q_r = 1.f / (qk2 + k + q);
258 fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
259 fb2 = (qk2 - k + q) * qk2_k_q_r;
268 inline __attribute__((optimize(
"Ofast"),always_inline))
272 const float qk2 = q * k * k;
273 const float qk2_k_q_r = 1.f / (qk2 + k + q);
274 ff0 = ff2 = (qk2 + q) * qk2_k_q_r;
275 ff1 = fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
276 fb2 = (qk2 - k + q) * qk2_k_q_r;
285 inline __attribute__((optimize(
"Ofast"),always_inline))
289 const float qk2 = q * k * k;
290 const float qk2_k_q_r = 1.f / (qk2 + k + q);
291 ff0 = fb2 = (qk2 - k + q) * qk2_k_q_r;
292 ff1 = fb1 = 2.f * (qk2 - q) * qk2_k_q_r;
305 inline __attribute__((optimize(
"Ofast"),always_inline))
306 void
setSOAP2(const
float delta, const
float gamma) {
309 const float c = (gamma - 1.f) / (gamma + 1.f);
310 const float d = -delta;
312 ff1 = fb1 = d * (1.f - c);
324 inline __attribute__((optimize(
"Ofast"),always_inline))
325 void
setSOAP3(const
float delta, const
float radius) {
328 const float a1 = -2.f * radius * delta;
329 const float a2 = radius * radius;
354 inline __attribute__((optimize(
"Ofast"),always_inline))
366 inline __attribute__((optimize(
"Ofast"),always_inline))
368 float acc =
mCoeffs.ff0 * xn + mZ1;
383 inline __attribute__((optimize(
"Ofast"),always_inline))
385 float acc =
mCoeffs.ff0 * xn + mZ1;
398 inline __attribute__((optimize(
"Ofast"),always_inline))
442 inline __attribute__((optimize(
"Ofast"),always_inline))
454 inline __attribute__((optimize(
"Ofast"),always_inline))
456 float acc =
mCoeffs.ff0 * xn + mZ1;
461 return mW1 * (mW0 * acc + mD0 * xn) + mD1 * xn;
471 inline __attribute__((optimize(
"Ofast"),always_inline))
473 float acc =
mCoeffs.ff0 * xn + mZ1;
476 return mW1 * (mW0 * acc + mD0 * xn) + mD1 * xn;
486 inline __attribute__((optimize(
"Ofast"),always_inline))
498 inline __attribute__((optimize(
"Ofast"),always_inline))
512 inline __attribute__((optimize(
"Ofast"),always_inline))
525 inline __attribute__((optimize(
"Ofast"),always_inline))
535 inline __attribute__((optimize(
"Ofast"),always_inline))
548 inline __attribute__((optimize(
"Ofast"),always_inline))
549 void
setFOLS(const
float k, const
float gain) {
552 const float h = gain - 1.f;
553 const float g = (gain >= 1.f) ? 1.f : gain;
571 inline __attribute__((optimize(
"Ofast"),always_inline))
572 void
setFOHS(const
float k, const
float gain) {
575 const float h = gain - 1.f;
576 const float gk = (gain >= 1.f) ? k : gain*k;
599 inline __attribute__((optimize(
"Ofast"),always_inline))
620 inline __attribute__((optimize(
"Ofast"),always_inline))
643 inline __attribute__((optimize(
"Ofast"),always_inline))
644 void
setSOAPPN2(const
float delta, const
float gamma, const
float gain) {
648 const float h = gain - 1.f;
649 const float g = (gain >= 1.f) ? 1.f : gain;
651 const float c = (gamma - g) / (gamma + g);
652 const float d = -delta;
671 float mD0, mD1, mW0, mW1;
struct dsp::BiQuad::Coeffs Coeffs
Filter coefficients.
Extended transposed form 2 Bi-Quad construct.
float process_so(const float xn)
Second order processing of one sample.
BiQuad::Coeffs mCoeffs
Coefficients for the Bi-Quad construct.
void setSOAPPN2(const float delta, const float gamma, const float gain)
Calculate coefficients for second order all pass based peak/notch filter.
void setFOAP2(const float wc)
Calculate coefficients for first order all pass filter.
void setSOAP2(const float delta, const float gamma)
Calculate coefficients for second order all pass filter.
void setSOBR(const float k, const float q)
Calculate coefficients for second order band reject filter.
Floating Point Math Utilities.
void setSODC(const float pole)
Calculate coefficients for second order DC filter.
void setSOAPBP2(const float delta, const float gamma)
Calculate coefficients for second order all pass based band pass filter.
void setSOLP(const float k, const float q)
Calculate coefficients for second order low pass filter.
float process_fo(const float xn)
First order processing of one sample.
void setFOHS(const float k, const float gain)
Calculate coefficients for first order all pass based high shelf filter.
static float wc(const float fc, const float fsrecip)
Convert Hz frequency to radians.
void setFOLP(const float k)
Calculate coefficients for first order low pass filter.
void setSOAPBR2(const float delta, const float gamma)
Calculate coefficients for second order all pass based band reject filter.
Coeffs()
Default constructor.
void setSOHP(const float k, const float q)
Calculate coefficients for second order high pass filter.
float process_so(const float xn)
Second order processing of one sample.
Coeffs mCoeffs
Coefficients for the Bi-Quad construct.
void setFOAPLP(const float k)
Calculate coefficients for "invertable" all pass based low pass filter.
void flush(void)
Flush internal delays.
void setSOAP3(const float delta, const float radius)
Calculate coefficients for second order all pass filter.
float process(const float xn)
Default processing function (second order)
void setFOHP(const float k)
Calculate coefficients for first order high pass filter.
void setPoleHP(const float pole)
Calculate coefficients for single pole high pass filter.
void toggleFOLPHP(void)
Toggle "invertable" all pass based low/high pass filter to opposite mode.
void updateFOLPHP(const float k)
Update "invertable" all pass based low/high pass filter coefficients.
void flush(void)
Flush internal delays.
ExtBiQuad(void)
Default constructor.
void setPoleLP(const float pole)
Calculate coefficients for single pole low pass filter.
BiQuad(void)
Default constructor.
float process(const float xn)
Default processing function (second order)
void setFOLS(const float k, const float gain)
Calculate coefficients for first order all pass based low shelf filter.
Transposed form 2 Bi-Quad construct for FIR/IIR filters.
void setSOBP(const float k, const float q)
Calculate coefficients for second order band pass filter.
void setFOAP(const float k)
Calculate coefficients for first order all pass filter.
float process_fo(const float xn)
First order processing of one sample.
void setSOAP1(const float k, const float q)
Calculate coefficients for second order all pass filter.
void setFODC(const float pole)
Calculate coefficients for single pole DC filter.
void setFOAPHP(const float k)
Calculate coefficients for "invertable" all pass based high pass filter.