[SCM] calf/master: + Organ: added detune and phase, added labels for drawbar parameters, reordered waveforms

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


The following commit has been merged in the master branch:
commit 67554d7f4aa6a027654a25b60cbba64593b2c891
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Sat Mar 29 18:38:18 2008 +0000

    + Organ: added detune and phase, added labels for drawbar parameters, reordered waveforms
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@139 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/fixed_point.h b/src/calf/fixed_point.h
index a9a1cf2..189756a 100644
--- a/src/calf/fixed_point.h
+++ b/src/calf/fixed_point.h
@@ -47,8 +47,8 @@ public:
     /// copy constructor from any other fixed_point value
     template<class U, int FracBits2> inline fixed_point(const fixed_point<U, FracBits2> &v) {
         if (FracBits == FracBits2) value = v.get();
-        else if (FracBits > FracBits2) value = v.get() << (FracBits - FracBits2);
-        else value = v.get() >> (FracBits - FracBits2);
+        else if (FracBits > FracBits2) value = v.get() << abs(FracBits - FracBits2);
+        else value = v.get() >> abs(FracBits - FracBits2);
     }
 
     /* this would be way too confusing, it wouldn't be obvious if it expects a whole fixed point or an integer part
@@ -57,7 +57,11 @@ public:
     }
     */
     explicit inline fixed_point(double v) {
-        value = (T)(v*(1<<FracBits));
+        value = (T)(v*one());
+    }
+    
+    inline T one() {
+        return (T)(1) << FracBits;
     }
 
     inline void set(T value) {
@@ -69,45 +73,43 @@ public:
     }
       
     inline operator double() const {
-        return value * (1.0/(1<<FracBits));
+        return value * (1.0/one());
     }
     
     inline fixed_point &operator=(double v) {
-        value = (int)(v*(1<<FracBits));
+        value = (T)(v*one());
         return *this;
     }
     
+    template<class U, int FracBits2> inline T rebase(const fixed_point<U, FracBits2> &v) {
+        if (FracBits == FracBits2) 
+            return v.get();
+        if (FracBits > FracBits2) 
+            return v.get() << abs(FracBits - FracBits2);
+        return v.get() >> abs(FracBits2 - FracBits);
+    }
+    
     template<class U, int FracBits2> inline fixed_point &operator=(const fixed_point<U, FracBits2> &v) {
-        if (FracBits == FracBits2) value = v.value;
-        else if (FracBits > FracBits2) value = v.value << (FracBits - FracBits2);
-        else value = v.value >> (FracBits - FracBits2);
+        value = rebase<U, FracBits2>(v);
         return *this;
     }
 
     template<class U, int FracBits2> inline fixed_point &operator+=(const fixed_point<U, FracBits2> &v) {
-        if (FracBits == FracBits2) value += v.value;
-        else if (FracBits > FracBits2) value += v.value << (FracBits - FracBits2);
-        else value += v.value >> (FracBits - FracBits2);
+        value += rebase<U, FracBits2>(v);
         return *this;
     }
 
     template<class U, int FracBits2> inline fixed_point &operator-=(const fixed_point<U, FracBits2> &v) {
-        if (FracBits == FracBits2) value -= v.value;
-        else if (FracBits > FracBits2) value -= v.value << (FracBits - FracBits2);
-        else value -= v.value >> (FracBits - FracBits2);
+        value -= rebase<U, FracBits2>(v);
         return *this;
     }
 
     template<class U, int FracBits2> inline fixed_point operator+(const fixed_point<U, FracBits2> &v) const {
-        if (FracBits == FracBits2) return value + v.value;
-        if (FracBits > FracBits2) return (value >> (FracBits - FracBits2)) + v.value;
-        return value + (v.value >> (FracBits2 - FracBits)) ;
+        return value + rebase<U, FracBits2>(v.get());
     }
 
     template<class U, int FracBits2> inline fixed_point operator-(const fixed_point<U, FracBits2> &v) const {
-        if (FracBits == FracBits2) return value - v.value;
-        if (FracBits > FracBits2) return (value >> (FracBits - FracBits2)) - v.value;
-        return value - (v.value >> (FracBits2 - FracBits)) ;
+        return value - rebase<U, FracBits2>(v.get());
     }
 
     /// multiply two fixed point values, using long long int to store the temporary multiplication result
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 4b4cf84..a26a96c 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -200,6 +200,8 @@ public:
         par_drawbar1, par_drawbar2, par_drawbar3, par_drawbar4, par_drawbar5, par_drawbar6, par_drawbar7, par_drawbar8, par_drawbar9, 
         par_frequency1, par_frequency2, par_frequency3, par_frequency4, par_frequency5, par_frequency6, par_frequency7, par_frequency8, par_frequency9, 
         par_waveform1, par_waveform2, par_waveform3, par_waveform4, par_waveform5, par_waveform6, par_waveform7, par_waveform8, par_waveform9, 
+        par_detune1, par_detune2, par_detune3, par_detune4, par_detune5, par_detune6, par_detune7, par_detune8, par_detune9, 
+        par_phase1, par_phase2, par_phase3, par_phase4, par_phase5, par_phase6, par_phase7, par_phase8, par_phase9, 
         par_foldover,
         par_percdecay, par_perclevel, par_percharm, par_master, param_count };
     enum { in_count = 0, out_count = 2, support_midi = true, rt_capable = true };
diff --git a/src/calf/organ.h b/src/calf/organ.h
index 5cc0296..5da6a62 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -31,16 +31,20 @@ struct organ_parameters {
     float drawbars[9];
     float harmonics[9];
     float waveforms[9];
+    float detune[9];
+    float phase[9];
     float foldover;
     float percussion_time;
     float percussion_level;
-    float harmonic;
+    float percussion_harmonic;
     float master;
     
     double perc_decay_const;
+    float multiplier[9];
+    int phaseshift[9];
 
     inline bool get_foldover() { return foldover >= 0.5f; }
-    inline int get_harmonic() { return dsp::fastf2i_drm(harmonic); }
+    inline int get_percussion_harmonic() { return dsp::fastf2i_drm(percussion_harmonic); }
 };
 
 #define ORGAN_WAVE_BITS 12
@@ -49,10 +53,10 @@ struct organ_parameters {
 class organ_voice_base
 {
 protected:
-    enum { wave_sine, wave_pulse, wave_sinepl1, wave_sinepl2, wave_sinepl3, wave_saw, wave_sqr, wave_ssaw, wave_ssqr, wave_count };
+    enum { wave_sine, wave_sinepl1, wave_sinepl2, wave_sinepl3, wave_ssaw, wave_ssqr, wave_spls, wave_saw, wave_sqr, wave_pulse, wave_count };
     static waveform_family<ORGAN_WAVE_BITS> waves[wave_count];
     // dsp::sine_table<float, ORGAN_WAVE_SIZE, 1> sine_wave;
-    dsp::fixed_point<int, 20> phase, dphase;
+    dsp::fixed_point<int64_t, 52> phase, dphase;
     int note;
     dsp::decay amp;
     organ_parameters *parameters;
@@ -130,7 +134,7 @@ public:
             for (int h = 0; h < 9; h++)
             {
                 float *data;
-                dsp::fixed_point<int, 24> hm = dsp::fixed_point<int, 24>(parameters->harmonics[h]);
+                dsp::fixed_point<int, 24> hm = dsp::fixed_point<int, 24>(parameters->multiplier[h]);
                 int waveid = (int)parameters->waveforms[h];
                 if (waveid < 0 || waveid >= wave_count)
                     waveid = 0;
@@ -140,8 +144,8 @@ public:
                         break;
                     hm.set(hm.get() >> 1);
                 } while(1);
-                tphase = phase * hm;
-                tdphase = dphase * hm;
+                tphase.set(((phase * hm).get() & 0xFFFFFFFF) + parameters->phaseshift[h]);
+                tdphase.set((dphase * hm).get() & 0xFFFFFFFF);
                 float amp = parameters->drawbars[h];
                 for (int i=0; i<nsamples; i++) {
     //                float osc = 0.2*sine(phase)+0.1*sine(4*phase)+0.08*sine(12*phase)+0.08*sine(16*phase);
@@ -197,13 +201,13 @@ public:
             return;
         if (parameters->percussion_level < small_value<float>())
             return;
-        int harmonic = 2 * parameters->get_harmonic();
+        int percussion_harmonic = 2 * parameters->get_percussion_harmonic();
         float level = parameters->percussion_level * (8 * 9);
         // XXXKF the decay needs work!
         double age_const = parameters->perc_decay_const;
         float *data = waves[wave_sine].begin()->second;
         for (int i = 0; i < nsamples; i++) {
-            float osc = level * wave(data, harmonic * phase);
+            float osc = level * wave(data, percussion_harmonic * phase);
             buf[i] += osc * amp.get();
             amp.age_exp(age_const, 1.0 / 32768.0);
             phase += dphase;
@@ -252,6 +256,11 @@ struct drawbar_organ: public synth::basic_synth {
     void update_params()
     {
         parameters->perc_decay_const = dsp::decay::calc_exp_constant(1.0 / 1024.0, 0.001 * parameters->percussion_time * sample_rate);
+        for (int i = 0; i < 9; i++)
+        {
+            parameters->multiplier[i] = parameters->harmonics[i] * pow(2.0, parameters->detune[i] * (1.0 / 1200.0));
+            parameters->phaseshift[i] = int(parameters->phase[i] * 65536 / 360) << 16;
+        }
     }
 };
 
diff --git a/src/gui.cpp b/src/gui.cpp
index a772c5b..cf9f780 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -200,9 +200,11 @@ void vscale_param_control::vscale_value_changed(GtkHScale *widget, gpointer valu
 GtkWidget *label_param_control::create(plugin_gui *_gui, int _param_no)
 {
     gui = _gui, param_no = _param_no;
-    string text = "<no name>";
+    string text;
     if (param_no != -1)
         text = get_props().name;
+    else
+        text = attribs["text"];
     widget = gtk_label_new(text.c_str());
     return widget;
 }
diff --git a/src/organ.cpp b/src/organ.cpp
index 5ff5685..950cc17 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -62,69 +62,111 @@ const char *organ_audio_module::get_gui_xml()
                 "<value param=\"master\"/>"
             "</vbox>"
         "</hbox>"
-        "<table rows=\"6\" cols=\"9\">"
-            "<label  attach-x=\"0\" attach-y=\"0\" param=\"h1\"/>"
-            "<vscale attach-x=\"0\" attach-y=\"1\" param=\"h1\"/>"
-            "<value  attach-x=\"0\" attach-y=\"2\" param=\"h1\"/>"
-            "<knob   attach-x=\"0\" attach-y=\"3\" param=\"f1\"/>"
-            "<value  attach-x=\"0\" attach-y=\"4\" param=\"f1\"/>"
-            "<combo  attach-x=\"0\" attach-y=\"5\" param=\"w1\"/>"
+        "<table rows=\"10\" cols=\"9\">"
+            "<label  attach-x=\"0\" attach-y=\"1\" text=\"Level\"/>"
+            "<label  attach-x=\"0\" attach-y=\"3\" text=\"Harmonic\"/>"
+            "<label  attach-x=\"0\" attach-y=\"5\" text=\"Wave\"/>"
+            "<label  attach-x=\"0\" attach-y=\"6\" text=\"Detune\"/>"
+            "<label  attach-x=\"0\" attach-y=\"8\" text=\"Phase\"/>"
+
+            "<label  attach-x=\"1\" attach-y=\"0\" param=\"l1\"/>"
+            "<vscale attach-x=\"1\" attach-y=\"1\" param=\"l1\"/>"
+            "<value  attach-x=\"1\" attach-y=\"2\" param=\"l1\"/>"
+            "<knob   attach-x=\"1\" attach-y=\"3\" param=\"f1\"/>"
+            "<value  attach-x=\"1\" attach-y=\"4\" param=\"f1\"/>"
+            "<combo  attach-x=\"1\" attach-y=\"5\" param=\"w1\"/>"
+            "<knob   attach-x=\"1\" attach-y=\"6\" param=\"detune1\"/>"
+            "<value  attach-x=\"1\" attach-y=\"7\" param=\"detune1\"/>"
+            "<knob   attach-x=\"1\" attach-y=\"8\" param=\"phase1\"/>"
+            "<value  attach-x=\"1\" attach-y=\"9\" param=\"phase1\"/>"
     
-            "<label  attach-x=\"1\" attach-y=\"0\" param=\"h3\"/>"
-            "<vscale attach-x=\"1\" attach-y=\"1\" param=\"h3\"/>"
-            "<value  attach-x=\"1\" attach-y=\"2\" param=\"h3\"/>"
-            "<knob   attach-x=\"1\" attach-y=\"3\" param=\"f2\"/>"
-            "<value  attach-x=\"1\" attach-y=\"4\" param=\"f2\"/>"
-            "<combo  attach-x=\"1\" attach-y=\"5\" param=\"w2\"/>"
+            "<label  attach-x=\"2\" attach-y=\"0\" param=\"l2\"/>"
+            "<vscale attach-x=\"2\" attach-y=\"1\" param=\"l2\"/>"
+            "<value  attach-x=\"2\" attach-y=\"2\" param=\"l2\"/>"
+            "<knob   attach-x=\"2\" attach-y=\"3\" param=\"f2\"/>"
+            "<value  attach-x=\"2\" attach-y=\"4\" param=\"f2\"/>"
+            "<combo  attach-x=\"2\" attach-y=\"5\" param=\"w2\"/>"
+            "<knob   attach-x=\"2\" attach-y=\"6\" param=\"detune2\"/>"
+            "<value  attach-x=\"2\" attach-y=\"7\" param=\"detune2\"/>"
+            "<knob   attach-x=\"2\" attach-y=\"8\" param=\"phase2\"/>"
+            "<value  attach-x=\"2\" attach-y=\"9\" param=\"phase2\"/>"
     
-            "<label  attach-x=\"2\" attach-y=\"0\" param=\"h2\"/>"
-            "<vscale attach-x=\"2\" attach-y=\"1\" param=\"h2\"/>"
-            "<value  attach-x=\"2\" attach-y=\"2\" param=\"h2\"/>"
-            "<knob   attach-x=\"2\" attach-y=\"3\" param=\"f3\"/>"
-            "<value  attach-x=\"2\" attach-y=\"4\" param=\"f3\"/>"
-            "<combo  attach-x=\"2\" attach-y=\"5\" param=\"w3\"/>"
+            "<label  attach-x=\"3\" attach-y=\"0\" param=\"l3\"/>"
+            "<vscale attach-x=\"3\" attach-y=\"1\" param=\"l3\"/>"
+            "<value  attach-x=\"3\" attach-y=\"2\" param=\"l3\"/>"
+            "<knob   attach-x=\"3\" attach-y=\"3\" param=\"f3\"/>"
+            "<value  attach-x=\"3\" attach-y=\"4\" param=\"f3\"/>"
+            "<combo  attach-x=\"3\" attach-y=\"5\" param=\"w3\"/>"
+            "<knob   attach-x=\"3\" attach-y=\"6\" param=\"detune3\"/>"
+            "<value  attach-x=\"3\" attach-y=\"7\" param=\"detune3\"/>"
+            "<knob   attach-x=\"3\" attach-y=\"8\" param=\"phase3\"/>"
+            "<value  attach-x=\"3\" attach-y=\"9\" param=\"phase3\"/>"
     
-            "<label  attach-x=\"3\" attach-y=\"0\" param=\"h4\"/>"
-            "<vscale attach-x=\"3\" attach-y=\"1\" param=\"h4\"/>"
-            "<value  attach-x=\"3\" attach-y=\"2\" param=\"h4\"/>"
-            "<knob   attach-x=\"3\" attach-y=\"3\" param=\"f4\"/>"
-            "<value  attach-x=\"3\" attach-y=\"4\" param=\"f4\"/>"
-            "<combo  attach-x=\"3\" attach-y=\"5\" param=\"w4\"/>"
-
-            "<label  attach-x=\"4\" attach-y=\"0\" param=\"h6\"/>"
-            "<vscale attach-x=\"4\" attach-y=\"1\" param=\"h6\"/>"
-            "<value  attach-x=\"4\" attach-y=\"2\" param=\"h6\"/>"
-            "<knob   attach-x=\"4\" attach-y=\"3\" param=\"f5\"/>"
-            "<value  attach-x=\"4\" attach-y=\"4\" param=\"f5\"/>"
-            "<combo  attach-x=\"4\" attach-y=\"5\" param=\"w5\"/>"
+            "<label  attach-x=\"4\" attach-y=\"0\" param=\"l4\"/>"
+            "<vscale attach-x=\"4\" attach-y=\"1\" param=\"l4\"/>"
+            "<value  attach-x=\"4\" attach-y=\"2\" param=\"l4\"/>"
+            "<knob   attach-x=\"4\" attach-y=\"3\" param=\"f4\"/>"
+            "<value  attach-x=\"4\" attach-y=\"4\" param=\"f4\"/>"
+            "<combo  attach-x=\"4\" attach-y=\"5\" param=\"w4\"/>"
+            "<knob   attach-x=\"4\" attach-y=\"6\" param=\"detune4\"/>"
+            "<value  attach-x=\"4\" attach-y=\"7\" param=\"detune4\"/>"
+            "<knob   attach-x=\"4\" attach-y=\"8\" param=\"phase4\"/>"
+            "<value  attach-x=\"4\" attach-y=\"9\" param=\"phase4\"/>"
+
+            "<label  attach-x=\"5\" attach-y=\"0\" param=\"l5\"/>"
+            "<vscale attach-x=\"5\" attach-y=\"1\" param=\"l5\"/>"
+            "<value  attach-x=\"5\" attach-y=\"2\" param=\"l5\"/>"
+            "<knob   attach-x=\"5\" attach-y=\"3\" param=\"f5\"/>"
+            "<value  attach-x=\"5\" attach-y=\"4\" param=\"f5\"/>"
+            "<combo  attach-x=\"5\" attach-y=\"5\" param=\"w5\"/>"
+            "<knob   attach-x=\"5\" attach-y=\"6\" param=\"detune5\"/>"
+            "<value  attach-x=\"5\" attach-y=\"7\" param=\"detune5\"/>"
+            "<knob   attach-x=\"5\" attach-y=\"8\" param=\"phase5\"/>"
+            "<value  attach-x=\"5\" attach-y=\"9\" param=\"phase5\"/>"
     
-            "<label  attach-x=\"5\" attach-y=\"0\" param=\"h8\"/>"
-            "<vscale attach-x=\"5\" attach-y=\"1\" param=\"h8\"/>"
-            "<value  attach-x=\"5\" attach-y=\"2\" param=\"h8\"/>"
-            "<knob   attach-x=\"5\" attach-y=\"3\" param=\"f6\"/>"
-            "<value  attach-x=\"5\" attach-y=\"4\" param=\"f6\"/>"
-            "<combo  attach-x=\"5\" attach-y=\"5\" param=\"w6\"/>"
-
-            "<label  attach-x=\"6\" attach-y=\"0\" param=\"h10\"/>"
-            "<vscale attach-x=\"6\" attach-y=\"1\" param=\"h10\"/>"
-            "<value  attach-x=\"6\" attach-y=\"2\" param=\"h10\"/>"
-            "<knob   attach-x=\"6\" attach-y=\"3\" param=\"f7\"/>"
-            "<value  attach-x=\"6\" attach-y=\"4\" param=\"f7\"/>"
-            "<combo  attach-x=\"6\" attach-y=\"5\" param=\"w7\"/>"
-
-            "<label  attach-x=\"7\" attach-y=\"0\" param=\"h12\"/>"
-            "<vscale attach-x=\"7\" attach-y=\"1\" param=\"h12\"/>"
-            "<value  attach-x=\"7\" attach-y=\"2\" param=\"h12\"/>"
-            "<knob   attach-x=\"7\" attach-y=\"3\" param=\"f8\"/>"
-            "<value  attach-x=\"7\" attach-y=\"4\" param=\"f8\"/>"
-            "<combo  attach-x=\"7\" attach-y=\"5\" param=\"w8\"/>"
-
-            "<label  attach-x=\"8\" attach-y=\"0\" param=\"h16\"/>"
-            "<vscale attach-x=\"8\" attach-y=\"1\" param=\"h16\"/>"
-            "<value  attach-x=\"8\" attach-y=\"2\" param=\"h16\"/>"
-            "<knob   attach-x=\"8\" attach-y=\"3\" param=\"f9\"/>"
-            "<value  attach-x=\"8\" attach-y=\"4\" param=\"f9\"/>"
-            "<combo  attach-x=\"8\" attach-y=\"5\" param=\"w9\"/>"
+            "<label  attach-x=\"6\" attach-y=\"0\" param=\"l6\"/>"
+            "<vscale attach-x=\"6\" attach-y=\"1\" param=\"l6\"/>"
+            "<value  attach-x=\"6\" attach-y=\"2\" param=\"l6\"/>"
+            "<knob   attach-x=\"6\" attach-y=\"3\" param=\"f6\"/>"
+            "<value  attach-x=\"6\" attach-y=\"4\" param=\"f6\"/>"
+            "<combo  attach-x=\"6\" attach-y=\"5\" param=\"w6\"/>"
+            "<knob   attach-x=\"6\" attach-y=\"6\" param=\"detune6\"/>"
+            "<value  attach-x=\"6\" attach-y=\"7\" param=\"detune6\"/>"
+            "<knob   attach-x=\"6\" attach-y=\"8\" param=\"phase6\"/>"
+            "<value  attach-x=\"6\" attach-y=\"9\" param=\"phase6\"/>"
+
+            "<label  attach-x=\"7\" attach-y=\"0\" param=\"l7\"/>"
+            "<vscale attach-x=\"7\" attach-y=\"1\" param=\"l7\"/>"
+            "<value  attach-x=\"7\" attach-y=\"2\" param=\"l7\"/>"
+            "<knob   attach-x=\"7\" attach-y=\"3\" param=\"f7\"/>"
+            "<value  attach-x=\"7\" attach-y=\"4\" param=\"f7\"/>"
+            "<combo  attach-x=\"7\" attach-y=\"5\" param=\"w7\"/>"
+            "<knob   attach-x=\"7\" attach-y=\"6\" param=\"detune7\"/>"
+            "<value  attach-x=\"7\" attach-y=\"7\" param=\"detune7\"/>"
+            "<knob   attach-x=\"7\" attach-y=\"8\" param=\"phase7\"/>"
+            "<value  attach-x=\"7\" attach-y=\"9\" param=\"phase7\"/>"
+
+            "<label  attach-x=\"8\" attach-y=\"0\" param=\"l8\"/>"
+            "<vscale attach-x=\"8\" attach-y=\"1\" param=\"l8\"/>"
+            "<value  attach-x=\"8\" attach-y=\"2\" param=\"l8\"/>"
+            "<knob   attach-x=\"8\" attach-y=\"3\" param=\"f8\"/>"
+            "<value  attach-x=\"8\" attach-y=\"4\" param=\"f8\"/>"
+            "<combo  attach-x=\"8\" attach-y=\"5\" param=\"w8\"/>"
+            "<knob   attach-x=\"8\" attach-y=\"6\" param=\"detune8\"/>"
+            "<value  attach-x=\"8\" attach-y=\"7\" param=\"detune8\"/>"
+            "<knob   attach-x=\"8\" attach-y=\"8\" param=\"phase8\"/>"
+            "<value  attach-x=\"8\" attach-y=\"9\" param=\"phase8\"/>"
+
+            "<label  attach-x=\"9\" attach-y=\"0\" param=\"l9\"/>"
+            "<vscale attach-x=\"9\" attach-y=\"1\" param=\"l9\"/>"
+            "<value  attach-x=\"9\" attach-y=\"2\" param=\"l9\"/>"
+            "<knob   attach-x=\"9\" attach-y=\"3\" param=\"f9\"/>"
+            "<value  attach-x=\"9\" attach-y=\"4\" param=\"f9\"/>"
+            "<combo  attach-x=\"9\" attach-y=\"5\" param=\"w9\"/>"
+            "<knob   attach-x=\"9\" attach-y=\"6\" param=\"detune9\"/>"
+            "<value  attach-x=\"9\" attach-y=\"7\" param=\"detune9\"/>"
+            "<knob   attach-x=\"9\" attach-y=\"8\" param=\"phase9\"/>"
+            "<value  attach-x=\"9\" attach-y=\"9\" param=\"phase9\"/>"
         "</table>"
     "</vbox>"
     ;
@@ -134,18 +176,18 @@ const char *organ_audio_module::port_names[] = {"Out L", "Out R"};
 
 const char *organ_percussion_harmonic_names[] = { "2nd", "3rd" };
 
-const char *organ_wave_names[] = { "Sin", "Pls", "S+1", "S+2", "S+3", "Saw", "Sqr", "SSaw", "SSqr" };
+const char *organ_wave_names[] = { "Sin", "S0", "S00", "S000", "SSaw", "SSqr", "SPls", "Saw", "Sqr", "Pls"  };
 
 parameter_properties organ_audio_module::param_props[] = {
-    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h1", "16'" },
-    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h3", "5 1/3'" },
-    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h2", "8'" },
-    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h4", "4'" },
-    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h6", "2 2/3'" },
-    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h8", "2'" },
-    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h10", "1 3/5'" },
-    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h12", "1 1/3'" },
-    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h16", "1'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l1", "16'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l2", "5 1/3'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l3", "8'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l4", "4'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l5", "2 2/3'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l6", "2'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l7", "1 3/5'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l8", "1 1/3'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "l9", "1'" },
 
     { 1,       1, 32, 32, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "f1", "Freq 1" },
     { 3,       1, 32, 32, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "f2", "Freq 2" },
@@ -157,15 +199,35 @@ parameter_properties organ_audio_module::param_props[] = {
     { 12,      1, 32, 32, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "f8", "Freq 8" },
     { 16,      1, 32, 32, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "f9", "Freq 9" },
 
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w1", "Wave 1" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w2", "Wave 2" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w3", "Wave 3" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w4", "Wave 4" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w5", "Wave 5" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w6", "Wave 6" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w7", "Wave 7" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w8", "Wave 8" },
-    { 0,       0,  8, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w9", "Wave 9" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w1", "Wave 1" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w2", "Wave 2" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w3", "Wave 3" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w4", "Wave 4" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w5", "Wave 5" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w6", "Wave 6" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w7", "Wave 7" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w8", "Wave 8" },
+    { 0,       0,  9, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_wave_names, "w9", "Wave 9" },
+
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune1", "Detune 1" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune2", "Detune 2" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune3", "Detune 3" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune4", "Detune 4" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune5", "Detune 5" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune6", "Detune 6" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune7", "Detune 7" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune8", "Detune 8" },
+    { 0,    -100,100, 401, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "detune9", "Detune 9" },
+
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase1", "Phase 1" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase2", "Phase 2" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase3", "Phase 3" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase4", "Phase 4" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase5", "Phase 5" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase6", "Phase 6" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase7", "Phase 7" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase8", "Phase 8" },
+    { 0,       0,360, 361, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "phase9", "Phase 9" },
 
     { 1,         0,  1, 2, PF_BOOL | PF_CTL_TOGGLE, NULL, "foldover", "Foldover" },
     { 200,         10,  3000, 100, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "perc_decay", "Perc. decay" },
@@ -187,6 +249,19 @@ parameter_properties rotary_speaker_audio_module::param_props[] = {
 
 waveform_family<ORGAN_WAVE_BITS> organ_voice_base::waves[organ_voice_base::wave_count];
 
+
+static void smoothen(bandlimiter<ORGAN_WAVE_BITS> &bl, float tmp[ORGAN_WAVE_SIZE])
+{
+    bl.compute_spectrum(tmp);
+    for (int i = 1; i <= ORGAN_WAVE_SIZE / 2; i++) {
+        bl.spectrum[i] *= 1.0 / sqrt(i);
+        bl.spectrum[ORGAN_WAVE_SIZE - i] *= 1.0 / sqrt(i);
+    }
+    bl.compute_waveform(tmp);
+    normalize_waveform(tmp, ORGAN_WAVE_SIZE);
+}
+
+
 organ_voice_base::organ_voice_base(organ_parameters *_parameters)
 : parameters(_parameters)
 {
@@ -224,24 +299,17 @@ organ_voice_base::organ_voice_base(organ_parameters *_parameters)
         
         for (int i = 0; i < ORGAN_WAVE_SIZE; i++)
             tmp[i] = (i < (ORGAN_WAVE_SIZE / 2)) ? 1 : -1;
-        bl.compute_spectrum(tmp);
-        for (int i = 1; i <= ORGAN_WAVE_SIZE / 2; i++) {
-            bl.spectrum[i] *= 1.0 / sqrt(i);
-            bl.spectrum[ORGAN_WAVE_SIZE - i] *= 1.0 / sqrt(i);
-        }
-        bl.compute_waveform(tmp);
-        normalize_waveform(tmp, ORGAN_WAVE_SIZE);
+        smoothen(bl, tmp);
         waves[wave_ssqr].make(bl, tmp);
         
         for (int i = 0; i < ORGAN_WAVE_SIZE; i++)
             tmp[i] = -1 + (i * 2.0 / ORGAN_WAVE_SIZE);
-        bl.compute_spectrum(tmp);
-        for (int i = 1; i <= ORGAN_WAVE_SIZE / 2; i++) {
-            bl.spectrum[i] *= 1.0 / sqrt(i);
-            bl.spectrum[ORGAN_WAVE_SIZE - i] *= 1.0 / sqrt(i);
-        }
-        bl.compute_waveform(tmp);
-        normalize_waveform(tmp, ORGAN_WAVE_SIZE);
+        smoothen(bl, tmp);
         waves[wave_ssaw].make(bl, tmp);
+
+        for (int i = 0; i < ORGAN_WAVE_SIZE; i++)
+            tmp[i] = (i < (ORGAN_WAVE_SIZE / 16)) ? 1 : 0;
+        smoothen(bl, tmp);
+        waves[wave_spls].make(bl, tmp);
     }
 }

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list