[SCM] calf/master: + Framework: simplify adding new modules by moving module list to separate file (modulelist.h) + Small plugins: add Robert Bristow-Johnson 2-pole 2-zero band reject (notch) filter

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


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

    + Framework: simplify adding new modules by moving module list to separate file (modulelist.h)
    + Small plugins: add Robert Bristow-Johnson 2-pole 2-zero band reject (notch) filter
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@286 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/Makefile.am b/src/calf/Makefile.am
index 100cc8a..a604aaa 100644
--- a/src/calf/Makefile.am
+++ b/src/calf/Makefile.am
@@ -4,6 +4,6 @@ calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h custom_ctl.h \
     ctl_curve.h ctl_keyboard.h \
     delay.h fft.h fixed_point.h giface.h gui.h inertia.h \
     jackhost.h lv2_event.h lv2_ui.h lv2_uri_map.h lv2-midiport.h lv2wrap.h \
-    main_win.h modules.h modules_dev.h modules_small.h modules_synths.h \
+    main_win.h modules.h modules_dev.h modules_small.h modules_synths.h modulelist.h \
     onepole.h organ.h osc.h osctl.h osctlnet.h preset.h preset_gui.h primitives.h \
     synth.h utils.h wave.h
diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
new file mode 100644
index 0000000..ec6da5b
--- /dev/null
+++ b/src/calf/modulelist.h
@@ -0,0 +1,14 @@
+    PER_MODULE_ITEM(filter, false, "filter")
+    PER_MODULE_ITEM(flanger, false, "flanger")
+    PER_MODULE_ITEM(reverb, false, "reverb")
+    PER_MODULE_ITEM(monosynth, true, "monosynth")
+    PER_MODULE_ITEM(vintage_delay, false, "vintagedelay")
+    PER_MODULE_ITEM(organ, true, "organ")
+    PER_MODULE_ITEM(rotary_speaker, false, "rotaryspeaker")
+    PER_MODULE_ITEM(phaser, false, "phaser")
+#ifdef ENABLE_EXPERIMENTAL
+    PER_MODULE_ITEM(small_lp_filter, false, "lowpass12")
+    PER_MODULE_ITEM(small_hp_filter, false, "highpass12")
+    PER_MODULE_ITEM(small_bp_filter, false, "bandpass6")
+    PER_MODULE_ITEM(small_br_filter, false, "notch6")
+#endif
diff --git a/src/calf/modules_small.h b/src/calf/modules_small.h
index 2ee2594..bc5aa1b 100644
--- a/src/calf/modules_small.h
+++ b/src/calf/modules_small.h
@@ -105,6 +105,21 @@ public:
     static const char *get_label() { return "6dB/oct RBJ Bandpass"; }
 };
 
+class small_br_filter_audio_module: public small_filter_audio_module
+{
+public:
+    uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
+        filter.set_br_rbj(*params[par_cutoff], *params[par_resonance], srate);
+        for (uint32_t i = offset; i < offset + numsamples; i++)
+            outs[0][i] = filter.process_d1(ins[0][i]);
+        filter.sanitize_d1();
+        return !filter.empty_d1();
+    }
+    static const char *get_id() { return "notch6"; }
+    static const char *get_name() { return "notch6"; }
+    static const char *get_label() { return "6dB/oct RBJ Notch Filter"; }
+};
+
 };
 
 #endif
diff --git a/src/modules.cpp b/src/modules.cpp
index 0889712..5a21da7 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -193,10 +193,12 @@ parameter_properties synth::small_filter_audio_module::param_props[] = {
 static synth::ladspa_info small_lp_filter_info = { 0x8490, "LP12", "12dB/oct LP Filter", "Krzysztof Foltman", copyright, "LowpassPlugin" };
 static synth::ladspa_info small_hp_filter_info = { 0x8491, "HP12", "12dB/oct HP Filter", "Krzysztof Foltman", copyright, "HighpassPlugin" };
 static synth::ladspa_info small_bp_filter_info = { 0x8492, "BP6", "6dB/oct BP Filter", "Krzysztof Foltman", copyright, "BandpassPlugin" };
+static synth::ladspa_info small_br_filter_info = { 0x8493, "Notch6", "6dB/oct Notch Filter", "Krzysztof Foltman", copyright, "FilterPlugin" };
 
 ALL_WRAPPERS(small_lp_filter)
 ALL_WRAPPERS(small_hp_filter)
 ALL_WRAPPERS(small_bp_filter)
+ALL_WRAPPERS(small_br_filter)
 
 #endif
 
@@ -205,22 +207,10 @@ extern "C" {
 
 const LV2_Descriptor *lv2_descriptor(uint32_t index)
 {
-    switch (index) {
-        case 0: return &::lv2_filter.descriptor;
-        case 1: return &::lv2_flanger.descriptor;
-        case 2: return &::lv2_reverb.descriptor;
-        case 3: return &::lv2_vintage_delay.descriptor;
-        case 4: return &::lv2_monosynth.descriptor;
-        case 5: return &::lv2_organ.descriptor;
-        case 6: return &::lv2_rotary_speaker.descriptor;
-        case 7: return &::lv2_phaser.descriptor;
-#ifdef ENABLE_EXPERIMENTAL
-        case 8: return &::lv2_small_lp_filter.descriptor;
-        case 9: return &::lv2_small_bp_filter.descriptor;
-        case 10: return &::lv2_small_hp_filter.descriptor;
-#endif
-        default: return NULL;
-    }
+    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!(index--)) return &::lv2_##name.descriptor;
+    #include <calf/modulelist.h>
+    #undef PER_MODULE_ITEM
+    return NULL;
 }
 
 };
@@ -231,20 +221,10 @@ extern "C" {
 
 const LADSPA_Descriptor *ladspa_descriptor(unsigned long Index)
 {
-    switch (Index) {
-        case 0: return &::ladspa_filter.descriptor;
-        case 1: return &::ladspa_flanger.descriptor;
-        case 2: return &::ladspa_reverb.descriptor;
-        case 3: return &::ladspa_vintage_delay.descriptor;
-        case 4: return &::ladspa_rotary_speaker.descriptor;
-        case 5: return &::ladspa_phaser.descriptor;
-#ifdef ENABLE_EXPERIMENTAL
-        case 6: return &::ladspa_small_lp_filter.descriptor;
-        case 7: return &::ladspa_small_hp_filter.descriptor;
-        case 8: return &::ladspa_small_bp_filter.descriptor;
-#endif
-        default: return NULL;
-    }
+    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!isSynth && !(Index--)) return &::ladspa_##name.descriptor;
+    #include <calf/modulelist.h>
+    #undef PER_MODULE_ITEM
+    return NULL;
 }
 
 };
@@ -254,22 +234,10 @@ extern "C" {
 
 const DSSI_Descriptor *dssi_descriptor(unsigned long Index)
 {
-    switch (Index) {
-        case 0: return &::ladspa_filter.dssi_descriptor;
-        case 1: return &::ladspa_flanger.dssi_descriptor;
-        case 2: return &::ladspa_reverb.dssi_descriptor;
-        case 3: return &::ladspa_monosynth.dssi_descriptor;
-        case 4: return &::ladspa_vintage_delay.dssi_descriptor;
-        case 5: return &::ladspa_organ.dssi_descriptor;
-        case 6: return &::ladspa_rotary_speaker.dssi_descriptor;
-        case 7: return &::ladspa_phaser.dssi_descriptor;
-#ifdef ENABLE_EXPERIMENTAL
-        case 8: return &::ladspa_small_lp_filter.dssi_descriptor;
-        case 9: return &::ladspa_small_hp_filter.dssi_descriptor;
-        case 10: return &::ladspa_small_bp_filter.dssi_descriptor;
-#endif
-        default: return NULL;
-    }
+    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!(Index--)) return &::ladspa_##name.dssi_descriptor;
+    #include <calf/modulelist.h>
+    #undef PER_MODULE_ITEM
+    return NULL;
 }
 
 };
@@ -279,19 +247,9 @@ std::string synth::get_builtin_modules_rdf()
 {
     std::string rdf;
     
-    rdf += ::ladspa_flanger.generate_rdf();
-    rdf += ::ladspa_reverb.generate_rdf();
-    rdf += ::ladspa_filter.generate_rdf();
-    rdf += ::ladspa_vintage_delay.generate_rdf();
-    rdf += ::ladspa_monosynth.generate_rdf();
-    rdf += ::ladspa_organ.generate_rdf();
-    rdf += ::ladspa_rotary_speaker.generate_rdf();
-    rdf += ::ladspa_phaser.generate_rdf();
-#ifdef ENABLE_EXPERIMENTAL
-    rdf += ::ladspa_small_lp_filter.generate_rdf();
-    rdf += ::ladspa_small_hp_filter.generate_rdf();
-    rdf += ::ladspa_small_bp_filter.generate_rdf();
-#endif
+    #define PER_MODULE_ITEM(name, isSynth, jackname) if (!isSynth) rdf += ::ladspa_##name.generate_rdf();
+    #include <calf/modulelist.h>
+    #undef PER_MODULE_ITEM
     
     return rdf;
 }
@@ -314,19 +272,10 @@ giface_plugin_info create_plugin_info(ladspa_info &info)
     return pi;
 }
 
+
 void synth::get_all_plugins(std::vector<giface_plugin_info> &plugins)
 {
-    plugins.push_back(create_plugin_info<filter_audio_module>(filter_info));
-    plugins.push_back(create_plugin_info<flanger_audio_module>(flanger_info));
-    plugins.push_back(create_plugin_info<reverb_audio_module>(reverb_info));
-    plugins.push_back(create_plugin_info<monosynth_audio_module>(monosynth_info));
-    plugins.push_back(create_plugin_info<vintage_delay_audio_module>(vintage_delay_info));
-    plugins.push_back(create_plugin_info<organ_audio_module>(organ_info));
-    plugins.push_back(create_plugin_info<rotary_speaker_audio_module>(rotary_speaker_info));
-    plugins.push_back(create_plugin_info<phaser_audio_module>(phaser_info));
-#ifdef ENABLE_EXPERIMENTAL
-    plugins.push_back(create_plugin_info<small_lp_filter_audio_module>(small_lp_filter_info));
-    plugins.push_back(create_plugin_info<small_hp_filter_audio_module>(small_hp_filter_info));
-    plugins.push_back(create_plugin_info<small_bp_filter_audio_module>(small_bp_filter_info));
-#endif
+    #define PER_MODULE_ITEM(name, isSynth, jackname) plugins.push_back(create_plugin_info<name##_audio_module>(name##_info));
+    #include <calf/modulelist.h>
+    #undef PER_MODULE_ITEM
 }

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list