Compare commits
4 Commits
master
...
feature/os
| Author | SHA1 | Date | |
|---|---|---|---|
|
2cfc49bac3
|
|||
|
29ceabca74
|
|||
|
4fd0cb279d
|
|||
|
61c0d3b787
|
@@ -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
17
inc/BandPassFilter.h
Normal 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; };
|
||||
};
|
||||
|
||||
|
||||
36
inc/Filter.h
36
inc/Filter.h
@@ -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; };
|
||||
};
|
||||
@@ -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
14
inc/HighPassFilter.h
Normal 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
16
inc/LowPassFilter.h
Normal 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; };
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Filter.h"
|
||||
#include "BandPassFilter.h"
|
||||
#include "Settings.h"
|
||||
|
||||
BandPassFilter::BandPassFilter() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Filter.h"
|
||||
#include "HighPassFilter.h"
|
||||
#include "Settings.h"
|
||||
|
||||
HighPassFilter::HighPassFilter() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Filter.h"
|
||||
#include "LowPassFilter.h"
|
||||
#include "Settings.h"
|
||||
|
||||
LowPassFilter::LowPassFilter() {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Logger.h"
|
||||
#include "OscillatorType.h"
|
||||
#include "Settings.h"
|
||||
#include "LowPassFilter.h"
|
||||
|
||||
Synth::Synth(/* args */) {
|
||||
m_lfo = new LFO();
|
||||
|
||||
Reference in New Issue
Block a user