[SCM] calf/master: + LV2: start implementing message context

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


The following commit has been merged in the master branch:
commit e500fdf77fc59d796052fab27688fbfc65de4887
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sat Nov 22 22:36:57 2008 +0000

    + LV2: start implementing message context

diff --git a/src/calf/giface.h b/src/calf/giface.h
index 8f0883a..3c295f0 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -77,6 +77,7 @@ enum parameter_flags
   PF_PROP_OUTPUT    = 0x080000, ///< output port
   PF_PROP_OPTIONAL  = 0x100000, ///< connection optional
   PF_PROP_GRAPH     = 0x200000, ///< add graph
+  PF_PROP_MSGCONTEXT= 0x400000, ///< message context
   
   PF_UNITMASK     = 0xFF000000,  ///< bit mask for units   \todo reduce to use only 5 bits
   PF_UNIT_DB      = 0x01000000,  ///< decibels
@@ -248,6 +249,10 @@ struct plugin_metadata_iface
     virtual bool is_cv(int param_no) = 0;
     /// is the given parameter non-interpolated?
     virtual bool is_noisy(int param_no) = 0;
+    /// does the plugin require message context? (or DSSI configure) may be slow
+    virtual bool requires_message_context() = 0;
+    /// does the plugin require string port extension? (or DSSI configure) may be slow
+    virtual bool requires_string_ports() = 0;
 
     /// Do-nothing destructor to silence compiler warning
     virtual ~plugin_metadata_iface() {}
@@ -322,6 +327,9 @@ public:
     inline void params_reset() {}
 };
 
+extern bool check_for_message_context_ports(parameter_properties *parameters, int count);
+extern bool check_for_string_ports(parameter_properties *parameters, int count);
+
 /// Metadata base class template, to provide default versions of interface functions
 template<class Metadata>
 class plugin_metadata: public virtual plugin_metadata_iface
@@ -351,7 +359,9 @@ public:
     const char **get_port_names() { return port_names; }
     bool is_cv(int param_no) { return true; }
     bool is_noisy(int param_no) { return false; }
-    virtual const ladspa_plugin_info &get_plugin_info() { return plugin_info; }
+    const ladspa_plugin_info &get_plugin_info() { return plugin_info; }
+    bool requires_message_context() { return check_for_message_context_ports(param_props, Metadata::param_count); }
+    bool requires_string_ports() { return check_for_string_ports(param_props, Metadata::param_count); }
 };
 
 /// A class for delegating metadata implementation to "remote" metadata class.
@@ -381,8 +391,9 @@ public:
     const char **get_port_names() { return impl->get_port_names(); }
     bool is_cv(int param_no) { return impl->is_cv(param_no); }
     bool is_noisy(int param_no) { return impl->is_noisy(param_no); }
-    virtual const ladspa_plugin_info &get_plugin_info() { return impl->get_plugin_info(); }
-    
+    const ladspa_plugin_info &get_plugin_info() { return impl->get_plugin_info(); }
+    bool requires_message_context() { return impl->requires_message_context(); }
+    bool requires_string_ports() { return impl->requires_string_ports(); }
 };
 
 #define CALF_PORT_NAMES(name) template<> const char *::plugin_metadata<name##_metadata>::port_names[]
diff --git a/src/giface.cpp b/src/giface.cpp
index c966ee3..a1b590f 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -211,3 +211,25 @@ const char *calf_plugins::load_gui_xml(const std::string &plugin_id)
         return NULL;
     }
 }
+
+bool calf_plugins::check_for_message_context_ports(parameter_properties *parameters, int count)
+{
+    for (int i = count - 1; i >= 0; i--)
+    {
+        if (parameters[i].flags & PF_PROP_MSGCONTEXT)
+            return true;
+    }
+    return false;
+}
+
+bool calf_plugins::check_for_string_ports(parameter_properties *parameters, int count)
+{
+    for (int i = count - 1; i >= 0; i--)
+    {
+        if ((parameters[i].flags & PF_TYPEMASK) == PF_STRING)
+            return true;
+        if ((parameters[i].flags & PF_TYPEMASK) < PF_STRING)
+            return false;
+    }
+    return false;
+}
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 754af73..243f901 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -232,6 +232,8 @@ static void add_ctl_port(string &ports, parameter_properties &pp, int pidx, plug
         ss << ind << "lv2:portProperty epp:notAutomatic ;\n";
     if (pp.flags & PF_PROP_OUTPUT_GAIN)
         ss << ind << "lv2:portProperty epp:outputGain ;\n";
+    if (pp.flags & PF_PROP_MSGCONTEXT)
+        ss << ind << "lv2ctx:context lv2ctx:MessageContext ;\n";
     if (type == PF_STRING)
     {
         ss << ind << "strport:default \"\"\"" << pp.choices[0] << "\"\"\" ;\n";
@@ -561,6 +563,14 @@ void make_ttl(string path_prefix)
             }
         }
         
+        if (pi->requires_message_context())
+        {
+            ttl += "    lv2:requiredFeature <http://lv2plug.in/ns/dev/contexts> ;\n";
+            ttl += "    lv2ctx:requiredContext lv2ctx:MessageContext ;\n";
+        }
+        if (pi->requires_string_ports())
+            ttl += "    lv2:requiredFeature <http://lv2plug.in/ns/dev/string-port> ;\n";
+        
         string ports = "";
         int pn = 0;
         const char *in_names[] = { "in_l", "in_r" };
diff --git a/src/modules.cpp b/src/modules.cpp
index c2d3c11..f243392 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -431,7 +431,7 @@ CALF_PORT_PROPS(organ) = {
     { -12,        -24, 24,   49, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_SEMITONES, NULL, "transpose", "Transpose" },
     { 0,       -100,  100,  201, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_CENTS, NULL, "detune", "Detune" },
     
-    { 0,          0,    0,    0, PF_STRING, &organ_init_map_curve, "map_curve", "Key mapping curve" },
+    { 0,          0,    0,    0, PF_STRING | PF_PROP_MSGCONTEXT, &organ_init_map_curve, "map_curve", "Key mapping curve" },
 };
 
 ////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules_small.cpp b/src/modules_small.cpp
index 4019597..6d3f6fd 100644
--- a/src/modules_small.cpp
+++ b/src/modules_small.cpp
@@ -1244,7 +1244,7 @@ public:
         pii->names("print_em", "Print To Console (EM)", "lv2:UtilityPlugin");
         pii->lv2_ttl("lv2:requiredFeature <http://lv2plug.in/ns/dev/contexts> ;");
         pii->lv2_ttl("lv2:requiredFeature lv2ctx:MessageContext ;");
-        pii->lv2_ttl("lv2:requiredContext lv2ctx:MessageContext ;");
+        pii->lv2_ttl("lv2ctx:requiredContext lv2ctx:MessageContext ;");
         pii->event_port("in", "In").input().lv2_ttl("lv2ctx:context lv2ctx:MessageContext ;");
     }
     void process(uint32_t)

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list