diff options
author | Florian Jung <flo@thinkpad.(none)> | 2011-01-15 15:27:38 +0100 |
---|---|---|
committer | Florian Jung <flo@thinkpad.(none)> | 2011-01-15 15:27:38 +0100 |
commit | 550497e9b09894a79c1c9888901bbbf4949a614b (patch) | |
tree | 22a1b1f5eac70051eb8336312569ad07c512cc82 /synth/parser.cpp | |
parent | 9e3998bbaddf4eb6df8544497e42231137824998 (diff) |
Added rudimentary support for freq-envelopes
todo: pfactor'ed amount
todo: support for compiled notes
plus some tiny bugfixes:
- in Envelope (get_sustain now returns orig_sustain)
- parser now uses isnum instead of isfloat where appropriate
Diffstat (limited to 'synth/parser.cpp')
-rw-r--r-- | synth/parser.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/synth/parser.cpp b/synth/parser.cpp index 10accac..a6f27cb 100644 --- a/synth/parser.cpp +++ b/synth/parser.cpp @@ -198,6 +198,13 @@ void init_oscs(int n_osc, oscillator_t *osc) osc[i].vibrato_depth=0; osc[i].vibrato_lfo=0; osc[i].custom_wave=NULL; + + osc[i].freq_env_amount=0; + osc[i].freq_env.attack=0; + osc[i].freq_env.decay=0; + osc[i].freq_env.sustain=ONE; + osc[i].freq_env.release=-1; + osc[i].freq_env.hold=true; } } @@ -380,7 +387,7 @@ program_t parse(string fn) osc[ind].output=val*ONE; break; case WAVEFORM: - if (isfloat(strval)) + if (isnum(strval)) { osc[ind].waveform=int(val); } @@ -497,6 +504,26 @@ program_t parse(string fn) case SYNC_FACTOR: sync_factor=val*ONE; break; + + case FREQ_ATTACK: + osc[ind].freq_env.attack=val*samp_rate; + break; + case FREQ_DECAY: + osc[ind].freq_env.decay=val*samp_rate; + break; + case FREQ_SUSTAIN: + osc[ind].freq_env.sustain=val*ONE; + break; + case FREQ_RELEASE: + osc[ind].freq_env.release=val*samp_rate; + 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+"')"); } |