wip: filter (lp, hp, bp)
This commit is contained in:
12
inc/BandPassFilter.h
Normal file
12
inc/BandPassFilter.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Filter.h"
|
||||
|
||||
class BandPassFilter: public Filter
|
||||
{
|
||||
private:
|
||||
void calculate_coefficients() override;
|
||||
public:
|
||||
BandPassFilter(/* args */);
|
||||
~BandPassFilter();
|
||||
};
|
||||
|
||||
32
inc/Filter.h
Normal file
32
inc/Filter.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include "Effect.h"
|
||||
|
||||
class Filter: public Effect
|
||||
{
|
||||
|
||||
|
||||
protected:
|
||||
struct Normals {
|
||||
float V;
|
||||
float K;
|
||||
};
|
||||
|
||||
float m_freq; // cutoff frequency
|
||||
float m_q; // filter quantity (resonance)
|
||||
float m_order; // filter order (peakGain)
|
||||
/* todo: filter adsr */
|
||||
float m_norm;
|
||||
float m_a0, m_a1, m_a2, m_b1, m_b2;
|
||||
float m_z1, m_z2;
|
||||
Normals calculate_normals();
|
||||
virtual void calculate_coefficients(){};
|
||||
public:
|
||||
Filter(/* args */);
|
||||
~Filter();
|
||||
void Trigger() override;
|
||||
void Release() override;
|
||||
float Process(float in);
|
||||
void Process(std::vector<float>& samples) override;
|
||||
void SetParameters(float freq, float res, float q);
|
||||
};
|
||||
|
||||
12
inc/HighPassFilter.h
Normal file
12
inc/HighPassFilter.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "Filter.h"
|
||||
|
||||
class HighPassFilter: public Filter
|
||||
{
|
||||
private:
|
||||
void calculate_coefficients() override;
|
||||
public:
|
||||
HighPassFilter(/* args */);
|
||||
~HighPassFilter();
|
||||
};
|
||||
|
||||
13
inc/LowPassFilter.h
Normal file
13
inc/LowPassFilter.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Filter.h"
|
||||
|
||||
class LowPassFilter: public Filter
|
||||
{
|
||||
protected:
|
||||
void calculate_coefficients() override;
|
||||
public:
|
||||
LowPassFilter(/* args */);
|
||||
~LowPassFilter();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user