22 lines
418 B
C++
22 lines
418 B
C++
|
|
#include "../include/voice.hpp"
|
||
|
|
|
||
|
|
void Voice::note_on(uint8_t note, uint8_t velocity){
|
||
|
|
uint8_t current_note = note;
|
||
|
|
oscillator.frequency = 440.0*std::pow(2.0,( (static_cast<int>(note)-69)/12.0 ));
|
||
|
|
// oscillator.amplitude =
|
||
|
|
envelope.note_on();
|
||
|
|
active = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Voice::note_off(){
|
||
|
|
envelope.note_off();
|
||
|
|
}
|
||
|
|
/*
|
||
|
|
double Voice::generate(){
|
||
|
|
|
||
|
|
}*/
|
||
|
|
|
||
|
|
const bool Voice::is_active(){
|
||
|
|
return active;
|
||
|
|
}
|