4 Commits

Author SHA1 Message Date
2cfc49bac3 feat: all filter types 2024-01-17 08:56:59 +07:00
29ceabca74 wip: State Variable Filter (FILTER LFO WORKS NOW!!!) 2024-01-17 08:56:58 +07:00
4fd0cb279d wip: moog filter mentioned 2024-01-17 08:56:58 +07:00
61c0d3b787 wip: state-variable filter doc 2024-01-17 08:56:58 +07:00
10 changed files with 55 additions and 43 deletions

View File

@@ -36,6 +36,3 @@ for (n = 0; n < totalSamples; n++) {
We can replace the sin function with any periodic function that returns an amplitude for a given phase angle. Thus, this small piece of code can be used to produce a very wide range of sounds. Functionally, it is the software equivalent of an oscillator, the basic building block of almost all synthesizers.
https://ccrma.stanford.edu/software/stk/index.html

17
inc/BandPassFilter.h Normal file
View File

@@ -0,0 +1,17 @@
#pragma once
#include "Filter.h"
class BandPassFilter : public Filter {
protected:
float GetSampleForFilterType() override;
public:
BandPassFilter();
BandPassFilter(Filter* filter);
BandPassFilter(float freq, float res, float q);
~BandPassFilter();
bool IsSameFilterType(FilterType type) override { return type == BandPass; };
};

View File

@@ -34,39 +34,3 @@ class Filter : public IEffect {
float GetPeakGain() { return m_drive; }
virtual bool IsSameFilterType(FilterType type) { return false; };
};
class BandPassFilter : public Filter {
protected:
float GetSampleForFilterType() override;
public:
BandPassFilter();
BandPassFilter(Filter* filter);
BandPassFilter(float freq, float res, float q);
~BandPassFilter();
bool IsSameFilterType(FilterType type) override { return type == BandPass; };
};
class HighPassFilter : public Filter {
protected:
float GetSampleForFilterType() override;
public:
HighPassFilter();
HighPassFilter(Filter* filter);
HighPassFilter(float freq, float res, float q);
~HighPassFilter();
bool IsSameFilterType(FilterType type) override { return type == HighPass; };
};
class LowPassFilter : public Filter {
protected:
float GetSampleForFilterType() override;
public:
LowPassFilter();
LowPassFilter(Filter* filter);
LowPassFilter(float freq, float res, float q);
~LowPassFilter();
bool IsSameFilterType(FilterType type) override { return type == LowPass; };
};

View File

@@ -1,5 +1,8 @@
#pragma once
#include "Filter.h"
#include "LowPassFilter.h"
#include "BandPassFilter.h"
#include "HighPassFilter.h"
struct FilterFactory {
static Filter* CreateFilter(Filter* old_filter, FilterType new_type) {

14
inc/HighPassFilter.h Normal file
View File

@@ -0,0 +1,14 @@
#pragma once
#include "Filter.h"
class HighPassFilter : public Filter {
protected:
float GetSampleForFilterType() override;
public:
HighPassFilter();
HighPassFilter(Filter* filter);
HighPassFilter(float freq, float res, float q);
~HighPassFilter();
bool IsSameFilterType(FilterType type) override { return type == HighPass; };
};

16
inc/LowPassFilter.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include "Filter.h"
class LowPassFilter : public Filter {
protected:
float GetSampleForFilterType() override;
public:
LowPassFilter();
LowPassFilter(Filter* filter);
LowPassFilter(float freq, float res, float q);
~LowPassFilter();
bool IsSameFilterType(FilterType type) override { return type == LowPass; };
};

View File

@@ -1,4 +1,4 @@
#include "Filter.h"
#include "BandPassFilter.h"
#include "Settings.h"
BandPassFilter::BandPassFilter() {

View File

@@ -1,4 +1,4 @@
#include "Filter.h"
#include "HighPassFilter.h"
#include "Settings.h"
HighPassFilter::HighPassFilter() {

View File

@@ -1,4 +1,4 @@
#include "Filter.h"
#include "LowPassFilter.h"
#include "Settings.h"
LowPassFilter::LowPassFilter() {

View File

@@ -4,6 +4,7 @@
#include "Logger.h"
#include "OscillatorType.h"
#include "Settings.h"
#include "LowPassFilter.h"
Synth::Synth(/* args */) {
m_lfo = new LFO();