3 Commits

Author SHA1 Message Date
f0e2d98c12 feat: add stk link to explore in the future 2024-01-17 16:13:44 +07:00
83fe94b34d fix: remove unnecessary stuff 2024-01-17 11:53:19 +07:00
8fc7fbfd30 [feat]: Filter LFO (#23)
Reviewed-on: #23
Co-authored-by: HiveBeats <e1lama@protonmail.com>
Co-committed-by: HiveBeats <e1lama@protonmail.com>
2024-01-17 05:00:26 +03:00
10 changed files with 43 additions and 55 deletions

View File

@@ -36,3 +36,6 @@ 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

View File

@@ -1,17 +0,0 @@
#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,3 +34,39 @@ 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,8 +1,5 @@
#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) {

View File

@@ -1,14 +0,0 @@
#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; };
};

View File

@@ -1,16 +0,0 @@
#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 "BandPassFilter.h"
#include "Filter.h"
#include "Settings.h"
BandPassFilter::BandPassFilter() {

View File

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

View File

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

View File

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