From 65381f7f64aacad7023b74c3f20293e8eca5fa22 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sat, 15 Jan 2011 17:35:25 +0100 Subject: Added pfactor-influence for freq_env_amount --- synth/note.cpp | 6 +++++- synth/parser.cpp | 8 ++++++++ synth/programs.cpp | 10 ++++++++++ synth/programs.h | 2 ++ 4 files changed, 25 insertions(+), 1 deletion(-) (limited to 'synth') diff --git a/synth/note.cpp b/synth/note.cpp index 046642f..35a7115 100644 --- a/synth/note.cpp +++ b/synth/note.cpp @@ -23,6 +23,7 @@ Note::Note(int n, float v, program_t &prg, jack_nframes_t pf, fixed_t pb, int pr pfactor.out=new fixed_t [n_oscillators]; + pfactor.freq_env_amount=new fixed_t [n_oscillators]; pfactor.fm=new fixed_t* [n_oscillators]; for (int i=0;ipfactor.out[i], vel) * volume_factor; + pfactor.freq_env_amount[i]=calc_pfactor(curr_prg->pfactor.freq_env_amount[i], vel); for (int j=0;jpfactor.fm[i][j], vel); @@ -151,6 +154,7 @@ void Note::apply_pfactor() for (int i=0;i>SCALE; + oscillator[i].freq_env_amount=orig.oscillator[i].freq_env_amount*pfactor.freq_env_amount[i] /ONE; //because it's a float for (int j=0;j>SCALE; @@ -234,7 +238,7 @@ void Note::set_param(const parameter_t &p, fixed_t v) //ACHTUNG: case FREQ_SUSTAIN: factor_env[p.osc]->set_sustain(v); break; case FREQ_RELEASE: factor_env[p.osc]->set_release(v*samp_rate >>SCALE); break; case FREQ_HOLD: factor_env[p.osc]->set_hold((v!=0)); break; - case FREQ_ENV_AMOUNT: oscillator[p.osc].freq_env_amount=double(v)/ONE; break; + case FREQ_ENV_AMOUNT: orig.oscillator[p.osc].freq_env_amount=double(v)/ONE; apply_pfactor(); break; default: throw string("trying to set an unknown parameter"); diff --git a/synth/parser.cpp b/synth/parser.cpp index a6f27cb..cd4ed02 100644 --- a/synth/parser.cpp +++ b/synth/parser.cpp @@ -238,6 +238,7 @@ void init_filter(filter_params_t &filter) void init_pfactors(int n_osc, pfactor_formula_t &pfactor) { pfactor.out=new param_factor_t [n_osc]; + pfactor.freq_env_amount=new param_factor_t [n_osc]; pfactor.fm=new param_factor_t* [n_osc]; pfactor.filter_env.offset=ONE; @@ -254,6 +255,9 @@ void init_pfactors(int n_osc, pfactor_formula_t &pfactor) pfactor.out[i].offset=0; pfactor.out[i].vel_amount=ONE; + pfactor.freq_env_amount[i].offset=0; + pfactor.freq_env_amount[i].vel_amount=ONE; + pfactor.fm[i]=new param_factor_t [n_osc]; for (int j=0;jpfactor.out=new param_factor_t [n_osc]; memcpy(this->pfactor.out, that.pfactor.out, sizeof(param_factor_t)*n_osc); + this->pfactor.freq_env_amount=new param_factor_t [n_osc]; + memcpy(this->pfactor.freq_env_amount, that.pfactor.freq_env_amount, sizeof(param_factor_t)*n_osc); + this->pfactor.fm=new param_factor_t* [n_osc]; for (i=0;i