[SCM] calf/master: Implement switchable vibrato type.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:40:35 UTC 2013


The following commit has been merged in the master branch:
commit 0375143944db60f370ab9a3ddeead02ffe71d14a
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sun Jan 16 16:20:28 2011 +0000

    Implement switchable vibrato type.

diff --git a/gui/gui-organ.xml b/gui/gui-organ.xml
index 31d7328..96afe88 100644
--- a/gui/gui-organ.xml
+++ b/gui/gui-organ.xml
@@ -548,6 +548,11 @@
             <value param="vib_phase"/>
           </vbox>
           <vbox >
+            <label param="vib_type"/>
+            <combo param="vib_type" />
+            <label />
+          </vbox>
+          <vbox >
             <label param="vib_mode"/>
             <combo param="vib_mode" />
             <label />
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 1606c9f..d49594e 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -347,7 +347,7 @@ struct organ_enums
         par_eg1attack, par_eg1decay, par_eg1sustain, par_eg1release, par_eg1velscl, par_eg1ampctl, 
         par_eg2attack, par_eg2decay, par_eg2sustain, par_eg2release, par_eg2velscl, par_eg2ampctl, 
         par_eg3attack, par_eg3decay, par_eg3sustain, par_eg3release, par_eg3velscl, par_eg3ampctl, 
-        par_lforate, par_lfoamt, par_lfowet, par_lfophase, par_lfomode,
+        par_lforate, par_lfoamt, par_lfowet, par_lfophase, par_lfomode, par_lfotype,
         par_transpose, par_detune,
         par_polyphony,
         par_quadenv,
@@ -385,6 +385,14 @@ struct organ_enums
         ampctl_count
     };
     enum { 
+        lfotype_allpass = 0,
+        lfotype_cv1,
+        lfotype_cv2,
+        lfotype_cv3,
+        lfotype_cvfull,
+        lfotype_count
+    };
+    enum { 
         lfomode_off = 0,
         lfomode_direct,
         lfomode_filter1,
diff --git a/src/calf/organ.h b/src/calf/organ.h
index 969bd6d..fe830b1 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -82,6 +82,7 @@ struct organ_parameters {
     float lfo_wet;
     float lfo_phase;
     float lfo_mode;
+    float lfo_type;
     
     float global_transpose;
     float global_detune;
@@ -206,6 +207,7 @@ protected:
     enum { ScannerSize = 18 };
     float lfo_phase;
     dsp::biquad_d2<float> scanner[ScannerSize];
+    organ_vibrato legacy;
 public:
     void reset();
     void process(organ_parameters *parameters, float (*data)[2], unsigned int len, float sample_rate);
diff --git a/src/metadata.cpp b/src/metadata.cpp
index b83e43c..f376d77 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -851,6 +851,8 @@ const char *organ_ampctl_names[] = { "None", "Direct", "Flt 1", "Flt 2", "All"
 
 const char *organ_vibrato_mode_names[] = { "None", "Direct", "Flt 1", "Flt 2", "Voice", "Global"  };
 
+const char *organ_vibrato_type_names[] = { "Allpass", "Scanner (V1/C1)", "Scanner (V2/C2)", "Scanner (V3/C3)", "Scanner (Full)"  };
+
 const char *organ_filter_type_names[] = { "12dB/oct LP", "12dB/oct HP" };
 
 const char *organ_filter_send_names[] = { "Output", "Filter 2" };
@@ -991,7 +993,8 @@ CALF_PORT_PROPS(organ) = {
     { 1.0,        0,    1,    0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB , NULL, "vib_amt", "Vib Mod Amt" },
     { 0.5,        0,    1,    0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB , NULL, "vib_wet", "Vib Wet" },
     { 180,        0,  360,    0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_DEG, NULL, "vib_phase", "Vib Stereo" },
-    { organ_enums::lfomode_global,        0,  organ_enums::lfomode_count - 1,    0, PF_ENUM | PF_CTL_COMBO, organ_vibrato_mode_names, "vib_mode", "Vib Mode" },
+    { organ_enums::lfomode_global,    0,  organ_enums::lfomode_count - 1,    0, PF_ENUM | PF_CTL_COMBO, organ_vibrato_mode_names, "vib_mode", "Vib Mode" },
+    { organ_enums::lfotype_cv3,       0,   organ_enums::lfotype_count - 1,    0, PF_ENUM | PF_CTL_COMBO, organ_vibrato_type_names, "vib_type", "Vib Type" },
 //    { 0,  0, organ_enums::ampctl_count - 1,
 //                              0, PF_INT | PF_CTL_COMBO, organ_ampctl_names, "vel_amp_ctl", "Vel To Amp"},
 
diff --git a/src/organ.cpp b/src/organ.cpp
index e592e4f..fad15ed 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -613,6 +613,7 @@ void organ_vibrato::process(organ_parameters *parameters, float (*data)[2], unsi
 
 void scanner_vibrato::reset()
 {
+    legacy.reset();
     for (int i = 0; i < ScannerSize; i++)
         scanner[i].reset();
     lfo_phase = 0.f;
@@ -623,6 +624,13 @@ void scanner_vibrato::process(organ_parameters *parameters, float (*data)[2], un
     if (!len)
         return;
     
+    int vtype = (int)parameters->lfo_type;
+    if (!vtype || vtype > organ_enums::lfotype_cvfull)
+    {
+        legacy.process(parameters, data, len, sample_rate);
+        return;
+    }
+    
     // I bet the original components of the line box had some tolerance,
     // hence two different values of cutoff frequency
     scanner[0].set_lp_rbj(4000, 0.707, sample_rate);
@@ -640,9 +648,13 @@ void scanner_vibrato::process(organ_parameters *parameters, float (*data)[2], un
     static const int v1[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8 };
     static const int v2[] = { 0, 1, 2, 4, 6, 8, 9, 10, 12 };
     static const int v3[] = { 0, 1, 3, 6, 11, 12, 15, 17, 18, 18, 18 };
-    const int *vib = v1;
-    static int sums[9];
+    static const int vfull[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18 };
+    static const int *vtypes[] = { NULL, v1, v2, v3, vfull };
+    const int *vib = vtypes[vtype];
+    
     float vibamt = 8 * parameters->lfo_amt;
+    if (vtype == organ_enums::lfotype_cvfull)
+        vibamt = 17 * parameters->lfo_amt;
     for (unsigned int i = 0; i < len; i++)
     {
         float line[ScannerSize + 1];
@@ -650,7 +662,7 @@ void scanner_vibrato::process(organ_parameters *parameters, float (*data)[2], un
         
         line[0] = v0;
         for (int t = 0; t < ScannerSize; t++)
-            line[t + 1] = scanner[t].process(line[t]) * 1.06;
+            line[t + 1] = scanner[t].process(line[t]) * 1.03;
         
         float lfo1 = lfo_phase < 0.5 ? 2 * lfo_phase : 2 - 2 * lfo_phase;
         float lfo2 = lfo_phase2 < 0.5 ? 2 * lfo_phase2 : 2 - 2 * lfo_phase2;
@@ -663,9 +675,6 @@ void scanner_vibrato::process(organ_parameters *parameters, float (*data)[2], un
         ipos = (int)pos;
         float vr = lerp(line[vib[ipos]], line[vib[ipos + 1]], pos - ipos);
         
-        for (int t = 0; t < 9; t++)
-            sums[t] += fabs(line[vib[t]]);
-
         lfo_phase += dphase;
         if (lfo_phase >= 1.0)
             lfo_phase -= 1.0;

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list