[SCM] calf/master: * Filterclavier: first version (monophonic)

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:38:56 UTC 2013


The following commit has been merged in the master branch:
commit fe22d921c9f1ab8ce3976210a3c6f449763f3f82
Author: Hans Baier <hansfbaier at googlemail.com>
Date:   Thu Jan 22 01:15:28 2009 +0700

    * Filterclavier: first version (monophonic)

diff --git a/gui/gui-filter.xml b/gui/gui-filterclavier.xml
similarity index 87%
copy from gui/gui-filter.xml
copy to gui/gui-filterclavier.xml
index 77989d7..a5f137f 100644
--- a/gui/gui-filter.xml
+++ b/gui/gui-filterclavier.xml
@@ -11,6 +11,11 @@
             <value param="freq" />
         </vbox>
         <vbox border="10">
+            <label param="detune" />
+            <knob param="detune" type="1"/>
+            <value param="detune" />
+        </vbox>
+        <vbox border="10">
             <label param="res" />
             <knob param="res" />
             <value param="res" />
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 63b24db..a92aa4c 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -93,13 +93,15 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
     PLUGIN_NAME_ID_LABEL("monosynth", "monosynth", "Monosynth")
 };
 
-/*
 /// Filterclavier - metadata
 struct filterclavier_metadata: public plugin_metadata<filterclavier_metadata>
 {
-	
+    enum { par_cutoff, par_detune, par_resonance, par_mode, par_inertia,  param_count };
+    enum { in_count = 2, out_count = 2, rt_capable = true, require_midi = false, 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
+    bool is_cv(int param_no) { return param_no != par_mode && param_no != par_inertia; }
 };
-*/
     
 /// Thor's compressor - metadata
 struct compressor_metadata: public plugin_metadata<compressor_metadata>
diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index e454699..d3f83be 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -1,5 +1,6 @@
 #ifdef PER_MODULE_ITEM
     PER_MODULE_ITEM(filter, false, "filter")
+    PER_MODULE_ITEM(filterclavier, false, "filterclavier")
     PER_MODULE_ITEM(flanger, false, "flanger")
     PER_MODULE_ITEM(reverb, false, "reverb")
     PER_MODULE_ITEM(monosynth, true, "monosynth")
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 7a2edbc..bd22b37 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -675,6 +675,7 @@ public:
     }
 };
 
+/// biquad filter module
 class filter_audio_module: 
     public audio_module<filter_metadata>, 
     public filter_module_with_inertia<biquad_filter_module, filter_metadata>, 
diff --git a/src/calf/modules_dev.h b/src/calf/modules_dev.h
index f7496f9..35a3f34 100644
--- a/src/calf/modules_dev.h
+++ b/src/calf/modules_dev.h
@@ -21,10 +21,62 @@
 #ifndef __CALF_MODULES_DEV_H
 #define __CALF_MODULES_DEV_H
 
+#include <calf/metadata.h>
+#include <calf/modules.h>
+
 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
+    {
+    public:    
+        
+        void params_changed()
+        { 
+            inertia_filter_module::params_changed(); 
+        }
+            
+        void activate()
+        {
+            inertia_filter_module::activate();
+        }
+        
+        void set_sample_rate(uint32_t sr)
+        {
+            inertia_filter_module::set_sample_rate(sr);
+        }
+
+        
+        void deactivate()
+        {
+            inertia_filter_module::deactivate();
+        }
+      
+        /// MIDI control
+        virtual void note_on(int note, int vel)
+        {
+            inertia_filter_module::inertia_cutoff.set_inertia(note_to_hz(note, *params[par_detune]));
+            inertia_filter_module::inertia_resonance.set_inertia( 
+                    (float(vel) / 127.0) * (param_props[par_resonance].max - param_props[par_resonance].min)
+                    + param_props[par_resonance].min);
+            inertia_filter_module::calculate_filter();
+        }
+        
+        virtual void note_off(int note, int vel)
+        {
+            inertia_filter_module::inertia_resonance.set_inertia(param_props[par_resonance].min);
+            inertia_filter_module::calculate_filter();
+        }        
+        
+        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/calf/primitives.h b/src/calf/primitives.h
index ee23a09..0102b3f 100644
--- a/src/calf/primitives.h
+++ b/src/calf/primitives.h
@@ -463,9 +463,9 @@ inline int fastf2i_drm(float f)
 }
 
 /// Convert MIDI note to frequency in Hz.
-inline float note_to_hz(double note)
+inline float note_to_hz(double note, double detune_cents = 0.0)
 {
-    return 440 * pow(2.0, (note - 69) / 12.0);
+    return 440 * pow(2.0, (note - 69 + detune_cents/100.0) / 12.0);
 }
 
 /// Hermite interpolation between two points and slopes in normalized range (written after Wikipedia article)
diff --git a/src/modules.cpp b/src/modules.cpp
index 2fae273..9934c6d 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -111,6 +111,29 @@ CALF_PLUGIN_INFO(filter) = { 0x847f, "Filter", "Calf Filter", "Krzysztof Foltman
 
 ////////////////////////////////////////////////////////////////////////////
 
+CALF_PORT_NAMES(filterclavier) = {"In L", "In R", "Out L", "Out R"};
+
+const char *filterclavier_choices[] = {
+    "12dB/oct Lowpass",
+    "24dB/oct Lowpass",
+    "36dB/oct Lowpass",
+    "12dB/oct Highpass",
+    "24dB/oct Highpass",
+    "36dB/oct Highpass",
+};
+
+CALF_PORT_PROPS(filterclavier) = {
+    { 2000,      10,20000,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq", "Frequency" },
+    { 0,       -100,  100,    0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "detune", "Detune" },
+    { 0.707,  0.707,   32,    0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "res", "Resonance" },
+    { 0,          0,    5,    1, PF_ENUM | PF_CTL_COMBO, filterclavier_choices, "mode", "Mode" },
+    { 20,         5,  100,    20, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "inertia", "Inertia"},
+};
+
+CALF_PLUGIN_INFO(filterclavier) = { 0x849f, "Filterclavier", "Calf Filterclavier", "Krzysztof Foltman / Hans Baier", calf_plugins::calf_copyright_info, "FilterclavierPlugin" };
+
+////////////////////////////////////////////////////////////////////////////
+
 CALF_PORT_NAMES(vintage_delay) = {"In L", "In R", "Out L", "Out R"};
 
 const char *vintage_delay_mixmodes[] = {
diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp
index eec0056..b175be4 100644
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@ -228,8 +228,30 @@ bool filter_audio_module::get_graph(int index, int subindex, float *data, int po
 
 bool filter_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context)
 {
-    if (index == par_cutoff)
+    if (index == par_cutoff) {
         return get_freq_gridline(subindex, pos, vertical, legend, context);
+    }
+    return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+bool filterclavier_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context)
+{
+    if (!is_active)
+        return false;
+    if (index == par_cutoff && !subindex) {
+        context->set_line_width(1.5);
+        return ::get_graph(*this, subindex, data, points);
+    }
+    return false;
+}
+
+bool filterclavier_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context)
+{
+    if (index == par_cutoff) {
+        return get_freq_gridline(subindex, pos, vertical, legend, context);
+    }
     return false;
 }
 

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list