From cfb9046eec768c76baa4c0711870bb255c86ef4a Mon Sep 17 00:00:00 2001 From: mick grierson Date: Mon, 19 Dec 2016 22:35:23 +0000 Subject: Fixing errors in new envelope functions. maxiEnvelope now has a ramp function, a ramps function that takes time / value pairs from a std::vector, an adsr and ar that all sync directly to the samplerate. They all take params in seconds. This makes it easier for javascript users when I transpile with emscripten. Wait what? --- maximilian.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'maximilian.h') diff --git a/maximilian.h b/maximilian.h index fa53428..54dec4b 100755 --- a/maximilian.h +++ b/maximilian.h @@ -109,27 +109,29 @@ public: class maxiEnvelope { - double period; + double period=0; double output; double phase; double startVal; double endVal; double currentval; double nextval; + bool noteOn; bool releaseMode; bool decayMode; bool sustainMode; - bool attackMode=true; + bool attackMode; int isPlaying; public: - int trigger=1; + int trigger; double line(int numberofsegments,double segments[100]); - double ramp(double startVal=0, double endVal=1, double duration=1, int trigger=1); - double ramps(double rampsArray[1000], int trigger=1); - double ar(double attack=0.1, double release=0.1,int trigger=1); - double adsr(double attack=0.1, double decay=0.1, double sustain=0.1, double release=0.1,int trigger=1); + double ramp(double startVal=0, double endVal=1, double duration=1); + double ramps(std::vector rampsArray); + double ar(double attack=0.1, double release=0.1); + double adsr(double attack=0.1, double decay=0.1, double sustain=0.1, double release=0.1); // void trigger(int index,double amp); + void note(bool noteOn=false); int valindex; double amplitude; -- cgit v1.3