summaryrefslogtreecommitdiffstats
path: root/slv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-19 16:49:25 +0000
committerDavid Robillard <d@drobilla.net>2007-04-19 16:49:25 +0000
commit98ea88b5fd404ff4ba43709f731ba074f291eb5b (patch)
tree1318604ebfedd677ac8f6cbad3f9d58e5922a1c4 /slv2
parent6626f77037747855e7dcec64697d436c4300d7c2 (diff)
downloadlilv-98ea88b5fd404ff4ba43709f731ba074f291eb5b.tar.gz
lilv-98ea88b5fd404ff4ba43709f731ba074f291eb5b.tar.bz2
lilv-98ea88b5fd404ff4ba43709f731ba074f291eb5b.zip
Added Redland dependency, using in-memory RDF models.
Numerous significant performance improvements. git-svn-id: http://svn.drobilla.net/lad/slv2@457 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'slv2')
-rw-r--r--slv2/Makefile.am7
-rw-r--r--slv2/library.h48
-rw-r--r--slv2/plugin.h40
-rw-r--r--slv2/pluginlist.h80
-rw-r--r--slv2/port.h35
-rw-r--r--slv2/slv2.h7
-rw-r--r--slv2/types.h16
7 files changed, 69 insertions, 164 deletions
diff --git a/slv2/Makefile.am b/slv2/Makefile.am
index 0a90fb1..2c69aef 100644
--- a/slv2/Makefile.am
+++ b/slv2/Makefile.am
@@ -4,10 +4,11 @@ slv2include_HEADERS = \
lv2.h \
types.h \
slv2.h \
- library.h \
+ model.h \
plugin.h \
port.h \
pluginlist.h \
plugininstance.h \
- util.h \
- stringlist.h
+ stringlist.h \
+ util.h
+
diff --git a/slv2/library.h b/slv2/library.h
deleted file mode 100644
index c3d68ca..0000000
--- a/slv2/library.h
+++ /dev/null
@@ -1,48 +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_LIBRARY_H
-#define __SLV2_LIBRARY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/** Initialize SLV2.
- *
- * This MUST be called before calling any other SLV2 functions, or fatal
- * errors will likely occur.
- */
-void
-slv2_init();
-
-
-/** Finialize SLV2.
- *
- * Frees any resources allocated by slv2_init().
- */
-void
-slv2_finish();
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __SLV2_LIBRARY_H */
diff --git a/slv2/plugin.h b/slv2/plugin.h
index 77a0f61..7b8d62b 100644
--- a/slv2/plugin.h
+++ b/slv2/plugin.h
@@ -26,17 +26,18 @@ extern "C" {
#include <stdint.h>
#include <stdbool.h>
#include <slv2/types.h>
+#include <slv2/port.h>
#include <slv2/stringlist.h>
-
-typedef struct _Plugin* SLV2Plugin;
-
-
-/** \defgroup data Data file access
+/** \defgroup data Plugin data access
*
* These functions work exclusively with the plugin's RDF data file.
* They do not load or access the plugin dynamic library in any way.
*
+ * An SLV2Plugin is a weak reference (ie URIs) to an LV2 plugin in the
+ * Model. Most functions which operate on an SLV2Plugin actually query
+ * the data in the model.
+ *
* @{
*/
@@ -162,8 +163,8 @@ slv2_plugin_get_value(SLV2Plugin p,
*/
SLV2Strings
slv2_plugin_get_value_for_subject(SLV2Plugin p,
- const char* subject,
- const char* predicate);
+ const char* subject,
+ const char* predicate);
/** Get the LV2 Properties of a plugin.
@@ -266,6 +267,31 @@ slv2_plugin_query_count(SLV2Plugin plugin,
const char* sparql_str);
+/** Get a port on this plugin by \a index.
+ *
+ * To perform multiple calls on a port, the returned value should
+ * be cached and used repeatedly.
+ *
+ * O(1)
+ */
+SLV2Port
+slv2_plugin_get_port_by_index(SLV2Plugin plugin,
+ uint32_t index);
+
+
+/** Get a port on this plugin by \a symbol.
+ *
+ * To perform multiple calls on a port, the returned value should
+ * be cached and used repeatedly.
+ *
+ * O(num_ports)
+ */
+SLV2Port
+slv2_plugin_get_port_by_symbol(SLV2Plugin plugin,
+ const char* symbol);
+
+
+
/** @} */
#ifdef __cplusplus
diff --git a/slv2/pluginlist.h b/slv2/pluginlist.h
index c1f1d04..c0c1b4d 100644
--- a/slv2/pluginlist.h
+++ b/slv2/pluginlist.h
@@ -19,6 +19,8 @@
#ifndef __SLV2_PLUGINLIST_H__
#define __SLV2_PLUGINLIST_H__
+#include <slv2/plugin.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -27,18 +29,11 @@ extern "C" {
typedef void* SLV2Plugins;
-/** \defgroup plugins Discovery and lists of plugins
- *
- * These functions are for locating plugins installed on the system.
- *
- * Normal hosts which just want to easily load plugins by URI are strongly
- * recommended to simply find all installed plugins with
- * \ref slv2_plugins_load_all rather than find and load bundles manually.
+/** \defgroup plugins Plugin lists
*
- * Functions are provided for hosts that wish to access bundles explicitly and
- * individually for some reason, as well as make custom lists of plugins from
- * a selection of bundles. This is mostly intended for hosts which are
- * tied to a specific (bundled with the application) bundle.
+ * These functions work with lists of plugins which come from an
+ * SLV2Model. These lists contain only a weak reference to an LV2 plugin
+ * in the Model.
*
* @{
*/
@@ -67,62 +62,6 @@ void
slv2_plugins_free(SLV2Plugins list);
-/** Filter plugins from one list into another.
- *
- * All plugins in \a source that return true when passed to \a include
- * (a pointer to a function that takes an SLV2Plugin and returns a bool)
- * will be added to \a dest. Plugins are duplicated into \a dest, it is safe
- * to destroy \a source and continue to use \a dest after this call.
- */
-void
-slv2_plugins_filter(SLV2Plugins dest,
- SLV2Plugins source,
- bool (*include)(SLV2Plugin));
-
-
-/** Add all plugins installed on the system to \a list.
- *
- * This is the recommended way for hosts to access plugins. It does the most
- * reasonable thing to find all installed plugins on a system. The environment
- * variable LV2_PATH may be set to control the locations this function will
- * look for plugins.
- *
- * Use of any functions for locating plugins other than this one is \em highly
- * discouraged without a special reason to do so (and is just more work for the
- * host author) - use this one.
- */
-void
-slv2_plugins_load_all(SLV2Plugins list);
-
-
-/** Add all plugins found in \a search_path to \a list.
- *
- * If \a search_path is NULL, \a list will be unmodified.
- *
- * Use of this function is \b not recommended. Use \ref slv2_plugins_load_all.
- */
-void
-slv2_plugins_load_path(SLV2Plugins list,
- const char* search_path);
-
-
-/** Add all plugins found in the bundle at \a bundle_base_url to \a list.
- *
- * \arg bundle_base_url is a fully qualified path to the bundle directory, eg.
- * "file:///usr/lib/lv2/someBundle"
- *
- * Use of this function is \b strongly discouraged - hosts should not attach
- * \em any significance to bundle paths as there are no guarantees they will
- * remain consistent whatsoever. This function should only be used by apps
- * which ship with a special bundle (which it knows exists at some path).
- * It is \b not to be used by normal hosts that want to load system
- * installed plugins. Use \ref slv2_plugins_load_all for that.
- */
-void
-slv2_plugins_load_bundle(SLV2Plugins list,
- const char* bundle_base_uri);
-
-
/** Get the number of plugins in the list.
*/
unsigned
@@ -133,8 +72,8 @@ slv2_plugins_size(SLV2Plugins list);
*
* Return value is shared (stored in \a list) and must not be freed or
* modified by the caller in any way.
- * This functions is a search, slv2_plugins_get_at is
- * significantly faster.
+ *
+ * O(log2(n))
*
* \return NULL if plugin with \a url not found in \a list.
*/
@@ -153,12 +92,15 @@ slv2_plugins_get_by_uri(SLV2Plugins list,
* Return value is shared (stored in \a list) and must not be freed or
* modified by the caller in any way.
*
+ * O(1)
+ *
* \return NULL if \a index out of range.
*/
SLV2Plugin
slv2_plugins_get_at(SLV2Plugins list,
unsigned index);
+
/** @} */
#ifdef __cplusplus
diff --git a/slv2/port.h b/slv2/port.h
index 546a713..13ac5c1 100644
--- a/slv2/port.h
+++ b/slv2/port.h
@@ -25,6 +25,7 @@ extern "C" {
#include <slv2/types.h>
#include <slv2/plugin.h>
+#include <slv2/port.h>
#include <slv2/stringlist.h>
/** \addtogroup data
@@ -32,38 +33,26 @@ extern "C" {
*/
-/** Create an ID to reference a port by index.
- */
-SLV2PortID
-slv2_port_by_index(uint32_t index);
-
-
-/** Create an ID to reference a port by symbol.
- */
-SLV2PortID
-slv2_port_by_symbol(const char* symbol);
-
-
/** Port equivalent to slv2_plugin_get_value.
*/
SLV2Strings
slv2_port_get_value(SLV2Plugin plugin,
- SLV2PortID id,
+ SLV2Port port,
const char* property);
/** Port equivalent to slv2_plugin_get_properties.
*/
SLV2Strings
-slv2_port_get_properties(SLV2Plugin p,
- SLV2PortID id);
+slv2_port_get_properties(SLV2Plugin plugin,
+ SLV2Port port);
/** Port equivalent to slv2_plugin_get_hints.
*/
SLV2Strings
-slv2_port_get_hints(SLV2Plugin p,
- SLV2PortID id);
+slv2_port_get_hints(SLV2Plugin plugin,
+ SLV2Port port);
/** Get the symbol of a port given the index.
@@ -75,7 +64,7 @@ slv2_port_get_hints(SLV2Plugin p,
*/
char*
slv2_port_get_symbol(SLV2Plugin plugin,
- SLV2PortID id);
+ SLV2Port port);
/** Get the name of a port.
*
@@ -85,14 +74,14 @@ slv2_port_get_symbol(SLV2Plugin plugin,
*/
char*
slv2_port_get_name(SLV2Plugin plugin,
- SLV2PortID id);
+ SLV2Port port);
/** Get the class (input/output, data type, rate...) of a port.
*/
SLV2PortClass
slv2_port_get_class(SLV2Plugin plugin,
- SLV2PortID id);
+ SLV2Port port);
/** Get the default value of a port.
@@ -101,7 +90,7 @@ slv2_port_get_class(SLV2Plugin plugin,
*/
float
slv2_port_get_default_value(SLV2Plugin plugin,
- SLV2PortID id);
+ SLV2Port port);
/** Get the minimum value of a port.
@@ -110,7 +99,7 @@ slv2_port_get_default_value(SLV2Plugin plugin,
*/
float
slv2_port_get_minimum_value(SLV2Plugin plugin,
- SLV2PortID id);
+ SLV2Port port);
/** Get the maximum value of a port.
@@ -119,7 +108,7 @@ slv2_port_get_minimum_value(SLV2Plugin plugin,
*/
float
slv2_port_get_maximum_value(SLV2Plugin plugin,
- SLV2PortID id);
+ SLV2Port port);
/** @} */
diff --git a/slv2/slv2.h b/slv2/slv2.h
index 539ea47..8691e28 100644
--- a/slv2/slv2.h
+++ b/slv2/slv2.h
@@ -23,13 +23,14 @@
extern "C" {
#endif
-#include <slv2/library.h>
#include <slv2/types.h>
+#include <slv2/model.h>
#include <slv2/plugin.h>
-#include <slv2/plugininstance.h>
+#include <slv2/port.h>
#include <slv2/pluginlist.h>
+#include <slv2/plugininstance.h>
#include <slv2/stringlist.h>
-#include <slv2/port.h>
+
#ifdef __cplusplus
}
diff --git a/slv2/types.h b/slv2/types.h
index 03c84e7..da53069 100644
--- a/slv2/types.h
+++ b/slv2/types.h
@@ -27,17 +27,6 @@ extern "C" {
#endif
-
-/** Port ID type, to allow passing either symbol or index
- * to port related functions.
- */
-typedef struct _PortID {
- bool is_index; /**< Otherwise, symbol */
- uint32_t index;
- const char* symbol;
-} SLV2PortID;
-
-
/** Class (direction and type) of a port
*
* Note that ports may be of other classes not listed here, this is just
@@ -54,6 +43,11 @@ typedef enum _PortClass {
SLV2_MIDI_OUTPUT /**< MIDI output (LL extension) */
} SLV2PortClass;
+typedef struct _Port* SLV2Port;
+
+typedef struct _Plugin* SLV2Plugin;
+
+typedef struct _Model* SLV2Model;
#ifdef __cplusplus
}