[feat]: Filter LFO (#23)

Reviewed-on: #23
Co-authored-by: HiveBeats <e1lama@protonmail.com>
Co-committed-by: HiveBeats <e1lama@protonmail.com>
This commit is contained in:
2024-01-17 05:00:26 +03:00
committed by e1lama
parent 2b4e3cb573
commit 8fc7fbfd30
17 changed files with 363 additions and 114 deletions

View File

@@ -1,23 +1,22 @@
#include "BandPassFilter.h"
#include "Settings.h"
BandPassFilter::BandPassFilter(/* args */) {}
BandPassFilter::BandPassFilter(Filter* filter) {
m_freq = filter->GetFreq();
m_q = filter->GetRes();
m_order = filter->GetPeakGain();
BandPassFilter::BandPassFilter() {
SetParameters(200, 0.1, 0.001);
}
BandPassFilter::BandPassFilter(float freq, float res, float q) {}
BandPassFilter::BandPassFilter(
Filter* filter) {
SetParameters(filter->GetFreq(), filter->GetRes(), filter->GetPeakGain());
}
BandPassFilter::BandPassFilter(float freq, float res,
float q) {
SetParameters(freq, res, 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;
float BandPassFilter::GetSampleForFilterType() {
return m_lowo;
}