aboutsummaryrefslogtreecommitdiffstats
path: root/maximilian.cpp
diff options
context:
space:
mode:
authorMick Grierson <mickgrierson@strangebook.lan>2011-10-09 22:44:17 +0100
committerMick Grierson <mickgrierson@strangebook.lan>2011-10-09 22:44:17 +0100
commite0b77b9814d80cb5ed7dd7d11c9568f342286d60 (patch)
treea457b28e01c50feea60810ff17bc572b8eeb9081 /maximilian.cpp
parent7efb776b1e6862ee2f27ece6499f10690ea7b477 (diff)
added monosynth example to main.cpp
Diffstat (limited to 'maximilian.cpp')
-rw-r--r--maximilian.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/maximilian.cpp b/maximilian.cpp
index ac2ccba..b02b575 100644
--- a/maximilian.cpp
+++ b/maximilian.cpp
@@ -177,6 +177,8 @@ double maxiOsc::triangle(double frequency, double phase) {
//I like this.
double maxiEnvelope::line(int numberofsegments,double segments[1000]) {
+ if (isPlaying==1) {
+
period=2./(segments[valindex+1]*0.004);
nextval=segments[valindex+2];
currentval=segments[valindex];
@@ -191,11 +193,18 @@ double maxiEnvelope::line(int numberofsegments,double segments[1000]) {
startval=currentval;
}
output=amplitude;
- return(output);
+
+ }
+ else {
+ output=0;
+
+ }
+ return(output);
}
//and this
void maxiEnvelope::trigger(int index, double amp) {
+ isPlaying=1;
valindex=index;
amplitude=amp;