scaffold new classes

This commit is contained in:
2026-06-10 22:56:15 -05:00
parent 1fd4f03668
commit 347f585630
9 changed files with 117 additions and 0 deletions

36
src/synth/Voice.hpp Normal file
View File

@@ -0,0 +1,36 @@
#pragma once
#include <stdint.h>
#include "Instrument.hpp"
// a voice is a tone generator that the synth uses for polyphony
// the synth mixes multiple voices together into a polyphonic audio. calculations for samples are handled in the instrument
class Voice {
public:
Voice() = default;
~Voice() = default;
void noteOn(int8_t midiNote, float velocity);
void noteOff();
bool isActive();
float process(bool& scopeTrigger);
uint8_t note() { return note_; }
private:
float sampleRate_ = 44100.0f;
inline float noteToFrequency(uint8_t note);
uint8_t note_ = 0;
float velocity_ = 1.0f;
bool active_ = false;
Instrument* instrument;
};