From 9e6e8e3814403eb05b941c40a283c797ae5b3f4a Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Sun, 8 Feb 2009 20:20:01 +0000 Subject: [PATCH] + Organ: add pitch bend inertia --- src/calf/organ.h | 9 +++++++-- src/organ.cpp | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/calf/organ.h b/src/calf/organ.h index 441a6c4..5c71c16 100644 --- a/src/calf/organ.h +++ b/src/calf/organ.h @@ -207,14 +207,19 @@ protected: bool perc_released; /// The envelopes have ended and the voice is in final fadeout stage bool finishing; + dsp::inertia inertia_pitchbend; public: organ_voice() - : organ_voice_base(NULL, sample_rate, perc_released), - expression(dsp::linear_ramp(16)) { + : organ_voice_base(NULL, sample_rate, perc_released) + , expression(dsp::linear_ramp(16)) + , inertia_pitchbend(dsp::exponential_ramp(1)) + { + inertia_pitchbend.set_now(1); } void reset() { + inertia_pitchbend.ramp.set_length(sample_rate / (BlockSize * 30)); // 1/30s vibrato.reset(); phase = 0; for (int i = 0; i < FilterCount; i++) diff --git a/src/organ.cpp b/src/organ.cpp index 7c384a6..28fe4d1 100644 --- a/src/organ.cpp +++ b/src/organ.cpp @@ -551,7 +551,7 @@ void organ_vibrato::process(organ_parameters *parameters, float (*data)[2], unsi void organ_voice::update_pitch() { organ_voice_base::update_pitch(); - dphase.set(dsp::midi_note_to_phase(note, 100 * parameters->global_transpose + parameters->global_detune, sample_rate) * parameters->pitch_bend); + dphase.set(dsp::midi_note_to_phase(note, 100 * parameters->global_transpose + parameters->global_detune, sample_rate) * inertia_pitchbend.get_last()); } void organ_voice::render_block() { @@ -567,6 +567,8 @@ void organ_voice::render_block() { return; } + inertia_pitchbend.set_inertia(parameters->pitch_bend); + inertia_pitchbend.step(); update_pitch(); dsp::fixed_point tphase, tdphase; unsigned int foldvalue = parameters->foldvalue; -- 2.11.4.GIT