[SCM] calf/master: + LV2: initial work on string port

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


The following commit has been merged in the master branch:
commit 6c1750289205814150379e01b6ffc42b685f0902
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Fri Nov 21 22:52:56 2008 +0000

    + LV2: initial work on string port

diff --git a/src/calf/Makefile.am b/src/calf/Makefile.am
index d62ce53..9fa6ca9 100644
--- a/src/calf/Makefile.am
+++ b/src/calf/Makefile.am
@@ -3,7 +3,7 @@ calfdir = $(includedir)/calf
 calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h custom_ctl.h \
     ctl_curve.h ctl_keyboard.h ctl_led.h \
     delay.h envelope.h fft.h fixed_point.h giface.h gui.h inertia.h jackhost.h ladspa_wrap.h loudness.h \
-    lv2_contexts.h lv2_data_access.h lv2_event.h lv2_ui.h lv2_uri_map.h lv2-midiport.h lv2helpers.h lv2wrap.h \
+    lv2_contexts.h lv2_data_access.h lv2_event.h lv2_string_port.h lv2_ui.h lv2_uri_map.h lv2-midiport.h lv2helpers.h lv2wrap.h \
     main_win.h metadata.h modules.h modules_dev.h modules_small.h modules_synths.h modulelist.h \
     multichorus.h onepole.h organ.h osc.h osctl.h osctlnet.h plugininfo.h preset.h \
     preset_gui.h primitives.h synth.h utils.h wave.h
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 9394c01..39e4d6b 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -43,6 +43,7 @@ enum parameter_flags
   PF_BOOL = 0x0002,  ///< bool value (usually >=0.5f is treated as TRUE, which is inconsistent with LV2 etc. which treats anything >0 as TRUE)
   PF_ENUM = 0x0003,  ///< enum value (min, min+1, ..., max, only guaranteed to work when min = 0)
   PF_ENUM_MULTI = 0x0004, ///< SET / multiple-choice
+  PF_STRING = 0x0005, ///< see: http://lv2plug.in/docs/index.php?title=String_port
   
   PF_SCALEMASK = 0xF0, ///< bit mask for scale
   PF_SCALE_DEFAULT = 0x00, ///< no scale given
diff --git a/src/calf/lv2_string_port.h b/src/calf/lv2_string_port.h
new file mode 100644
index 0000000..33e48fb
--- /dev/null
+++ b/src/calf/lv2_string_port.h
@@ -0,0 +1,85 @@
+/* lv2_string_port.h - C header file for LV2 string port extension.
+ * Draft version 2.
+ *
+ * Copyright (C) 2008 Krzysztof Foltman <wdev at foltman.com>
+ *
+ * This header 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 header 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 header; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307 USA
+ */
+
+#ifndef LV2_STRING_PORT_H
+#define LV2_STRING_PORT_H
+
+#include <stdint.h>
+
+/** \file
+Input ports string value lifetime:
+If the port does not have a context specified (it runs in the default,
+realtime audio processing context), the values in the structure and
+the actual string data MUST remain unchanged for the time a run() function
+of a plugin is executed. However, if the port belongs to a different
+context, the same data MUST remain unchanged only for the time a run() or
+message_process() function of a given context is executed.
+
+Output ports string value lifetime:
+The plugin may only change the string or length in a run() function (if
+the port belongs to default context) or in context-defined counterparts
+(if the port belongs to another context). Because of that, using default
+context output string ports is contraindicated for longer strings. 
+
+UI issues:
+When using port_event / write_port (and possible other communication
+mechanisms), the format parameter should contain the numeric value
+of URI LV2_STRING_PORT_URI (mapped with http://lv2plug.in/ns/extensions/ui
+specified as map URI).
+
+It's probably possible to use ports belonging to message context 
+<http://lv2plug.in/ns/dev/contexts#MessageContext> for transfer. However,
+contexts mechanism does not offer any way to notify the message recipient
+about which ports have been changed. To remedy that, this extension defines
+a flag LV2_STRING_DATA_CHANGED_FLAG that carries that information inside
+a port value structure.
+
+Storage:
+The value of string port are assumed to be "persistent": if a host
+saves and restores a state of a plugin (e.g. control port values), the
+values of input string ports should also be assumed to belong to that
+state. This also applies to message context: if a session is being restored,
+the host MUST resend the last value that was sent to the port before session
+has been saved. In other words, string port values "stick" to message ports.
+*/
+
+/** URI for the string port transfer mechanism */
+#define LV2_STRING_PORT_URI "http://lv2plug.in/ns/dev/string-port#StringXfer"
+
+/** Flag: port data has been updated; for input ports, this flag is set by
+the host. For output ports, this flag is set by the plugin. */
+#define LV2_STRING_DATA_CHANGED_FLAG 1
+
+/** structure for string port data */
+typedef struct 
+{
+    /** buffer for UTF-8 encoded zero-terminated string value; host-allocated */
+    char *data;
+    /** length in bytes (not characters), not including zero byte */ 
+    size_t len;
+    /** output ports: storage space in bytes; must be >= RDF-specified requirements */ 
+    size_t storage;
+    /** flags defined above */
+    uint32_t flags;
+    /** undefined yet, used for padding to 8 bytes */
+    uint32_t pad;
+} LV2_String_Data;
+
+#endif
diff --git a/src/calf/lv2wrap.h b/src/calf/lv2wrap.h
index 51aa174..7789ca1 100644
--- a/src/calf/lv2wrap.h
+++ b/src/calf/lv2wrap.h
@@ -30,6 +30,7 @@
 #include <calf/lv2_event.h>
 #include <calf/lv2_uri_map.h>
 #include <calf/lv2_contexts.h>
+#include <calf/lv2_string_port.h>
 
 namespace calf_plugins {
 

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list