#include "synth/dsp/adsr.h" const ADSR::Envelope ADSR::DEFAULT_ENVELOPE = { .attackStep = 1, .decayStep = 1, .sustain = 1, .releaseStep = 1 }; ADSR::ADSR() { this->envelope = &DEFAULT_ENVELOPE; this->state = IDLE; this->gain = 0; } void ADSR::setEnvelope(const Envelope* envelope) { this->envelope = envelope; } void ADSR::noteOn() { state = ATTACK; } void ADSR::noteOff() { state = RELEASE; }