[SCM] calf/master: + Framework: allow arbitrary TTL for ports and micronames for plugins and ports + Small plugins: crossfaders (audio- and control-rate), XOR gate, added micronames for selected plugins and ports

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


The following commit has been merged in the master branch:
commit 7a51deaed322301ff5c4bcb7d9c0c4c085399e2a
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Fri Sep 26 19:51:13 2008 +0000

    + Framework: allow arbitrary TTL for ports and micronames for plugins and ports
    + Small plugins: crossfaders (audio- and control-rate), XOR gate, added micronames for selected plugins and ports
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@301 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/modulelist.h b/src/calf/modulelist.h
index 88ea32a..24d0d9e 100644
--- a/src/calf/modulelist.h
+++ b/src/calf/modulelist.h
@@ -30,12 +30,15 @@
     PER_SMALL_MODULE_ITEM(print_c, "print_c")
     PER_SMALL_MODULE_ITEM(quadpower_a, "quadpower_a")
     PER_SMALL_MODULE_ITEM(quadpower_c, "quadpower_c")
+    PER_SMALL_MODULE_ITEM(crossfader2_a, "crossfader2_a")
+    PER_SMALL_MODULE_ITEM(crossfader2_c, "crossfader2_c")
     PER_SMALL_MODULE_ITEM(linear_inertia_c, "linear_inertia_c")
     PER_SMALL_MODULE_ITEM(exp_inertia_c, "exp_inertia_c")
     PER_SMALL_MODULE_ITEM(sample_hold_edge_c, "sample_hold_edge_c")
     PER_SMALL_MODULE_ITEM(sample_hold_level_c, "sample_hold_level_c")
     PER_SMALL_MODULE_ITEM(logical_and_c, "logical_and_c")
     PER_SMALL_MODULE_ITEM(logical_or_c, "logical_or_c")
+    PER_SMALL_MODULE_ITEM(logical_xor_c, "logical_xor_c")
     PER_SMALL_MODULE_ITEM(logical_not_c, "logical_not_c")
     PER_SMALL_MODULE_ITEM(flipflop_c, "flipflop_c")
     PER_SMALL_MODULE_ITEM(schmitt_c, "schmitt_c")
diff --git a/src/calf/plugininfo.h b/src/calf/plugininfo.h
index 0658dfa..c605f7d 100644
--- a/src/calf/plugininfo.h
+++ b/src/calf/plugininfo.h
@@ -33,6 +33,7 @@ struct audio_port_info_iface
     virtual audio_port_info_iface& input() { return *this; }
     /// Called if it's an output port
     virtual audio_port_info_iface& output() { return *this; }
+    virtual audio_port_info_iface& lv2_ttl(const std::string &text) { return *this; }
     virtual ~audio_port_info_iface() {}
 };
 
@@ -50,6 +51,7 @@ struct control_port_info_iface
     virtual control_port_info_iface& toggle() { return *this; }
     virtual control_port_info_iface& trigger() { return *this; }
     virtual control_port_info_iface& integer() { return *this; }
+    virtual control_port_info_iface& lv2_ttl(const std::string &text) { return *this; }
     virtual ~control_port_info_iface() {}
 };
 
@@ -57,11 +59,11 @@ struct control_port_info_iface
 struct plugin_info_iface
 {
     /// Set plugin names (ID, name and label)
-    virtual void names(const std::string &name, const std::string &label, const std::string &category) {}
+    virtual void names(const std::string &name, const std::string &label, const std::string &category, const std::string &microname = std::string()) {}
     /// Add an audio port (returns a sink which accepts further description)
-    virtual audio_port_info_iface &audio_port(const std::string &id, const std::string &name)=0;
+    virtual audio_port_info_iface &audio_port(const std::string &id, const std::string &name, const std::string &microname = std::string("N/A"))=0;
     /// Add a control port (returns a sink which accepts further description)
-    virtual control_port_info_iface &control_port(const std::string &id, const std::string &name, double def_value)=0;
+    virtual control_port_info_iface &control_port(const std::string &id, const std::string &name, double def_value, const std::string &microname = "N/A")=0;
     /// Called after plugin has reported all the information
     virtual void finalize() {}
     virtual ~plugin_info_iface() {}
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 32343d8..db5e357 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -178,13 +178,14 @@ struct lv2_port_base {
 struct lv2_audio_port_info: public lv2_port_base, public audio_port_info_iface
 {
     int index;
-    string symbol, name;
+    string symbol, name, extras, microname;
     bool is_input;
     
-    lv2_audio_port_info(int _index, const std::string &_symbol, const std::string &_name)
+    lv2_audio_port_info(int _index, const std::string &_symbol, const std::string &_name, const std::string &_microname)
     : index(_index)
     , symbol(_symbol)
     , name(_name)
+    , microname(_microname)
     , is_input(true)
     {
     }
@@ -192,6 +193,7 @@ struct lv2_audio_port_info: public lv2_port_base, public audio_port_info_iface
     virtual audio_port_info_iface& input() { is_input = true; return *this; }
     /// Called if it's an output port
     virtual audio_port_info_iface& output() { is_input = false; return *this; }
+    virtual audio_port_info_iface& lv2_ttl(const std::string &text) { extras += text; return *this; }
     
     std::string to_string() {
         stringstream ss;
@@ -202,6 +204,10 @@ struct lv2_audio_port_info: public lv2_port_base, public audio_port_info_iface
         ss << ind << "lv2:index " << index << " ;\n";
         ss << ind << "lv2:symbol \"" << symbol << "\" ;\n";
         ss << ind << "lv2:name \"" << name << "\" ;\n";
+        if (!extras.empty())
+            ss << ind << extras << endl;
+        if (microname != "N/A")
+            ss << ind << "<http://lv2plug.in/ns/dev/tiny-name> \"" << microname << "\" ;\n";
         ss << "    ]\n";
         
         return ss.str();
@@ -211,15 +217,16 @@ struct lv2_audio_port_info: public lv2_port_base, public audio_port_info_iface
 struct lv2_control_port_info: public lv2_port_base, public control_port_info_iface
 {
     int index;
-    string symbol, name;
+    string symbol, name, extras, microname;
     bool is_input, is_log, is_toggle, is_trigger, is_integer;
     double min, max, def_value;
     bool has_min, has_max;
     
-    lv2_control_port_info(int _index, const std::string &_symbol, const std::string &_name, double _default)
+    lv2_control_port_info(int _index, const std::string &_symbol, const std::string &_name, double _default, const std::string &_microname)
     : index(_index)
     , symbol(_symbol)
     , name(_name)
+    , microname(_microname)
     , is_input(true)
     , def_value(_default)
     {
@@ -236,6 +243,7 @@ struct lv2_control_port_info: public lv2_port_base, public control_port_info_ifa
     virtual control_port_info_iface& toggle() { is_toggle = true; return *this; }
     virtual control_port_info_iface& trigger() { is_trigger = true; return *this; }
     virtual control_port_info_iface& integer() { is_integer = true; return *this; }
+    virtual control_port_info_iface& lv2_ttl(const std::string &text) { extras += text; return *this; }
     std::string to_string() {
         stringstream ss;
         const char *ind = "        ";
@@ -245,6 +253,12 @@ struct lv2_control_port_info: public lv2_port_base, public control_port_info_ifa
         ss << ind << "lv2:index " << index << " ;\n";
         ss << ind << "lv2:symbol \"" << symbol << "\" ;\n";
         ss << ind << "lv2:name \"" << name << "\" ;\n";
+        if (!extras.empty())
+            ss << ind << extras << endl;
+        if (microname != "N/A")
+            ss << ind << "<http://lv2plug.in/ns/dev/tiny-name> \"" << microname << "\" ;\n";
+        ss << ind << "lv2:name \"" << name << "\" ;\n";
+        
         if (is_toggle)
             ss << ind << "lv2:portProperty lv2:toggled ;\n";
         if (is_integer)
@@ -271,23 +285,26 @@ struct lv2_plugin_info: public plugin_info_iface
     std::string label;
     /// Plugin class (category)
     std::string category;
+    /// Plugin micro-name
+    std::string microname;
     /// Vector of ports
     vector<lv2_port_base *> ports;
     /// Set plugin names (ID, name and label)
-    virtual void names(const std::string &_name, const std::string &_label, const std::string &_category) {
+    virtual void names(const std::string &_name, const std::string &_label, const std::string &_category, const std::string &_microname) {
         name = _name;
         label = _label;
         category = _category;
+        microname = _microname;
     }
     /// Add an audio port (returns a sink which accepts further description)
-    virtual audio_port_info_iface &audio_port(const std::string &id, const std::string &name) {
-        lv2_audio_port_info *port = new lv2_audio_port_info(ports.size(), id, name);
+    virtual audio_port_info_iface &audio_port(const std::string &id, const std::string &name, const std::string &_microname) {
+        lv2_audio_port_info *port = new lv2_audio_port_info(ports.size(), id, name, _microname);
         ports.push_back(port);
         return *port;
     }
     /// Add a control port (returns a sink which accepts further description)
-    virtual control_port_info_iface &control_port(const std::string &id, const std::string &name, double def_value) {
-        lv2_control_port_info *port = new lv2_control_port_info(ports.size(), id, name, def_value);
+    virtual control_port_info_iface &control_port(const std::string &id, const std::string &name, double def_value, const std::string &_microname) {
+        lv2_control_port_info *port = new lv2_control_port_info(ports.size(), id, name, def_value, _microname);
         ports.push_back(port);
         return *port;
     }
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index 91af504..9b985b6 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -212,13 +212,13 @@ public:
     static void port_info(plugin_info_iface *pii)
     {
         if (Inputs == 1)
-            pii->audio_port("in", "In").input();
+            pii->audio_port("in", "In", "").input();
         else
         {
-            pii->audio_port("in_1", "In 1").input();
-            pii->audio_port("in_2", "In 2").input();
+            pii->audio_port("in_1", "In 1", "").input();
+            pii->audio_port("in_2", "In 2", "").input();
         }
-        pii->audio_port("out", "Out").output();
+        pii->audio_port("out", "Out", "").output();
     }
 };
 
@@ -231,7 +231,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("min", "Min (A)", "kf:MathOperatorPlugin");
+        pii->names("min", "Min (A)", "kf:MathOperatorPlugin", "min");
         port_info(pii);
     }
 };
@@ -245,7 +245,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("max", "Max (A)", "kf:MathOperatorPlugin");
+        pii->names("max", "Max (A)", "kf:MathOperatorPlugin", "max");
         port_info(pii);
     }
 };
@@ -259,7 +259,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("minus", "Subtract (A)", "kf:MathOperatorPlugin");
+        pii->names("minus", "Subtract (A)", "kf:MathOperatorPlugin", "-");
         port_info(pii);
     }
 };
@@ -273,7 +273,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("mul", "Multiply (A)", "kf:MathOperatorPlugin");
+        pii->names("mul", "Multiply (A)", "kf:MathOperatorPlugin", "*");
         port_info(pii);
     }
 };
@@ -287,7 +287,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("neg", "Negative (A)", "kf:MathOperatorPlugin");
+        pii->names("neg", "Negative (A)", "kf:MathOperatorPlugin", "-");
         port_info(pii);
     }
 };
@@ -301,11 +301,11 @@ public:
     {
         int idx = 0;
         if (Inputs == 1)
-            cports[idx++] = &pii->control_port("in", "In", in1).input();
+            cports[idx++] = &pii->control_port("in", "In", in1, "").input();
         else
         {
-            cports[idx++] = &pii->control_port("in_1", "In 1", in1).input();
-            cports[idx++] = &pii->control_port("in_2", "In 2", in2).input();
+            cports[idx++] = &pii->control_port("in_1", "In 1", in1, "").input();
+            cports[idx++] = &pii->control_port("in_2", "In 2", in2, "").input();
         }
         cports[idx++] = &pii->control_port("out", "Out", 0).output();
     }
@@ -319,7 +319,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("less_c", "Less than (C)", "kf:MathOperatorPlugin");
+        pii->names("less_c", "Less than (C)", "kf:MathOperatorPlugin", "<");
         control_port_info_iface *cports[2];
         port_info(pii, cports);
         cports[2]->toggle();
@@ -379,7 +379,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("logical_and_c", "Logical AND (C)", "kf:BooleanPlugin");
+        pii->names("logical_and_c", "Logical AND (C)", "kf:BooleanPlugin", "&&");
         control_port_info_iface *cports[3];
         port_info(pii, cports);
         cports[0]->toggle();
@@ -396,7 +396,24 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("logical_or_c", "Logical OR (C)", "kf:BooleanPlugin");
+        pii->names("logical_or_c", "Logical OR (C)", "kf:BooleanPlugin", "||");
+        control_port_info_iface *cports[3];
+        port_info(pii, cports);
+        cports[0]->toggle();
+        cports[1]->toggle();
+        cports[2]->toggle();
+    }
+};
+
+class logical_xor_c_audio_module: public control_operator_audio_module<2>
+{
+public:
+    void process(uint32_t count) {
+        *outs[0] = ((*ins[0] > 0) != (*ins[1] > 0)) ? 1.f : 0.f;
+    }
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("logical_xor_c", "Logical XOR (C)", "kf:BooleanPlugin", "xor");
         control_port_info_iface *cports[3];
         port_info(pii, cports);
         cports[0]->toggle();
@@ -413,7 +430,7 @@ public:
     }
     static void plugin_info(plugin_info_iface *pii)
     {
-        pii->names("logical_not_c", "Logical NOT (C)", "kf:BooleanPlugin");
+        pii->names("logical_not_c", "Logical NOT (C)", "kf:BooleanPlugin", "!");
         control_port_info_iface *cports[2];
         port_info(pii, cports);
         cports[0]->toggle();
@@ -507,6 +524,54 @@ public:
     }
 };
 
+/// Two input control crossfader
+class crossfader2_c_audio_module: public null_small_audio_module
+{
+public:    
+    enum { in_a, in_b, in_ctl, in_count };
+    enum { out_value, out_count };
+    float *ins[in_count]; 
+    float *outs[out_count];
+    
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("crossfader2_c", "2-in crossfader (C)", "kf:MathOperatorPlugin", "xfC");
+        pii->control_port("in_a", "In A", 0.f).input();
+        pii->control_port("in_b", "In B", 0).input();
+        pii->control_port("mix", "B in mix", 0.5).input();
+        pii->control_port("out", "Out", 0.f).output();
+    }
+    void process(uint32_t count)
+    {
+        *outs[out_value] = *ins[in_a] + (*ins[in_b] - *ins[in_a]) * dsp::clip(*ins[in_ctl], 0.f, 1.f);
+    }
+};
+
+/// Two input audio crossfader
+class crossfader2_a_audio_module: public null_small_audio_module
+{
+public:    
+    enum { in_a, in_b, in_ctl, in_count };
+    enum { out_value, out_count };
+    float *ins[in_count]; 
+    float *outs[out_count];
+    
+    static void plugin_info(plugin_info_iface *pii)
+    {
+        pii->names("crossfader2_a", "2-in crossfader (A)", "kf:MathOperatorPlugin", "xfA");
+        pii->audio_port("in_a", "In A").input();
+        pii->audio_port("in_b", "In B").input();
+        pii->audio_port("mix", "B in mix").input();
+        pii->audio_port("out", "Out").output();
+    }
+    void process(uint32_t count)
+    {
+        for (uint32_t i = 0; i < count; i++)
+            outs[out_value][i] = ins[in_a][i] + (ins[in_b][i] - ins[in_a][i]) * dsp::clip(ins[in_ctl][i], 0.f, 1.f);
+    }
+};
+
+/// Base class for LFOs with frequency and reset inputs
 class freq_phase_lfo_base: public small_audio_module_base<2, 1>
 {
 public:

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list