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. --- note_compiler/parser.cpp | 28 ++++++++++++++++++++++++---- note_compiler/programs.h | 1 + 2 files changed, 25 insertions(+), 4 deletions(-) (limited to 'note_compiler') 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