[SCM] calf/master: + Organ: fix percussion decay bug (the one that caused percussion envelope value to jump up after long decay has finished)

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:37:29 UTC 2013


The following commit has been merged in the master branch:
commit 617784b11518f752934e1891d78065e80d06e018
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Wed Aug 6 21:43:13 2008 +0000

    + Organ: fix percussion decay bug (the one that caused percussion envelope value to jump up after long decay has finished)
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@257 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/organ.h b/src/calf/organ.h
index c76ffdb..60b6d29 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -236,10 +236,11 @@ protected:
     inertia<linear_ramp> expression;
     organ_vibrato vibrato;
     float velocity;
+    bool perc_released;
 
 public:
     organ_voice()
-    : organ_voice_base(NULL, sample_rate, released),
+    : organ_voice_base(NULL, sample_rate, perc_released),
     expression(linear_ramp(16)) {
     }
 
@@ -254,6 +255,7 @@ public:
     }
 
     void note_on(int note, int vel) {
+        perc_released = false;
         reset();
         this->note = note;
         const float sf = 0.001f;
@@ -273,7 +275,11 @@ public:
     void note_off(int /* vel */) {
         // reset age to 0 (because decay will turn from exponential to linear, necessary because of error cumulation prevention)
         released = true;
-        pamp.reinit();
+        perc_released = true;
+        if (pamp.get_active())
+        {
+            pamp.reinit();
+        }
         rel_age_const = pamp.get() * ((1.0/44100.0)/0.03);
         for (int i = 0; i < EnvCount; i++)
             envs[i].note_off();
diff --git a/src/calf/primitives.h b/src/calf/primitives.h
index 4085778..b0ab66c 100644
--- a/src/calf/primitives.h
+++ b/src/calf/primitives.h
@@ -327,6 +327,10 @@ public:
             age++;
         }
     }
+    inline void deactivate() {
+        active = false;
+        value = 0;
+    }
 };
 
 class scheduler;
diff --git a/src/organ.cpp b/src/organ.cpp
index c6d52e5..1e55faf 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -960,7 +960,7 @@ void organ_voice_base::render_percussion_to(float (*buf)[2], int nsamples)
         fmdata = zeros;
     float *data = (*waves)[timbre].get_level(dpphase.get());
     if (!data) {
-        pamp.set(0.0);
+        pamp.deactivate();
         return;
     }
     float s = parameters->percussion_stereo * ORGAN_WAVE_SIZE * (0.5 / 360.0);

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list