wip: synth api && adder

This commit is contained in:
2023-08-07 02:28:06 +04:00
parent d20dbd920f
commit 66c839e2ae
5 changed files with 59 additions and 35 deletions

21
inc/Adder.h Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <vector>
#include "Oscillator.h"
class Adder
{
private:
/* data */
public:
Adder(/* args */);
~Adder();
std::vector<float> & SumOscillators(const std::vector<Oscillator*> & oscillators, float duration);
};
Adder::Adder(/* args */)
{
}
Adder::~Adder()
{
}

View File

@@ -5,4 +5,4 @@
struct Note {
std::string& name;
int length;
}
};

View File

@@ -3,26 +3,29 @@
#include <vector>
#include "Oscillator.h"
#include "Note.h"
#include "Adder.h"
#include "Settings.h"
class Synth
{
private:
std::vector<Oscillator&> m_oscillators;
std::vector<Oscillator*> m_oscillators;
Adder m_adder;
//OscillatorUI* ui_oscillators;
Note m_current_note;
std::vector<float> m_out_signal;
std::vector<float> & sum_oscillators(float duration);
std::vector<float> & note(int semitone, float beats);
std::vector<float> & get_note(int semitone, float beats);
public:
Synth(/* args */);
~Synth();
std::vector<float> & GetNoteSound(Note input)
void ProduceNoteSound(Note input);
const std::vector<float> & GetOutSignal() { return m_out_signal; }
};
Synth::Synth(/* args */)
{
m_oscillators.push_back(new Oscillator(OscillatorType.Sine, 440.f, VOLUME));
m_oscillators.push_back(new Oscillator(OscillatorType::Sine, 440.f, VOLUME));
}
Synth::~Synth()