You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
763 B

#include "voice.h"
void Voice::reset() {
adsrAmp.reset();
adsrMod.reset();
}
void Voice::assign(Settings const * settings) {
this->settings = settings;
adsrAmp.assign(&settings->ampEnv);
adsrMod.assign(&settings->modEnv);
for(size_t i = 0; i < MAX_OSCS; ++i) {
if(i & 1) {
osc[i].assign(&settings->osc2Mode);
} else {
osc[i].assign(&settings->osc1Mode);
}
}
filter.assign(&settings->filter);
}
void Voice::noteOn(int note, float velocity, float gain, float pan) {
this->note = note;
this->velocity = velocity;
this->gain = gain;
this->pan = pan;
adsrAmp.noteOn();
adsrMod.noteOn();
}
void Voice::noteOff() {
adsrAmp.noteOff();
adsrMod.noteOff();
}