37 lines
531 B
C++
37 lines
531 B
C++
#ifndef VOICE
|
|
#define VOICE
|
|
|
|
#include <cstdint>
|
|
#include <numbers>
|
|
#include <cmath>
|
|
|
|
#include "../include/envelope.hpp"
|
|
#include "../include/oscillator.hpp"
|
|
|
|
class Voice{
|
|
public:
|
|
Voice(){
|
|
note = 0;
|
|
|
|
active = false;
|
|
}
|
|
|
|
void note_on(uint8_t note, uint8_t velocity);
|
|
void note_off();
|
|
|
|
double generate();
|
|
|
|
bool is_active() const;
|
|
|
|
private:
|
|
Envelope envelope;
|
|
Oscillator oscillator;
|
|
|
|
uint8_t note;
|
|
|
|
bool active;
|
|
|
|
};
|
|
|
|
#endif
|