[SCM] calf/master: + Small plugins: add 6dB lowpass, 6dB highpass and 1p1z allpass

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


The following commit has been merged in the master branch:
commit adf349d8265f761472cf689214396112873b499c
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Tue Sep 16 23:03:39 2008 +0000

    + Small plugins: add 6dB lowpass, 6dB highpass and 1p1z allpass
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@287 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index ec6da5b..152c16b 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -11,4 +11,7 @@
     PER_MODULE_ITEM(small_hp_filter, false, "highpass12")
     PER_MODULE_ITEM(small_bp_filter, false, "bandpass6")
     PER_MODULE_ITEM(small_br_filter, false, "notch6")
+    PER_MODULE_ITEM(small_onepole_lp_filter, false, "lowpass12")
+    PER_MODULE_ITEM(small_onepole_hp_filter, false, "highpass12")
+    PER_MODULE_ITEM(small_onepole_ap_filter, false, "allpass")
 #endif
diff --git a/src/calf/modules_small.h b/src/calf/modules_small.h
index bc5aa1b..ed024e0 100644
--- a/src/calf/modules_small.h
+++ b/src/calf/modules_small.h
@@ -120,6 +120,79 @@ public:
     static const char *get_label() { return "6dB/oct RBJ Notch Filter"; }
 };
 
+class small_onepole_filter_audio_module: public null_audio_module
+{
+public:    
+    enum { par_cutoff, param_count };
+    enum { in_count = 1, out_count = 1, rt_capable = true, support_midi = false };
+    float *ins[in_count]; 
+    float *outs[out_count];
+    float *params[param_count];
+    static const char *port_names[];
+    dsp::onepole<float> filter;
+    uint32_t srate;
+    static parameter_properties param_props[];
+    
+    /// do not export mode and inertia as CVs, as those are settings and not parameters
+    void params_changed()
+    {
+    }
+    void activate() {
+        params_changed();
+        filter.reset();
+    }
+    void deactivate() {
+    }
+    void set_sample_rate(uint32_t sr) {
+        srate = sr;
+    }
+};
+
+class small_onepole_lp_filter_audio_module: public small_onepole_filter_audio_module
+{
+public:
+    uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
+        filter.set_lp(*params[par_cutoff], srate);
+        for (uint32_t i = offset; i < offset + numsamples; i++)
+            outs[0][i] = filter.process_lp(ins[0][i]);
+        filter.sanitize();
+        return !filter.empty();
+    }
+    static const char *get_id() { return "lowpass6"; }
+    static const char *get_name() { return "lowpass6"; }
+    static const char *get_label() { return "6dB/oct Lowpass"; }
+};
+
+class small_onepole_hp_filter_audio_module: public small_onepole_filter_audio_module
+{
+public:
+    uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
+        filter.set_hp(*params[par_cutoff], srate);
+        for (uint32_t i = offset; i < offset + numsamples; i++)
+            outs[0][i] = filter.process_hp(ins[0][i]);
+        filter.sanitize();
+        return !filter.empty();
+    }
+    static const char *get_id() { return "highpass6"; }
+    static const char *get_name() { return "highpass6"; }
+    static const char *get_label() { return "6dB/oct Lowpass"; }
+};
+
+class small_onepole_ap_filter_audio_module: public small_onepole_filter_audio_module
+{
+public:
+    uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
+        filter.set_ap(*params[par_cutoff], srate);
+        for (uint32_t i = offset; i < offset + numsamples; i++)
+            outs[0][i] = filter.process_ap(ins[0][i]);
+        filter.sanitize();
+        return !filter.empty();
+    }
+    static const char *get_id() { return "allpass6"; }
+    static const char *get_name() { return "allpass6"; }
+    static const char *get_label() { return "6dB/oct Lowpass"; }
+};
+
 };
 
 #endif
diff --git a/src/calf/onepole.h b/src/calf/onepole.h
index bb1c196..bb866bd 100644
--- a/src/calf/onepole.h
+++ b/src/calf/onepole.h
@@ -128,6 +128,10 @@ public:
         return out;
     }
     
+    inline bool empty() {
+        return y1 == 0;
+    }
+    
     inline void sanitize() 
     {
         dsp::sanitize(x1);
diff --git a/src/modules.cpp b/src/modules.cpp
index 5a21da7..780334d 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -200,6 +200,22 @@ ALL_WRAPPERS(small_hp_filter)
 ALL_WRAPPERS(small_bp_filter)
 ALL_WRAPPERS(small_br_filter)
 
+////////////////////////////////////////////////////////////////////////////
+
+const char *synth::small_onepole_filter_audio_module::port_names[] = {"In", "Out"};
+
+parameter_properties synth::small_onepole_filter_audio_module::param_props[] = {
+    { 2000,      10,20000,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "freq", "Frequency" },
+};
+
+static synth::ladspa_info small_onepole_lp_filter_info = { 0x8490, "LP6", "6dB/oct LP Filter", "Krzysztof Foltman", copyright, "LowpassPlugin" };
+static synth::ladspa_info small_onepole_hp_filter_info = { 0x8491, "HP6", "6dB/oct HP Filter", "Krzysztof Foltman", copyright, "HighpassPlugin" };
+static synth::ladspa_info small_onepole_ap_filter_info = { 0x8492, "AP", "1-pole 1-zero Allpass Filter", "Krzysztof Foltman", copyright, "AllpassPlugin" };
+
+ALL_WRAPPERS(small_onepole_lp_filter)
+ALL_WRAPPERS(small_onepole_hp_filter)
+ALL_WRAPPERS(small_onepole_ap_filter)
+
 #endif
 
 #if USE_LV2

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list