[SCM] calf/master: + Filterclavier: - added Max. Resonance parameter - made sure all parameters are updated immediately - fixed bug: gain wrong when switching to/from bandpass types

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


The following commit has been merged in the master branch:
commit 1612f7142f3b369853f23696b800282c9a7eab92
Author: Hans Baier <hansfbaier at googlemail.com>
Date:   Sat Jan 24 15:06:33 2009 +0700

    + Filterclavier: - added Max. Resonance parameter
                     - made sure all parameters are updated immediately
                     - fixed bug: gain wrong when switching to/from bandpass types

diff --git a/gui/gui-filterclavier.xml b/gui/gui-filterclavier.xml
index 230d846..0dfe2af 100644
--- a/gui/gui-filterclavier.xml
+++ b/gui/gui-filterclavier.xml
@@ -16,6 +16,11 @@
             <value param="detune" />
         </vbox>
         <vbox border="10">
+            <label param="maxres" />
+            <knob param="maxres" />
+            <value param="maxres" />
+        </vbox>
+        <vbox border="10">
             <label param="inertia" />
             <knob param="inertia"/>
             <value param="inertia" />
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index bfc95bc..2769a30 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -54,7 +54,7 @@ struct filter_metadata: public plugin_metadata<filter_metadata>
 /// Filterclavier - metadata
 struct filterclavier_metadata: public plugin_metadata<filterclavier_metadata>
 {
-    enum { par_transpose, par_detune, par_mode, par_inertia,  param_count };
+    enum { par_transpose, par_detune, par_max_resonance, par_mode, par_inertia,  param_count };
     enum { in_count = 2, out_count = 2, rt_capable = true, require_midi = true, support_midi = true };
     PLUGIN_NAME_ID_LABEL("filterclavier", "filterclavier", "Filterclavier")
     /// do not export mode and inertia as CVs, as those are settings and not parameters
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 2753881..d093b77 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -657,7 +657,7 @@ public:
         while(offset < numsamples) {
             uint32_t numnow = numsamples - offset;
             // if inertia's inactive, we can calculate the whole buffer at once
-            if (inertia_cutoff.active() || inertia_resonance.active())
+            if (inertia_cutoff.active() || inertia_resonance.active() || inertia_gain.active())
                 numnow = timer.get(numnow);
             
             if (outputs_mask & 1) {
diff --git a/src/calf/modules_dev.h b/src/calf/modules_dev.h
index 5d595f8..1df2dcd 100644
--- a/src/calf/modules_dev.h
+++ b/src/calf/modules_dev.h
@@ -29,30 +29,39 @@ namespace calf_plugins {
 #if ENABLE_EXPERIMENTAL
 
 /// Filterclavier --- MIDI controlled filter
-// TODO: add bandpass (set_bp_rbj)
 class filterclavier_audio_module: 
         public audio_module<filterclavier_metadata>, 
         public filter_module_with_inertia<biquad_filter_module, filterclavier_metadata>, 
         public line_graph_iface
     {        
-        const float min_resonance;
-        const float max_resonance;
         const float min_gain;
         const float max_gain;
         
         int last_note;
+        int last_velocity;
             
     public:    
         filterclavier_audio_module() 
             : 
-                min_resonance(0.707), 
-                max_resonance(20.0),
                 min_gain(1.0),
                 max_gain(32.0),
-                last_note(-1) {}
+                last_note(-1),
+                last_velocity(-1) {}
         
         void params_changed()
         { 
+            inertia_filter_module::inertia_cutoff.set_inertia(
+                note_to_hz(last_note + *params[par_transpose], *params[par_detune]));
+            
+            float min_resonance = param_props[par_max_resonance].min;
+             inertia_filter_module::inertia_resonance.set_inertia( 
+                     (float(last_velocity) / 127.0)
+                     // 0.001: see below
+                     * (*params[par_max_resonance] - min_resonance + 0.001)
+                     + min_resonance);
+                 
+            adjust_gain_according_to_filter_mode(last_velocity);
+            
             inertia_filter_module::calculate_filter(); 
         }
             
@@ -75,15 +84,42 @@ class filterclavier_audio_module:
         /// MIDI control
         virtual void note_on(int note, int vel)
         {
-            last_note = note;
+            last_note     = note;
+            last_velocity = vel;
             inertia_filter_module::inertia_cutoff.set_inertia(
                     note_to_hz(note + *params[par_transpose], *params[par_detune]));
 
+            float min_resonance = param_props[par_max_resonance].min;
             inertia_filter_module::inertia_resonance.set_inertia( 
-                    (float(vel) / 127.0) * (max_resonance - min_resonance)
+                    (float(vel) / 127.0) 
+                    // 0.001: if the difference is equal to zero (which happens
+                    // when the max_resonance knom is at minimum position
+                    // then the filter gain doesnt seem to snap to zero on most note offs
+                    * (*params[par_max_resonance] - min_resonance + 0.001) 
                     + min_resonance);
             
+            adjust_gain_according_to_filter_mode(vel);
+            
+            inertia_filter_module::calculate_filter();
+        }
+        
+        virtual void note_off(int note, int vel)
+        {
+            if (note == last_note) {
+                inertia_filter_module::inertia_resonance.set_inertia(param_props[par_max_resonance].min);
+                inertia_filter_module::inertia_gain.set_inertia(min_gain);
+                inertia_filter_module::calculate_filter();
+                last_velocity = 0;
+            }
+        }
+
+        bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context);
+        bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context);
+        
+    private:
+        void adjust_gain_according_to_filter_mode(int velocity) {
             int   mode = dsp::fastf2i_drm(*params[par_mode]);
+            
             // for bandpasses: boost gain for velocities > 0
             if ( (mode_6db_bp <= mode) && (mode <= mode_18db_bp) ) {
                 // gain for velocity 0:   1.0
@@ -95,26 +131,12 @@ class filterclavier_audio_module:
                 if (mode == mode_18db_bp)
                     mode_max_gain /= 10.5;
                 
-                inertia_filter_module::inertia_gain.set_inertia(
-                        (float(vel) / 127.0) * (mode_max_gain - min_gain) + min_gain);
+                inertia_filter_module::inertia_gain.set_now(
+                        (float(velocity) / 127.0) * (mode_max_gain - min_gain) + min_gain);
             } else {
-                inertia_filter_module::inertia_gain.set_inertia(min_gain);
-            }
-
-            inertia_filter_module::calculate_filter();
-        }
-        
-        virtual void note_off(int note, int vel)
-        {
-            if (note == last_note) {
-                inertia_filter_module::inertia_resonance.set_inertia(min_resonance);
-                inertia_filter_module::inertia_gain.set_inertia(min_gain);
-                inertia_filter_module::calculate_filter();
+                inertia_filter_module::inertia_gain.set_now(min_gain);
             }
         }
-
-        bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context);
-        bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context);
     };
 
 #endif
diff --git a/src/modules.cpp b/src/modules.cpp
index 8485a30..6000a57 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -127,6 +127,7 @@ CALF_PORT_NAMES(filterclavier) = {"In L", "In R", "Out L", "Out R"};
 CALF_PORT_PROPS(filterclavier) = {
     { 0,        -48,   48, 48*2+1, PF_INT   | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_SEMITONES, NULL, "transpose", "Transpose" },
     { 0,       -100,  100,      0, PF_INT   | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "detune", "Detune" },
+    { 32,     0.707,   32,      0, PF_FLOAT | PF_SCALE_GAIN   | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "maxres", "Max. Resonance" },    
     { biquad_filter_module::mode_6db_bp, 
       biquad_filter_module::mode_12db_lp,
       biquad_filter_module::mode_count - 1,

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list