[SCM] calf/master: + Monosynth: basic (inadequate) modwheel support

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:39:19 UTC 2013


The following commit has been merged in the master branch:
commit 8f000f38a69bc70f040fd3aa2ea65ed56a037287
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Fri Feb 6 23:29:45 2009 +0000

    + Monosynth: basic (inadequate) modwheel support

diff --git a/gui/gui-monosynth.xml b/gui/gui-monosynth.xml
index f8aada4..a6e978c 100644
--- a/gui/gui-monosynth.xml
+++ b/gui/gui-monosynth.xml
@@ -99,6 +99,11 @@
         <knob param="lfo2pw"/>
         <value param="lfo2pw"/>
       </vbox>
+      <vbox>
+        <label param="mwhl2lfo"/>
+        <knob param="mwhl2lfo"/>
+        <value param="mwhl2lfo"/>
+      </vbox>
     </hbox>
   </frame>
   <hbox spacing="10">
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 94c5919..611e0f4 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -99,7 +99,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
     enum { flt_lp12, flt_lp24, flt_2lp12, flt_hp12, flt_lpbr, flt_hpbr, flt_bp6, flt_2bp6 };
     enum { par_wave1, par_wave2, par_detune, par_osc2xpose, par_oscmode, par_oscmix, par_filtertype, par_cutoff, par_resonance, par_cutoffsep, par_envmod, par_envtores, par_envtoamp, par_attack, par_decay, par_sustain, par_release, 
         par_keyfollow, par_legato, par_portamento, par_vel2filter, par_vel2amp, par_master, 
-        par_lforate, par_lfodelay, par_lfofilter, par_lfopitch, par_lfopw,
+        par_lforate, par_lfodelay, par_lfofilter, par_lfopitch, par_lfopw, par_mwhl_lfo,
         param_count };
     enum { in_count = 0, out_count = 2, support_midi = true, require_midi = true, rt_capable = true };
     enum { step_size = 64 };
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 77fcb3c..376757c 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -58,8 +58,8 @@ public:
     int wave1, wave2, filter_type, last_filter_type;
     float freq, start_freq, target_freq, cutoff, decay_factor, fgain, fgain_delta, separation;
     float detune, xpose, xfade, pitchbend, ampctl, fltctl, queue_vel;
-    float odcr, porta_time, lfo_bend, lfo_clock, last_lfov;
-    int queue_note_on, stop_count;
+    float odcr, porta_time, lfo_bend, lfo_clock, last_lfov, modwheel_value;
+    int queue_note_on, stop_count, modwheel_value_int;
     int legato;
     dsp::adsr envelope;
     dsp::keystack stack;
diff --git a/src/modules.cpp b/src/modules.cpp
index 7f767ff..fa06387 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -288,8 +288,9 @@ CALF_PORT_PROPS(monosynth) = {
     { 5,       0.01, 20,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "lfo_rate", "LFO Rate" },
     { 0.5,      0.1,  5,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_SEC, NULL, "lfo_delay", "LFO Delay" },
     { 0,      -4800, 4800,  0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "lfo2filter", "LFO->Filter" },
-    { 0,          0, 1200,  0, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "lfo2pitch", "LFO->Pitch" },
+    { 100,        0, 1200,  0, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "lfo2pitch", "LFO->Pitch" },
     { 0,          0,    1,  0.1, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "lfo2pw", "LFO->PW" },
+    { 1,          0,    1,  0.1, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "mwhl2lfo", "ModWheel->LFO" },
 };
 
 ////////////////////////////////////////////////////////////////////////////
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index d835d9a..5243e34 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -46,6 +46,8 @@ void monosynth_audio_module::activate() {
     stop_count = 0;
     pitchbend = 1.f;
     lfo_bend = 1.0;
+    modwheel_value = 0.f;
+    modwheel_value_int = 0;
     filter.reset();
     filter2.reset();
     stack.clear();
@@ -378,6 +380,7 @@ void monosynth_audio_module::calculate_step()
         }
     }
     float lfov = lfo.get() * std::min(1.0f, lfo_clock / *params[par_lfodelay]);
+    lfov = lfov * dsp::lerp(1.f, modwheel_value, *params[par_mwhl_lfo]);
     lfo_clock += odcr;
     if (fabs(*params[par_lfopitch]) > small_value<float>())
         lfo_bend = pow(2.0f, *params[par_lfopitch] * lfov * (1.f / 1200.0f));
@@ -517,6 +520,14 @@ void monosynth_audio_module::control_change(int controller, int value)
 {
     switch(controller)
     {
+        case 1:
+            modwheel_value_int = (modwheel_value_int & 127) | (value << 7);
+            modwheel_value = modwheel_value_int / 16383.0;
+            break;
+        case 33:
+            modwheel_value_int = (modwheel_value_int & (127 << 7)) | value;
+            modwheel_value = modwheel_value_int / 16383.0;
+            break;
         case 120: // all sounds off
             force_fadeout = true;
             // fall through

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list