summaryrefslogtreecommitdiff
path: root/note_compiler/templates/set_param.1
diff options
context:
space:
mode:
authorFlorian Jung <flo@thinkpad.(none)>2011-01-05 18:25:04 +0100
committerFlorian Jung <flo@thinkpad.(none)>2011-01-05 18:40:20 +0100
commite8382521c1a35ad59efea5e8cebb915a67c0008e (patch)
tree62ec5889e76461080c5569bbe811d3102dd5f42a /note_compiler/templates/set_param.1
parent3d95a25600b5cab8a7e5245b7a581bd8c8939276 (diff)
Finished note-compiler, seems to work. TODO: CLI
The note-compiler now also generates code for set_param, and a function has been added which returns a pointer to a newly created object (important for loading from a shared object). There's also a destroyer function. TODO: - write a CLI for the note-compiler - let the note-compiler issue the build-commands on his own - make the synth load instruments from shared objects
Diffstat (limited to 'note_compiler/templates/set_param.1')
-rw-r--r--note_compiler/templates/set_param.125
1 files changed, 25 insertions, 0 deletions
diff --git a/note_compiler/templates/set_param.1 b/note_compiler/templates/set_param.1
new file mode 100644
index 0000000..3d20dfe
--- /dev/null
+++ b/note_compiler/templates/set_param.1
@@ -0,0 +1,25 @@
+ if ( ((p.par==ATTACK) || (p.par==DECAY) || (p.par==SUSTAIN) ||
+ (p.par==RELEASE) || (p.par==HOLD)) && sel_env==NULL )
+ {
+ output_note("NOTE: cannot change parameter for envelope"+IntToStr(p.osc)+" because it's disabled");
+ return;
+ }
+
+ switch(p.par)
+ {
+ case ATTACK: sel_env->set_attack(v*samp_rate >>SCALE); break;
+ case DECAY: sel_env->set_decay(v*samp_rate >>SCALE); break;
+ case SUSTAIN: sel_env->set_sustain(v); break;
+ case RELEASE: sel_env->set_release(v*samp_rate >>SCALE); break;
+ case HOLD: sel_env->set_hold(v!=0); break;
+
+ case KSR: sel_osc->ksr=float(v)/ONE; break;
+ case KSL: sel_osc->ksl=float(v)/ONE; break;
+
+ case FACTOR: sel_osc->factor=v; break;
+ case TREMOLO: sel_osc->tremolo_depth=v; break;
+ case TREM_LFO: sel_osc->tremolo_lfo=v; break;
+ case VIBRATO: sel_osc->vibrato_depth=v; break;
+ case VIB_LFO: sel_osc->vibrato_lfo=v; break;
+ case WAVEFORM: sel_osc->waveform=v; break;
+ case SYNC: sel_osc->sync=(v!=0); break;