[feat]: Filter (#18)

closes #16

Reviewed-on: #18
This commit is contained in:
2023-09-10 00:56:47 +03:00
parent 868a59da0e
commit bb3ccc296a
22 changed files with 372 additions and 48 deletions

23
src/BandPassFilter.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "BandPassFilter.h"
BandPassFilter::BandPassFilter(/* args */) {}
BandPassFilter::BandPassFilter(Filter* filter) {
m_freq = filter->GetFreq();
m_q = filter->GetRes();
m_order = filter->GetPeakGain();
}
BandPassFilter::BandPassFilter(float freq, float res, float q) {}
BandPassFilter::~BandPassFilter() {}
void BandPassFilter::CalculateCoefficients() {
CalculateNormals();
m_norm = 1 / (1 + m_k / m_q + m_k * m_k);
m_a0 = m_k / m_q * m_norm;
m_a1 = 0;
m_a2 = -m_a0;
m_b1 = 2 * (m_k * m_k - 1) * m_norm;
m_b2 = (1 - m_k / m_q + m_k * m_k) * m_norm;
}