summaryrefslogtreecommitdiff
path: root/note_compiler/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'note_compiler/parser.cpp')
-rw-r--r--note_compiler/parser.cpp52
1 files changed, 50 insertions, 2 deletions
diff --git a/note_compiler/parser.cpp b/note_compiler/parser.cpp
index 7fb3fa0..e9af004 100644
--- a/note_compiler/parser.cpp
+++ b/note_compiler/parser.cpp
@@ -41,6 +41,20 @@ void init_oscs(int n_osc, oscillator_t *osc)
osc[i].sync_const=true;
osc[i].ksr_const=true;
osc[i].ksl_const=true;
+
+ osc[i].freq_env_amount=0;
+ osc[i].freq_env_amount_const=true;
+ osc[i].freq_env.attack=0;
+ osc[i].freq_env.attack_const=true;
+ osc[i].freq_env.decay=0;
+ osc[i].freq_env.decay_const=true;
+ osc[i].freq_env.sustain=ONE;
+ osc[i].freq_env.sustain_const=true;
+ osc[i].freq_env.release=-1;
+ osc[i].freq_env.release_const=true;
+ osc[i].freq_env.hold=true;
+ osc[i].freq_env.hold_const=true;
+
}
}
@@ -326,6 +340,26 @@ program_t parse(string fn)
case SYNC_FACTOR:
sync_factor=val*ONE;
break;
+
+ case FREQ_ATTACK:
+ osc[ind].freq_env.attack=val;
+ break;
+ case FREQ_DECAY:
+ osc[ind].freq_env.decay=val;
+ break;
+ case FREQ_SUSTAIN:
+ osc[ind].freq_env.sustain=val;
+ break;
+ case FREQ_RELEASE:
+ osc[ind].freq_env.release=val;
+ break;
+ case FREQ_HOLD:
+ osc[ind].freq_env.hold=(val!=0);
+ break;
+ case FREQ_ENV_AMOUNT:
+ osc[ind].freq_env_amount=val;
+ break;
+
default:
throw string("unknown variable ('"+array+"')");
}
@@ -350,6 +384,7 @@ program_t parse(string fn)
case FILTER_ENV_AMOUNT:
case FILTER_RESONANCE:
case FILTER_OFFSET:
+ case FREQ_ENV_AMOUNT:
// everything ok, do nothing
break;
@@ -424,6 +459,19 @@ program_t parse(string fn)
filter.trem_lfo_const=false; break;
case SYNC_FACTOR:
sync_factor_const=false; break;
+ case FREQ_ATTACK:
+ osc[ind].freq_env.attack_const=false; break;
+ case FREQ_DECAY:
+ osc[ind].freq_env.decay_const=false; break;
+ case FREQ_SUSTAIN:
+ osc[ind].freq_env.sustain_const=false; break;
+ case FREQ_RELEASE:
+ osc[ind].freq_env.release_const=false; break;
+ case FREQ_HOLD:
+ osc[ind].freq_env.hold_const=false; break;
+ case FREQ_ENV_AMOUNT:
+ osc[ind].freq_env_amount_const=false; break;
+
default:
throw string("unknown variable ('"+array+"')");
}
@@ -444,11 +492,11 @@ program_t parse(string fn)
for (int i=0;i<n_osc;i++)
if ((env[i].attack==0) && (env[i].sustain==1.0)
- && (env[i].release>100)) //TODO FINDMICH besseres kriterium?
+ && (env[i].release<0))
env[i].enabled=false;
if ( ((filter.env_settings.attack==0) && (filter.env_settings.sustain==1.0)
- && (filter.env_settings.release>100)) //TODO FINDMICH siehe oben
+ && (filter.env_settings.release<0))
|| ((filter.env_amount==0) && (filter.env_amount_const==true)) )
filter.env_settings.enabled=false;