[SCM] calf/master: + LV2: initial (incomplete and sometimes slightly wrong) support for experimental "extended port properties" extension

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


The following commit has been merged in the master branch:
commit ec25ac13aa971950e5a9f638fa6e27ae1c613943
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Thu Jul 24 22:25:03 2008 +0000

    + LV2: initial (incomplete and sometimes slightly wrong) support for experimental "extended port properties" extension
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@237 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/giface.h b/src/calf/giface.h
index e9c54f5..4a0905a 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -58,26 +58,30 @@ enum parameter_flags
   PF_ENUM = 0x0003,
   PF_ENUM_MULTI = 0x0004, 
   
-  PF_SCALEMASK = 0x0FF0,
-  PF_SCALE_DEFAULT = 0x0000, ///< no scale given
-  PF_SCALE_LINEAR = 0x0010, ///< linear scale
-  PF_SCALE_LOG = 0x0020, ///< log scale
-  PF_SCALE_GAIN = 0x0030, ///< gain = -96dB..0 or -inf dB
-  PF_SCALE_PERC = 0x0040, ///< percent
-  PF_SCALE_QUAD = 0x0050, ///< quadratic scale (decent for some gain/amplitude values)
-
-  PF_CTLMASK = 0x0F000,
-  PF_CTL_DEFAULT = 0x00000,
-  PF_CTL_KNOB = 0x01000,
-  PF_CTL_FADER = 0x02000,
-  PF_CTL_TOGGLE = 0x03000,
-  PF_CTL_COMBO = 0x04000,
-  PF_CTL_RADIO = 0x05000,
-  PF_CTL_BUTTON = 0x06000,
+  PF_SCALEMASK = 0xF0,
+  PF_SCALE_DEFAULT = 0x00, ///< no scale given
+  PF_SCALE_LINEAR = 0x10, ///< linear scale
+  PF_SCALE_LOG = 0x20, ///< log scale
+  PF_SCALE_GAIN = 0x30, ///< gain = -96dB..0 or -inf dB
+  PF_SCALE_PERC = 0x40, ///< percent
+  PF_SCALE_QUAD = 0x50, ///< quadratic scale (decent for some gain/amplitude values)
+
+  PF_CTLMASK =     0x0F00,
+  PF_CTL_DEFAULT = 0x0000,
+  PF_CTL_KNOB =    0x0100,
+  PF_CTL_FADER =   0x0200,
+  PF_CTL_TOGGLE =  0x0300,
+  PF_CTL_COMBO =   0x0400,
+  PF_CTL_RADIO =   0x0500,
+  PF_CTL_BUTTON =  0x0600,
   
-  PF_CTLOPTIONS = 0xFF0000,
-  PF_CTLO_HORIZ = 0x010000,
-  PF_CTLO_VERT = 0x020000,
+  PF_CTLOPTIONS     = 0x00F000,
+  PF_CTLO_HORIZ     = 0x001000,
+  PF_CTLO_VERT      = 0x002000,
+
+  PF_PROP_NOBOUNDS =  0x010000, ///< no epp:hasStrictBounds
+  PF_PROP_EXPENSIVE = 0x020000, ///< epp:expensive, may trigger expensive calculation
+  PF_PROP_OUTPUT_GAIN=0x050000, ///< epp:outputGain + skip epp:hasStrictBounds
   
   PF_UNITMASK = 0xFF000000,
   PF_UNIT_DB = 0x01000000,
@@ -167,6 +171,8 @@ struct giface_plugin_info
     int inputs, outputs, params;
     bool rt_capable, midi_in_capable;
     parameter_properties *param_props;
+    bool (*is_cv)(int param_no);
+    bool (*is_noisy)(int param_no);
 };
 
 extern void get_all_plugins(std::vector<giface_plugin_info> &plugins);
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 9db53c9..99d0e98 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -50,6 +50,10 @@ public:
     inline static const char *get_gui_xml() { return NULL; }
     inline static bool get_static_graph(int index, int subindex, float value, float *data, int points, cairo_t *context) { return false; }
     inline static plugin_command_info *get_commands() { return NULL; }
+    /// does parameter number represent a CV port? (yes by default, except for synths)
+    static bool is_cv(int param_no) { return true; }
+    /// does parameter change cause an audible click?
+    static bool is_noisy(int param_no) { return false; }
     inline void execute(int cmd_no) {}
 };
 
@@ -299,6 +303,8 @@ public:
         order = 0;
     }
     
+    /// do not export mode and inertia as CVs, as those are settings and not parameters
+    inline static bool is_cv(int param_no) { return param_no != par_mode && param_no != par_inertia; }
     void calculate_filter()
     {
         float freq = inertia_cutoff.get_last();
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 0194661..f6e996c 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -160,11 +160,15 @@ public:
     /// Retrieve waveform graph (which does not need information about synth state)
     static bool get_static_graph(int index, int subindex, float value, float *data, int points, cairo_t *context);
     /// @retval true if the filter 1 is to be used for the left channel and filter 2 for the right channel
-    /// @retval false if filters are to be connected in series and sent (mono) to both channels
+    /// @retval false if filters are to be connected in series and sent (mono) to both channels    
     inline bool is_stereo_filter() const
     {
         return filter_type == flt_2lp12 || filter_type == flt_2bp6;
     }
+    /// No CV inputs for now
+    static bool is_cv(int param_no) { return false; }
+    /// Practically all the stuff here is noisy
+    static bool is_noisy(int param_no) { return true; }
     /// Calculate control signals and produce step_size samples of output.
     void calculate_step();
     /// Main processing function
@@ -259,6 +263,10 @@ public:
         render_separate(o, nsamples);
         return 3;
     }
+    /// No CV inputs for now
+    static bool is_cv(int param_no) { return false; }
+    /// Practically all the stuff here is noisy
+    static bool is_noisy(int param_no) { return true; }
     void execute(int cmd_no);
     bool get_graph(int index, int subindex, float *data, int points, cairo_t *context);
     static const char *get_name() { return "organ"; }    
diff --git a/src/makerdf.cpp b/src/makerdf.cpp
index 32e7898..56bc713 100644
--- a/src/makerdf.cpp
+++ b/src/makerdf.cpp
@@ -102,14 +102,14 @@ static const char *units[] = {
     "ue:hz",
     "ue:s",
     "ue:ms",
-    "ue2:cent", // - ask SWH (or maybe ue2: and write the extension by myself)
-    "ue2:semitone12TET", // - ask SWH
+    "ue:cent", // - ask SWH (or maybe ue2: and write the extension by myself)
+    "ue:semitone12TET", // - ask SWH
     "ue:bpm",
-    "ue2:degree", // - ask SWH
-    "ue2:midiNote" // - ask SWH
+    "ue:degree",
+    "ue:midiNote" // question to SWH: the extension says midiNode, but that must be a typo
 };
 
-static void add_ctl_port(string &ports, parameter_properties &pp, int pidx)
+static void add_ctl_port(string &ports, parameter_properties &pp, int pidx, giface_plugin_info *gpi, int param)
 {
     stringstream ss;
     const char *ind = "        ";
@@ -122,6 +122,18 @@ static void add_ctl_port(string &ports, parameter_properties &pp, int pidx)
     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_CTLMASK) == PF_CTL_BUTTON)
+        ss << ind << "lv2:portProperty epp:trigger ;\n";
+    if (!(pp.flags & PF_PROP_NOBOUNDS))
+        ss << ind << "lv2:portProperty epp:hasStrictBounds ;\n";
+    if (pp.flags & PF_PROP_EXPENSIVE)
+        ss << ind << "lv2:portProperty epp:expensive ;\n";
+    if ((*gpi->is_noisy)(param))
+        ss << ind << "lv2:portProperty epp:causesArtifacts ;\n";
+    if (!(*gpi->is_cv)(param))
+        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_TYPEMASK) == PF_BOOL)
         ss << ind << "lv2:portProperty lv2:toggled ;\n";
     else if ((pp.flags & PF_TYPEMASK) == PF_ENUM)
@@ -140,6 +152,11 @@ static void add_ctl_port(string &ports, parameter_properties &pp, int pidx)
     if (unit > 0 && unit < (sizeof(units) / sizeof(char *)))
         ss << ind << "ue:unit " << units[unit - 1] << " ;\n";
     
+    // for now I assume that the only tempo passed is the tempo the plugin should operate with
+    // this may change as more complex plugins are added
+    if (unit == PF_UNIT_BPM)
+        ss << ind << "lv2:portProperty epp:reportsBpm ;\n";
+    
     ss << "    ]";
     ports += ss.str();
 }
@@ -158,7 +175,7 @@ void make_ttl(string path_prefix)
         "@prefix lv2midi: <http://lv2plug.in/ns/ext/midi#> .\n"
         "@prefix pg: <http://ll-plugins.nongnu.org/lv2/ext/portgroups#> .\n"
         "@prefix ue: <http://lv2plug.in/ns/extensions/units#> .\n"
-        "@prefix ue2: <http://lv2plug.in/ns/dev/moreunits#> .\n"
+        "@prefix epp: <http://lv2plug.in/ns/dev/extportinfo#> .\n"
 
         "\n"
     ;
@@ -192,11 +209,12 @@ void make_ttl(string path_prefix)
 #endif
     
     for (unsigned int i = 0; i < plugins.size(); i++) {
-        string ttl = header;
         synth::giface_plugin_info &pi = plugins[i];
-        ttl += string("<http://calf.sourceforge.net/plugins/") 
-            + string(pi.info->label)
-            + "> a lv2:Plugin ;\n";
+        string uri = string("<http://calf.sourceforge.net/plugins/")  + string(pi.info->label) + ">";
+        string ttl;
+        ttl = "@prefix : " + uri + " .\n" + header;
+        
+        ttl += uri + " a lv2:Plugin ;\n";
         
         if (classes.count(pi.info->plugin_type))
             ttl += "    a " + classes[pi.info->plugin_type]+" ;\n";
@@ -209,6 +227,8 @@ void make_ttl(string path_prefix)
 #endif
         
         ttl += "    doap:license <http://usefulinc.com/doap/licenses/lgpl> ;\n";
+        // XXXKF not really optional for now, to be honest
+        ttl += "    lv2:optionalFeature epp:supportsStrictBounds ;\n";
         if (pi.rt_capable)
             ttl += "    lv2:optionalFeature lv2:hardRtCapable ;\n";
         if (pi.midi_in_capable)
@@ -224,7 +244,7 @@ void make_ttl(string path_prefix)
         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++);
+            add_ctl_port(ports, pi.param_props[i], pn++, &pi, i);
         if (pi.midi_in_capable) {
             add_port(ports, "event_in", "Event", "Input", pn++, "lv2ev:EventPort", true);
         }
diff --git a/src/modules.cpp b/src/modules.cpp
index 84bd118..7fd7e55 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -58,7 +58,7 @@ parameter_properties flanger_audio_module::param_props[] = {
     { 0.90,   -0.99, 0.99,  0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "feedback", "Feedback" },
     { 0,          0, 360,   9, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_DEG, NULL, "stereo", "Stereo phase" },
     { 0,          0, 1,     2, PF_BOOL | PF_CTL_BUTTON , NULL, "reset", "Reset" },
-    { 1,          0, 2,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "amount", "Amount" },
+    { 1,          0, 2,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "amount", "Amount" },
 };
 
 static synth::ladspa_info flanger_info = { 0x847d, "Flanger", "Calf Flanger", "Krzysztof Foltman", copyright, "FlangerPlugin" };
@@ -77,7 +77,7 @@ parameter_properties phaser_audio_module::param_props[] = {
     { 6,          1, 12,   12, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB, NULL, "stages", "# Stages" },
     { 180,        0, 360,   9, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_DEG, NULL, "stereo", "Stereo phase" },
     { 0,          0, 1,     2, PF_BOOL | PF_CTL_BUTTON , NULL, "reset", "Reset" },
-    { 1,          0, 2,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "amount", "Amount" },
+    { 1,          0, 2,     0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "amount", "Amount" },
 };
 
 static synth::ladspa_info phaser_info = { 0x847d, "Phaser", "Calf Phaser", "Krzysztof Foltman", copyright, "PhaserPlugin" };
@@ -95,7 +95,7 @@ parameter_properties reverb_audio_module::param_props[] = {
     { 5000,    2000,20000,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "hf_damp", "High Frq Damp" },
     { 2,          0,    3,    0, PF_ENUM | PF_CTL_COMBO , reverb_room_sizes, "room_size", "Room size", },
     { 0.5,        0,    1,    0, PF_FLOAT | PF_CTL_KNOB | PF_SCALE_PERC, NULL, "diffusion", "Diffusion" },
-    { 0.25,       0,    2,    0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "amount", "Amount" },
+    { 0.25,       0,    2,    0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "amount", "Amount" },
 };
 
 static synth::ladspa_info reverb_info = { 0x847e, "Reverb", "Calf Reverb", "Krzysztof Foltman", copyright, "ReverbPlugin" };
@@ -284,6 +284,8 @@ giface_plugin_info create_plugin_info(ladspa_info &info)
     pi.rt_capable = Module::rt_capable;
     pi.midi_in_capable = Module::support_midi;
     pi.param_props = Module::param_props;
+    pi.is_noisy = Module::is_noisy;
+    pi.is_cv = Module::is_cv;
     return pi;
 }
 
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index 9af5dca..642bc58 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -218,7 +218,7 @@ parameter_properties monosynth_audio_module::param_props[] = {
     { 0.5,        0,    1,  0.1, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "vel2filter", "Vel->Filter" },
     { 0,          0,    1,  0.1, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB, NULL, "vel2amp", "Vel->Amp" },
 
-    { 0.5,         0,   1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "master", "Volume" },
+    { 0.5,         0,   1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_PROP_OUTPUT_GAIN, NULL, "master", "Volume" },
 };
 
 float silence[4097];
diff --git a/src/organ.cpp b/src/organ.cpp
index f1e4125..2d2c78e 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -440,7 +440,7 @@ parameter_properties organ_audio_module::param_props[] = {
     { 0,         0,  organ_voice_base::perctrig_count - 1, 0, PF_ENUM | PF_CTL_COMBO, organ_percussion_trigger_names, "perc_trigger", "Perc. trigger" },
 
     { 0,         0,  1, 0, PF_BOOL | PF_CTL_TOGGLE, NULL, "filter_chain", "Filter 1 To 2" },
-    { 0.1,         0,  1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "master", "Volume" },
+    { 0.1,         0,  1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_PROP_OUTPUT_GAIN, NULL, "master", "Volume" },
     
     { 2000,   20, 20000, 100, PF_FLOAT | PF_SCALE_LOG | PF_UNIT_HZ | PF_CTL_KNOB, NULL, "f1_cutoff", "F1 Cutoff" },
     { 2,        0.7,    8,    0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB, NULL, "f1_res", "F1 Res" },

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list