summaryrefslogtreecommitdiff
path: root/synth
diff options
context:
space:
mode:
Diffstat (limited to 'synth')
-rw-r--r--synth/envelope.cpp5
-rw-r--r--synth/parser.cpp19
-rw-r--r--synth/programs.h2
3 files changed, 22 insertions, 4 deletions
diff --git a/synth/envelope.cpp b/synth/envelope.cpp
index 5678fd3..2f06a4e 100644
--- a/synth/envelope.cpp
+++ b/synth/envelope.cpp
@@ -1,7 +1,5 @@
#include "envelope.h"
-#include <iostream>
-
Envelope::Envelope(env_settings_t s, int frames)
{
level=0;
@@ -14,6 +12,9 @@ Envelope::Envelope(env_settings_t s, int frames)
set_ratefactor(1.0);
has_release_phase=(s.release>=0);
+
+ if (has_release_phase)
+ s.hold=false;
set_attack(s.attack);
set_decay(s.decay);
diff --git a/synth/parser.cpp b/synth/parser.cpp
index 5da2175..10accac 100644
--- a/synth/parser.cpp
+++ b/synth/parser.cpp
@@ -594,7 +594,24 @@ program_t parse(string fn)
}
}
-
+
+ bool neverending_tone=false;
+
+ for (map< parameter_t, list<term_t> >::iterator it=formula.begin(); it!=formula.end(); it++)
+ if ((it->first.par==OUTPUT) && (env[it->first.osc].release<0))
+ neverending_tone=true;
+
+ for (int i=0;i<n_osc;i++)
+ if ((osc[i].output!=0) && (env[i].release<0))
+ neverending_tone=true;
+
+ if (neverending_tone)
+ throw string("you have an oscillator which\n"
+ " may output something but has a never-ending envelope.\n"
+ " this would result in a tone that will never end.");
+
+
+
program_t result;
diff --git a/synth/programs.h b/synth/programs.h
index 9d8d8cc..1ed9d6f 100644
--- a/synth/programs.h
+++ b/synth/programs.h
@@ -144,7 +144,7 @@ struct env_settings_t
jack_nframes_t attack;
jack_nframes_t decay;
fixed_t sustain;
- jack_nframes_t release;
+ signed int release;
bool hold;
};