summaryrefslogtreecommitdiffstats
path: root/slv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-21 15:14:53 +0000
committerDavid Robillard <d@drobilla.net>2008-01-21 15:14:53 +0000
commit0bf92c1f25a854566212e42deafe72ecd2a5f1a1 (patch)
tree7933e54159426aee99a3c6493d9d4852da094baf /slv2
parent42aa3c32cdd4c6a0cc1e3372d57ac99511b2f46d (diff)
downloadlilv-0bf92c1f25a854566212e42deafe72ecd2a5f1a1.tar.gz
lilv-0bf92c1f25a854566212e42deafe72ecd2a5f1a1.tar.bz2
lilv-0bf92c1f25a854566212e42deafe72ecd2a5f1a1.zip
Work on generic LV2 events.
git-svn-id: http://svn.drobilla.net/lad/slv2@1090 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'slv2')
-rw-r--r--slv2/Makefile.am2
-rw-r--r--slv2/plugin.h12
-rw-r--r--slv2/port.h33
-rw-r--r--slv2/portsignature.h57
-rw-r--r--slv2/slv2.h2
-rw-r--r--slv2/template.h76
-rw-r--r--slv2/types.h14
-rw-r--r--slv2/value.h8
8 files changed, 52 insertions, 152 deletions
diff --git a/slv2/Makefile.am b/slv2/Makefile.am
index 0562741..2c11b91 100644
--- a/slv2/Makefile.am
+++ b/slv2/Makefile.am
@@ -11,9 +11,7 @@ slv2include_HEADERS = \
pluginuiinstance.h \
pluginuis.h \
port.h \
- portsignature.h \
slv2.h \
- template.h \
types.h \
util.h \
value.h \
diff --git a/slv2/plugin.h b/slv2/plugin.h
index e4e5984..3dc63a8 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -275,18 +275,6 @@ SLV2Template
slv2_plugin_get_template(SLV2Plugin p);
-/** Get the number of ports on this plugin of a given direction and/or type.
- *
- * Use SLV2_PORT_DATA_TYPE_ANY and SLV2_PORT_DIRECTION_ANY for a wildcard.
- *
- * Time = O(1)
- */
-uint32_t
-slv2_plugin_get_num_ports_of_type(SLV2Plugin p,
- SLV2PortDirection dir,
- SLV2PortDataType type);
-
-
/** Return whether or not the plugin introduces (and reports) latency.
*
* The index of the latency port can be found with slv2_plugin_get_latency_port
diff --git a/slv2/port.h b/slv2/port.h
index 973d400..072417b 100644
--- a/slv2/port.h
+++ b/slv2/port.h
@@ -98,6 +98,38 @@ slv2_port_get_name(SLV2Plugin plugin,
SLV2Port port);
+/** Get all the classes of a port.
+ *
+ * This can be used to determine if a port is an input, output, audio,
+ * control, midi, etc, etc, though it's simpler to use slv2_port_is_a.
+ * The returned list does not include lv2:Port, which is implied.
+ *
+ * Returned value is shared and must not be destroyed by caller.
+ *
+ * Time = O(1)
+ */
+SLV2Values
+slv2_port_get_classes(SLV2Plugin plugin,
+ SLV2Port port);
+
+
+/** Determine if a port is of a given class (input, output, audio, etc).
+ *
+ * For convenience/performance/extensibility reasons, hosts are expected to
+ * create an SLV2Value for each port class they "care about". Well-known type
+ * URI strings are defined (e.g. SLV2_PORT_CLASS_INPUT) for convenience, but
+ * this function is designed so that SLV2 is usable with any port types
+ * without requiring explicit support in SLV2.
+ *
+ * Time = O(n) (n pointer comparisons where n is the number of classes of
+ * this port, so this method is suitable for realtime use on any sane port).
+ */
+bool
+slv2_port_is_a(SLV2Plugin plugin,
+ SLV2Port port,
+ SLV2Value port_class);
+
+#if 0
/** Get the direction (input, output) of a port.
*
* Time = Query
@@ -113,6 +145,7 @@ slv2_port_get_direction(SLV2Plugin plugin,
SLV2PortDataType
slv2_port_get_data_type(SLV2Plugin plugin,
SLV2Port port);
+#endif
/** Get the default value of a port.
diff --git a/slv2/portsignature.h b/slv2/portsignature.h
deleted file mode 100644
index d35d63e..0000000
--- a/slv2/portsignature.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SLV2
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library 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 General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __SLV2_PORTSIGNATURE_H__
-#define __SLV2_PORTSIGNATURE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-#include <slv2/types.h>
-
-/** \addtogroup slv2_data
- * @{
- */
-
-
-/** Get the direction (input or output) of the port.
- *
- * Time = O(1)
- */
-SLV2PortDirection
-slv2_port_signature_get_direction(SLV2PortSignature sig);
-
-
-/** Get the type (e.g. audio, midi) of the port.
- *
- * Time = O(1)
- */
-SLV2PortDataType
-slv2_port_signature_get_type(SLV2PortSignature sig);
-
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SLV2_PORTSIGNATURE_H__ */
-
diff --git a/slv2/slv2.h b/slv2/slv2.h
index 9aa5c8c..6d0298b 100644
--- a/slv2/slv2.h
+++ b/slv2/slv2.h
@@ -31,8 +31,6 @@ extern "C" {
#include <slv2/pluginuiinstance.h>
#include <slv2/pluginuis.h>
#include <slv2/port.h>
-#include <slv2/portsignature.h>
-#include <slv2/template.h>
#include <slv2/types.h>
#include <slv2/util.h>
#include <slv2/value.h>
diff --git a/slv2/template.h b/slv2/template.h
deleted file mode 100644
index 47aac30..0000000
--- a/slv2/template.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* SLV2
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library 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 General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __SLV2_TEMPLATE_H__
-#define __SLV2_TEMPLATE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdbool.h>
-#include <slv2/types.h>
-
-/** \addtogroup slv2_data
- * @{
- */
-
-
-/** Free an SLV2Template.
- *
- * Time = O(1) + free()
- */
-void
-slv2_template_free(SLV2Template);
-
-
-/** Get the signature (direction and type) of a port
- *
- * Time = O(1)
- */
-SLV2PortSignature
-slv2_template_get_port(SLV2Template t,
- uint32_t index);
-
-
-/** Get the total number of ports.
- *
- * Time = O(1)
- */
-uint32_t
-slv2_template_get_num_ports(SLV2Template t);
-
-
-/** Get the number of ports of a given direction and type.
- *
- * Time = O(1)
- */
-uint32_t
-slv2_template_get_num_ports_of_type(SLV2Template t,
- SLV2PortDirection direction,
- SLV2PortDataType type);
-
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SLV2_TEMPLATE_H__ */
-
diff --git a/slv2/types.h b/slv2/types.h
index d6442b3..79e7370 100644
--- a/slv2/types.h
+++ b/slv2/types.h
@@ -26,7 +26,17 @@ extern "C" {
#include <stdbool.h>
#include <stdint.h>
-
+#define SLV2_NAMESPACE_LV2 "http://lv2plug.in/ns/lv2core#"
+#define SLV2_PORT_CLASS_PORT "http://lv2plug.in/ns/lv2core#Port"
+#define SLV2_PORT_CLASS_INPUT "http://lv2plug.in/ns/lv2core#InputPort"
+#define SLV2_PORT_CLASS_OUTPUT "http://lv2plug.in/ns/lv2core#OutputPort"
+#define SLV2_PORT_CLASS_CONTROL "http://lv2plug.in/ns/lv2core#ControlPort"
+#define SLV2_PORT_CLASS_AUDIO "http://lv2plug.in/ns/lv2core#AudioPort"
+#define SLV2_PORT_CLASS_MIDI "http://ll-plugins.nongnu.org/lv2/ext/MidiPort"
+#define SLV2_PORT_CLASS_OSC "http://drobilla.net/ns/lv2ext/osc/0#OSCPort"
+#define SLV2_PORT_CLASS_EVENT "http://lv2plug.in/ns/ext/event#EventPort"
+
+#if 0
/** (Data) Type of a port
*
* SLV2_PORT_DATA_TYPE_UNKNOWN means the Port is not of any type SLV2
@@ -43,6 +53,7 @@ typedef enum _SLV2PortDataType {
SLV2_PORT_DATA_TYPE_EVENT, /**< Generic event port */
} SLV2PortDataType;
+
/** Direction (input or output) of a port
*
* SLV2_UNKNOWN_PORT_DIRECTION means the Port is only of type lv2:Port
@@ -56,6 +67,7 @@ typedef enum _SLV2PortDirection {
SLV2_PORT_DIRECTION_INPUT, /**< Plugin reads from port when run */
SLV2_PORT_DIRECTION_OUTPUT, /**< Plugin writes to port when run */
} SLV2PortDirection;
+#endif
/** The format of a URI string.
diff --git a/slv2/value.h b/slv2/value.h
index 00cd39a..94a7f95 100644
--- a/slv2/value.h
+++ b/slv2/value.h
@@ -31,8 +31,12 @@ extern "C" {
*/
-/*SLV2Value
-slv2_value_new_uri(const char* uri);*/
+/** Create a new URI value.
+ *
+ * Returned value must be freed by called with slv2_value_free.
+ */
+SLV2Value
+slv2_value_new_uri(SLV2World world, const char* uri);
/** Free an SLV2Value.