From 80fdc1e39d864f05f271c8035715ab4c155a2002 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 9 Jan 2011 17:46:26 +0100 Subject: Improved note-compiler: optimizing output now works properly Previously, output was always considered as non-const, even if is was zero and without any controller-influence, because output had always pfactor-influence. Now, a pfactor-influenced output which is constant zero is considered as still constant, because pfactor*0 is always 0. --- TODO | 6 +++--- note_compiler/parser.cpp | 28 ++++++++++++++++++++++++---- note_compiler/programs.h | 1 + 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index fe39d96..e594eca 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,10 @@ TODO für den synth o .so unloaden! - o note-compiler: wenn vel_influence für foo, aber foo ist konstant + x note-compiler: wenn vel_influence für foo, aber foo ist konstant null, bleibt foo trotzdem konstant. - o note-compiler: vel_influence ist IMMER gegeben für output, außer + x note-compiler: vel_influence ist IMMER gegeben für output, außer wenn anders angegeben - o note-compiler: *1 bzw /2 optimierungen klappen nicht? + x note-compiler: *1 bzw /2 optimierungen klappen nicht? x note-compiler: pfactor nicht wegoptimieren, immer verwenden o beide parser: envelopes von oscs mit out=0 standardmäßig deaktivieren o envelope, filter, ggf. auch alles aus program.o im hauptprogramm diff --git a/note_compiler/parser.cpp b/note_compiler/parser.cpp index b15b981..c89ddd9 100644 --- a/note_compiler/parser.cpp +++ b/note_compiler/parser.cpp @@ -23,7 +23,8 @@ void init_oscs(int n_osc, oscillator_t *osc) } osc[i].output=0; - osc[i].output_const=false; //TODO FINDMICH war true + osc[i].output_const=true; + osc[i].output_no_pfactor=false; osc[i].waveform=0; osc[i].waveform_const=true; osc[i].factor=ONE; @@ -369,7 +370,13 @@ program_t parse(string fn) osc[ind].fm_strength_const[ind2]=false; break; case OUTPUT: - osc[ind].output_const=false; break; + if (state==4) // vel.-influence + { + if (isfloat(strval)) //is it a plain number, not a formula? + osc[ind].output_no_pfactor=true; + } + else + osc[ind].output_const=false; break; case WAVEFORM: osc[ind].waveform_const=false; break; case FACTOR: @@ -438,7 +445,7 @@ program_t parse(string fn) } - //some optimizations + //some optimizations and checks for (int i=0;i