[SCM] calf/master: + LV2: first attempt at implementation, seems to break using the current version of SLV2 (because of duplicate parameter symbols); highly incomplete (doesn't support MIDI yet - no way to test synths!)

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


The following commit has been merged in the master branch:
commit 5577858333e04debb9fd0dea4c015165c7d04909
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Fri Jan 11 22:18:59 2008 +0000

    + LV2: first attempt at implementation, seems to break using the current version of SLV2 (because of duplicate parameter symbols); highly incomplete (doesn't support MIDI yet - no way to test synths!)
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@87 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/configure.in b/configure.in
index d7f0e91..4f86d34 100644
--- a/configure.in
+++ b/configure.in
@@ -148,6 +148,16 @@ AC_ARG_WITH(dssi_dir,
 AC_MSG_RESULT($with_dssi_dir)
 AC_SUBST(with_dssi_dir)
 
+if test "$LV2_ENABLED" == "yes"; then
+  AC_MSG_CHECKING(where to install LV2 plugins)
+  AC_ARG_WITH(lv2_dir,
+    AC_HELP_STRING([--with-lv2-dir],[install LV2 calf.lv2 bundle to DIR (default=$prefix/lib/lv2/)]),
+    ,
+    [with_lv2_dir="$prefix/lib/lv2/"])
+  AC_MSG_RESULT($with_lv2_dir)
+  AC_SUBST(with_lv2_dir)
+fi
+
 # Checks for library functions.
 AC_CHECK_FUNCS([floor memset pow])
 
@@ -161,7 +171,7 @@ AC_MSG_RESULT([
     DSSI enabled:           $DSSI_FOUND
     DSSI GUI enabled:       $DSSI_GUI_ENABLED
     JACK host enabled:      $JACK_ENABLED
-    LV2 enabled:            $LV2_ENABLED (unused for now)
+    LV2 enabled:            $LV2_ENABLED
     LASH enabled:           $LASH_ENABLED
     Old-style JACK MIDI:    $OLD_JACK
     PHAT GUI enabled:       $PHAT_ENABLED
diff --git a/src/Makefile.am b/src/Makefile.am
index 9009efe..beb7956 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,10 +40,10 @@ endif
 
 if USE_LADSPA
 AM_CXXFLAGS += -DUSE_LADSPA=1
+endif
 noinst_PROGRAMS += calfmakerdf
 calfmakerdf_SOURCES = makerdf.cpp
 calfmakerdf_LDADD = libcalfstatic.la
-endif
 if USE_DSSI
 AM_CXXFLAGS += -DUSE_DSSI=1
 endif
@@ -100,6 +100,12 @@ if USE_DSSI_GUI
 	install -c -m 755 $(top_builddir)/src/calfdssigui $(DESTDIR)$(with_dssi_dir)/calf/calf_gtk
 endif
 endif
+if USE_LV2
+	install -d -m 755 $(DESTDIR)$(with_lv2_dir)/calf.lv2
+	install -c -m 755 $(top_builddir)/src/.libs/calf.so $(DESTDIR)$(with_lv2_dir)/calf.lv2/calf.so
+	$(top_builddir)/src/calfmakerdf -m ttl >$(DESTDIR)$(with_lv2_dir)/calf.lv2/calf.ttl
+	$(top_builddir)/src/calfmakerdf -m manifest >$(DESTDIR)$(with_lv2_dir)/calf.lv2/manifest.ttl
+endif
 
 #remove calf.so, calf.rdf and - if empty - ladspa dir in usr/share
 uninstall-hook:
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 228fcce..0c6c1e8 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -157,6 +157,16 @@ struct ladspa_info
     const char *plugin_type;
 };
 
+struct giface_plugin_info
+{
+    ladspa_info *info;
+    int inputs, outputs, params;
+    bool rt_capable, midi_capable;
+    parameter_properties *param_props;
+};
+
+extern void get_all_plugins(std::vector<giface_plugin_info> &plugins);
+
 #if USE_LADSPA
 
 extern std::string generate_ladspa_rdf(const ladspa_info &info, parameter_properties *params, const char *param_names[], unsigned int count, unsigned int ctl_ofs);
diff --git a/src/calf/lv2wrap.h b/src/calf/lv2wrap.h
new file mode 100644
index 0000000..b4ce3c6
--- /dev/null
+++ b/src/calf/lv2wrap.h
@@ -0,0 +1,144 @@
+#if USE_LV2
+
+#include <string>
+#include <lv2.h>
+#include <calf/giface.h>
+
+namespace synth {
+
+template<class Module>
+struct lv2_instance: public Module, public plugin_ctl_iface
+{
+    lv2_instance()
+    {
+        for (int i=0; i < Module::in_count; i++)
+            Module::ins[i] = NULL;
+        for (int i=0; i < Module::out_count; i++)
+            Module::outs[i] = NULL;
+        for (int i=0; i < Module::param_count; i++)
+            Module::params[i] = NULL;
+    }
+    virtual parameter_properties *get_param_props(int param_no)
+    {
+        return &Module::param_props[param_no];
+    }
+    virtual float get_param_value(int param_no)
+    {
+        return *Module::params[param_no];
+    }
+    virtual void set_param_value(int param_no, float value)
+    {
+        *Module::params[param_no] = value;
+    }
+    virtual int get_param_count()
+    {
+        return Module::param_count;
+    }
+    virtual int get_param_port_offset() 
+    {
+        return Module::in_count + Module::out_count;
+    }
+    virtual const char *get_gui_xml() {
+        return Module::get_gui_xml();
+    }
+    virtual line_graph_iface *get_line_graph_iface()
+    {
+        return this;
+    }
+    virtual bool activate_preset(int bank, int program) { 
+        return false;
+    }
+};
+
+template<class Module>
+struct lv2_wrapper
+{
+    typedef lv2_instance<Module> instance;
+    static LV2_Descriptor descriptor;
+    std::string uri;
+    
+    lv2_wrapper(ladspa_info &info)
+    {
+        uri = "http://calf.sourceforge.net/plugins/" + std::string(info.label);
+        descriptor.URI = uri.c_str();
+        descriptor.instantiate = cb_instantiate;
+        descriptor.connect_port = cb_connect;
+        descriptor.activate = cb_activate;
+        descriptor.run = cb_run;
+        descriptor.deactivate = cb_deactivate;
+        descriptor.cleanup = cb_cleanup;
+        descriptor.extension_data = cb_ext_data;
+    }
+
+    static void cb_connect(LV2_Handle Instance, uint32_t port, void *DataLocation) {
+        unsigned long ins = Module::in_count;
+        unsigned long outs = Module::out_count;
+        unsigned long params = Module::param_count;
+        instance *const mod = (instance *)Instance;
+        if (port < ins)
+            mod->ins[port] = (float *)DataLocation;
+        else if (port < ins + outs)
+            mod->outs[port - ins] = (float *)DataLocation;
+        else if (port < ins + outs + params) {
+            int i = port - ins - outs;
+            mod->params[i] = (float *)DataLocation;
+        }
+    }
+
+    static void cb_activate(LV2_Handle Instance) {
+        instance *const mod = (instance *)Instance;
+        mod->set_sample_rate(mod->srate);
+        mod->activate();
+    }
+    
+    static void cb_deactivate(LADSPA_Handle Instance) {
+        instance *const mod = (instance *)Instance;
+        mod->deactivate();
+    }
+
+    static LV2_Handle cb_instantiate(const LV2_Descriptor * Descriptor, double sample_rate, const char *bundle_path, const LV2_Feature *const *features)
+    {
+        instance *mod = new instance();
+        // XXXKF some people use fractional sample rates; we respect them ;-)
+        mod->srate = (uint32_t)sample_rate;
+        return mod;
+    }
+    static inline void zero_by_mask(Module *module, uint32_t mask, uint32_t offset, uint32_t nsamples)
+    {
+        for (int i=0; i<Module::out_count; i++) {
+            if ((mask & (1 << i)) == 0) {
+                dsp::zero(module->outs[i] + offset, nsamples);
+            }
+        }
+    }
+    static inline void process_slice(Module *mod, uint32_t offset, uint32_t end)
+    {
+        while(offset < end)
+        {
+            uint32_t newend = std::min(offset + MAX_SAMPLE_RUN, end);
+            uint32_t out_mask = mod->process(offset, newend - offset, -1, -1);
+            zero_by_mask(mod, out_mask, offset, newend - offset);
+            offset = newend;
+        }
+    }
+
+    static void cb_run(LV2_Handle Instance, uint32_t SampleCount) {
+        instance *const mod = (instance *)Instance;
+        mod->params_changed();
+        process_slice(mod, 0, SampleCount);
+    }
+    static void cb_cleanup(LV2_Handle Instance) {
+        instance *const mod = (instance *)Instance;
+        delete mod;
+    }
+    static const void *cb_ext_data(const char *URI) {
+        return NULL;
+    }
+};
+
+template<class Module>
+LV2_Descriptor lv2_wrapper<Module>::descriptor;
+
+};
+
+#endif
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 17e17c9..29b529b 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -1,3 +1,22 @@
+/* Calf DSP Library
+ * Custom controls (line graph, knob).
+ * Copyright (C) 2007 Krzysztof Foltman
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
 #include <calf/custom_ctl.h>
 #include <cairo/cairo.h>
 #include <math.h>
diff --git a/src/dssigui.cpp b/src/dssigui.cpp
index ff9864b..70f2113 100644
--- a/src/dssigui.cpp
+++ b/src/dssigui.cpp
@@ -1,5 +1,5 @@
-/* Calf DSP Library
- * Benchmark for selected parts of the library.
+/* Calf DSP Library utility application.
+ * DSSI GUI application.
  * Copyright (C) 2007 Krzysztof Foltman
  *
  * This program is free software; you can redistribute it and/or
diff --git a/src/giface.cpp b/src/giface.cpp
index 53a5ef2..2360a05 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -23,6 +23,7 @@
 #include <memory.h>
 #include <calf/giface.h>
 #include <calf/modules.h>
+#include <calf/lv2wrap.h>
 
 using namespace synth;
 using namespace std;
@@ -262,3 +263,4 @@ std::string synth::generate_ladspa_rdf(const ladspa_info &info, parameter_proper
 }
 
 #endif
+
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index c9be32f..c3a30e9 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -25,30 +25,17 @@
 #include <calf/modules.h>
 
 using namespace std;
+using namespace synth;
 
 static struct option long_options[] = {
     {"help", 0, 0, 'h'},
     {"version", 0, 0, 'v'},
+    {"mode", 0, 0, 'm'},
     {0,0,0,0},
 };
 
-int main(int argc, char *argv[])
+void make_rdf()
 {
-    while(1) {
-        int option_index;
-        int c = getopt_long(argc, argv, "hv", long_options, &option_index);
-        if (c == -1)
-            break;
-        switch(c) {
-            case 'h':
-            case '?':
-                printf("LADSPA RDF generator for Calf plugin pack\nSyntax: %s [--help] [--version]\n", argv[0]);
-                return 0;
-            case 'v':
-                printf("%s\n", PACKAGE_STRING);
-                return 0;
-        }
-    }
     string rdf;
     rdf = 
         "<?xml version='1.0' encoding='ISO-8859-1'?>\n"
@@ -66,5 +53,138 @@ int main(int argc, char *argv[])
     rdf += "</rdf:RDF>\n";
     
     printf("%s\n", rdf.c_str());
+}
+
+static void add_port(string &ports, const char *symbol, const char *name, const char *direction, int pidx)
+{
+    stringstream ss;
+    const char *ind = "        ";
+
+    
+    if (ports != "") ports += " , ";
+    ss << "[\n";
+    if (direction) ss << ind << "a lv2:" << direction << "Port ;\n";
+    ss << ind << "a lv2:AudioPort ;\n";
+    ss << ind << "lv2:index " << pidx << " ;\n";
+    ss << ind << "lv2:symbol \"" << symbol << "\" ;\n";
+    ss << ind << "lv2:name \"" << name << "\" ;\n";
+    ss << "    ]";
+    ports += ss.str();
+}
+
+static void add_ctl_port(string &ports, parameter_properties &pp, int pidx)
+{
+    stringstream ss;
+    const char *ind = "        ";
+
+    
+    if (ports != "") ports += " , ";
+    ss << "[\n";
+    ss << ind << "a lv2:InputPort ;\n";
+    ss << ind << "a lv2:ControlPort ;\n";
+    ss << ind << "lv2:index " << pidx << " ;\n";
+    ss << ind << "lv2:symbol \"" << pp.short_name << "\" ;\n";
+    ss << ind << "lv2:name \"" << pp.name << "\" ;\n";
+    if ((pp.flags & PF_TYPEMASK) > 0)
+        ss << ind << "lv2:portProperty lv2:integer ;\n";
+    ss << showpoint;
+    ss << ind << "lv2:default " << pp.def_value << " ;\n";
+    ss << ind << "lv2:minimum " << pp.min << " ;\n";
+    ss << ind << "lv2:maximum " << pp.max << " ;\n";
+    ss << "    ]";
+    ports += ss.str();
+}
+
+void make_ttl()
+{
+    string ttl;
+    
+    ttl = 
+        "@prefix lv2:  <http://lv2plug.in/ns/lv2core#> .\n"
+        "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n"
+        "@prefix doap: <http://usefulinc.com/ns/doap#> .\n\n";
+    
+    vector<synth::giface_plugin_info> plugins;
+    synth::get_all_plugins(plugins);
+    for (unsigned int i = 0; i < plugins.size(); i++) {
+        synth::giface_plugin_info &pi = plugins[i];
+        ttl += string("<http://calf.sourceforge.net/plugins/") 
+            + string(pi.info->label)
+            + "> a lv2:Plugin ;\n";
+        ttl += "    doap:name \""+string(pi.info->name)+"\" ;\n";
+#if USE_PHAT
+        ttl += "    doap:licence <http://usefulinc.com/doap/licenses/gpl> ;\n";
+#else
+        ttl += "    doap:licence <http://usefulinc.com/doap/licenses/lgpl> ;\n";
+#endif
+        if (pi.rt_capable)
+            ttl += "    lv2:optionalFeature lv2:hardRtCapable ;\n";
+        
+        string ports = "";
+        int pn = 0;
+        const char *in_names[] = { "in_l", "in_r" };
+        const char *out_names[] = { "out_l", "out_r" };
+        for (int i = 0; i < pi.inputs; i++)
+            add_port(ports, in_names[i], in_names[i], "Input", pn++);
+        for (int i = 0; i < pi.outputs; i++)
+            add_port(ports, out_names[i], out_names[i], "Output", pn++);
+        for (int i = 0; i < pi.params; i++)
+            add_ctl_port(ports, pi.param_props[i], pn++);
+        if (!ports.empty())
+            ttl += "    lv2:port " + ports + "\n";
+        ttl += ".\n\n";
+    }
+    printf("%s\n", ttl.c_str());
+}
+
+void make_manifest()
+{
+    string ttl;
+    
+    ttl = 
+        "@prefix lv2:  <http://lv2plug.in/ns/lv2core#> .\n"
+        "@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n\n";
+    
+    vector<synth::giface_plugin_info> plugins;
+    synth::get_all_plugins(plugins);
+    for (unsigned int i = 0; i < plugins.size(); i++)
+        ttl += string("<http://calf.sourceforge.net/plugins/") 
+            + string(plugins[i].info->label)
+            + "> a lv2:Plugin ; lv2:binary <calf.so> ; rdfs:seeAlso <calf.ttl> .\n";
+
+    printf("%s\n", ttl.c_str());
+}
+
+int main(int argc, char *argv[])
+{
+    string mode = "rdf";
+    while(1) {
+        int option_index;
+        int c = getopt_long(argc, argv, "hvm:", long_options, &option_index);
+        if (c == -1)
+            break;
+        switch(c) {
+            case 'h':
+            case '?':
+                printf("LADSPA RDF generator for Calf plugin pack\nSyntax: %s [--help] [--version] [--mode rdf|ttl|manifest]\n", argv[0]);
+                return 0;
+            case 'v':
+                printf("%s\n", PACKAGE_STRING);
+                return 0;
+            case 'm':
+                mode = optarg;
+                if (mode != "rdf" && mode != "ttl" && mode != "manifest") {
+                    fprintf(stderr, "calfmakerdf: Invalid mode %s\n", optarg);
+                    return 1;
+                }
+                break;
+        }
+    }
+    if (mode == "rdf")
+        make_rdf();
+    if (mode == "ttl")
+        make_ttl();
+    if (mode == "manifest")
+        make_manifest();
     return 0;
 }
diff --git a/src/modules.cpp b/src/modules.cpp
index a840190..a7517f7 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -1,7 +1,7 @@
 /* Calf DSP Library
  * Example audio modules - parameters and LADSPA wrapper instantiation
  *
- * Copyright (C) 2001-2007 Krzysztof Foltman
+ * Copyright (C) 2001-2008 Krzysztof Foltman
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,24 +24,27 @@
 #include <jack/jack.h>
 #endif
 #include <calf/giface.h>
+#include <calf/lv2wrap.h>
 #include <calf/modules.h>
 #include <calf/modules_dev.h>
 
 using namespace synth;
 
-const char *copyright = "(C) 2001-2007 Krzysztof Foltman, license: LGPL";
-
-const char *amp_audio_module::port_names[] = {"In L", "In R", "Out L", "Out R"};
+#if USE_LADSPA
+#define LADSPA_WRAPPER(mod) static synth::ladspa_wrapper<mod##_audio_module> ladspa_##mod(mod##_info);
+#else
+#define LADSPA_WRAPPER(mod)
+#endif
 
-parameter_properties amp_audio_module::param_props[] = {
-    { 1, 0, 4, 1.1, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "gain", "Gain" }
-};
+#if USE_LV2
+#define LV2_WRAPPER(mod) static synth::lv2_wrapper<mod##_audio_module> lv2_##mod(mod##_info);
+#else
+#define LV2_WRAPPER(mod)
+#endif
 
-static synth::ladspa_info amp_info = { 0x847c, "Amp", "Calf Const Amp", "Krzysztof Foltman", copyright, "AmplifierPlugin" };
+#define ALL_WRAPPERS(mod) LADSPA_WRAPPER(mod) LV2_WRAPPER(mod)
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<amp_audio_module> amp(amp_info);
-#endif
+const char *copyright = "(C) 2001-2007 Krzysztof Foltman, license: LGPL";
 
 ////////////////////////////////////////////////////////////////////////////
 
@@ -57,9 +60,7 @@ parameter_properties flanger_audio_module::param_props[] = {
 
 static synth::ladspa_info flanger_info = { 0x847d, "Flanger", "Calf Flanger", "Krzysztof Foltman", copyright, "FlangerPlugin" };
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<flanger_audio_module> flanger(flanger_info);
-#endif
+ALL_WRAPPERS(flanger)
 
 ////////////////////////////////////////////////////////////////////////////
 
@@ -77,9 +78,7 @@ parameter_properties reverb_audio_module::param_props[] = {
 
 static synth::ladspa_info reverb_info = { 0x847e, "Reverb", "Calf Reverb", "Krzysztof Foltman", copyright, "ReverbPlugin" };
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<reverb_audio_module> reverb(reverb_info);
-#endif
+ALL_WRAPPERS(reverb)
 
 ////////////////////////////////////////////////////////////////////////////
 
@@ -103,9 +102,7 @@ parameter_properties filter_audio_module::param_props[] = {
 
 static synth::ladspa_info filter_info = { 0x847f, "Filter", "Calf Filter", "Krzysztof Foltman", copyright, "FilterPlugin" };
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<filter_audio_module> filter(filter_info);
-#endif
+ALL_WRAPPERS(filter)
 
 ////////////////////////////////////////////////////////////////////////////
 
@@ -135,47 +132,61 @@ parameter_properties vintage_delay_audio_module::param_props[] = {
 
 static synth::ladspa_info vintage_delay_info = { 0x8482, "VintageDelay", "Calf Vintage Delay", "Krzysztof Foltman", copyright, "DelayPlugin" };
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<vintage_delay_audio_module> vintage_delay(vintage_delay_info);
-#endif
+ALL_WRAPPERS(vintage_delay)
 
 ////////////////////////////////////////////////////////////////////////////
 #ifdef ENABLE_EXPERIMENTAL
 static synth::ladspa_info rotary_speaker_info = { 0x8483, "RotarySpeaker", "Calf Rotary Speaker", "Krzysztof Foltman", copyright, "SimulationPlugin" };
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<rotary_speaker_audio_module> rotary_speaker(rotary_speaker_info);
-#endif
+ALL_WRAPPERS(rotary_speaker)
 
 static synth::ladspa_info organ_info = { 0x8481, "Organ", "Calf Organ", "Krzysztof Foltman", copyright, "SynthesizerPlugin" };
 
-#if USE_LADSPA
-static synth::ladspa_wrapper<organ_audio_module> organ(organ_info);
-#endif
+ALL_WRAPPERS(organ)
 
 #endif
 ////////////////////////////////////////////////////////////////////////////
 
 static synth::ladspa_info monosynth_info = { 0x8480, "Monosynth", "Calf Monosynth", "Krzysztof Foltman", copyright, "SynthesizerPlugin" };
 
+ALL_WRAPPERS(monosynth)
+
+////////////////////////////////////////////////////////////////////////////
+
 #if USE_LADSPA
-static synth::ladspa_wrapper<monosynth_audio_module> monosynth(monosynth_info);
+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;
+#ifdef ENABLE_EXPERIMENTAL
+        case 5: return &::lv2_organ.descriptor;
+        case 6: return &::lv2_rotary_speaker.descriptor;
 #endif
+        default: return NULL;
+    }
+}
 
-////////////////////////////////////////////////////////////////////////////
+};
 
+#endif
 #if USE_LADSPA
 extern "C" {
 
 const LADSPA_Descriptor *ladspa_descriptor(unsigned long Index)
 {
     switch (Index) {
-        case 0: return &::filter.descriptor;
-        case 1: return &::flanger.descriptor;
-        case 2: return &::reverb.descriptor;
-        case 3: return &::vintage_delay.descriptor;
+        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;
 #ifdef ENABLE_EXPERIMENTAL
-        case 4: return &::rotary_speaker.descriptor;
+        case 4: return &::ladspa_rotary_speaker.descriptor;
 #endif
         default: return NULL;
     }
@@ -189,14 +200,14 @@ extern "C" {
 const DSSI_Descriptor *dssi_descriptor(unsigned long Index)
 {
     switch (Index) {
-        case 0: return &::filter.dssi_descriptor;
-        case 1: return &::flanger.dssi_descriptor;
-        case 2: return &::reverb.dssi_descriptor;
-        case 3: return &::monosynth.dssi_descriptor;
-        case 4: return &::vintage_delay.dssi_descriptor;
+        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;
 #ifdef ENABLE_EXPERIMENTAL
-        case 5: return &::organ.dssi_descriptor;
-        case 6: return &::rotary_speaker.dssi_descriptor;
+        case 5: return &::ladspa_organ.dssi_descriptor;
+        case 6: return &::ladspa_rotary_speaker.dssi_descriptor;
 #endif
         default: return NULL;
     }
@@ -209,12 +220,39 @@ std::string synth::get_builtin_modules_rdf()
 {
     std::string rdf;
     
-    rdf += ::flanger.generate_rdf();
-    rdf += ::reverb.generate_rdf();
-    rdf += ::filter.generate_rdf();
-    rdf += ::vintage_delay.generate_rdf();
-    rdf += ::monosynth.generate_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();
     
     return rdf;
 }
 #endif
+
+template<class Module>
+giface_plugin_info create_plugin_info(ladspa_info &info)
+{
+    giface_plugin_info pi;
+    pi.info = &info;
+    pi.inputs = Module::in_count;
+    pi.outputs = Module::out_count;
+    pi.params = Module::param_count;
+    pi.rt_capable = Module::rt_capable;
+    pi.midi_capable = Module::support_midi;
+    pi.param_props = Module::param_props;
+    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));
+#ifdef ENABLE_EXPERIMENTAL
+    plugins.push_back(create_plugin_info<organ_audio_module>(organ_info));
+    plugins.push_back(create_plugin_info<rotary_speaker_audio_module>(rotary_speaker_info));
+#endif
+}
diff --git a/src/organ.cpp b/src/organ.cpp
index 034db7c..f8ee251 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -127,7 +127,7 @@ const char *rotary_speaker_audio_module::port_names[] = {"In L", "In R", "Out L"
 const char *rotary_speaker_speed_names[] = { "Off", "Chorale", "Tremolo", "HoldPedal", "ModWheel" };
 
 parameter_properties rotary_speaker_audio_module::param_props[] = {
-    { 4,         0,  4, 1.01, PF_ENUM | PF_CTL_COMBO, rotary_speaker_speed_names, "vib_speed", "Speed Mode" },
+    { 2,         0,  4, 1.01, PF_ENUM | PF_CTL_COMBO, rotary_speaker_speed_names, "vib_speed", "Speed Mode" },
 };
 
 #endif

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list