[feat]: Filter #18

Merged
e1lama merged 15 commits from feature/filter-1 into master 2023-09-09 21:56:47 +00:00
16 changed files with 281 additions and 5 deletions
Showing only changes of commit 55242db407 - Show all commits

View File

@@ -13,7 +13,7 @@ struct Adder {
for (size_t i = 0; i < sample_count; i++) {
float sample = 0.0f;
for (Oscillator* osc : oscillators) {
sample += osc->GenerateSample();
sample += osc->Process();
}
signal[i] = sample;

View File

@@ -31,5 +31,5 @@ class Oscillator {
float GetFreq() { return m_freq; }
void SetFreq(float freq);
void Reset();
float GenerateSample();
float Process();
};

View File

@@ -45,7 +45,7 @@ void Oscillator::SetFreq(float freq) {
m_phase_dt = (this->*m_dt_function)(freq);
}
float Oscillator::GenerateSample() {
float Oscillator::Process() {
return (this->*m_osc_function)() * m_volume;
}

View File

@@ -71,7 +71,7 @@ void Synth::Trigger(Note input) {
}
void Synth::apply_filter_lfo() {
float dt = m_lfo->GenerateSample();
float dt = m_lfo->Process();
Filter* filter = (Filter*)m_effects[1];
float freq = filter->GetFreq();
//todo: check formula