summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-02-20 02:55:56 +0000
committerDavid Robillard <d@drobilla.net>2007-02-20 02:55:56 +0000
commita90f8d58bacb8f93a7e0b5486e2e862e94203721 (patch)
tree76aea132d1ed3e6850e05aba383cd145b0f71a6b
parentb31e71c04bf37f91159fcd5d9ad567c4c21dfd04 (diff)
downloadingen-a90f8d58bacb8f93a7e0b5486e2e862e94203721.tar.gz
ingen-a90f8d58bacb8f93a7e0b5486e2e862e94203721.tar.bz2
ingen-a90f8d58bacb8f93a7e0b5486e2e862e94203721.zip
Updated Ingen for most recent SLV2 API.
Minor (unlikely) SLV2 bug fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@322 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/engine/LV2Node.cpp4
-rw-r--r--src/libs/engine/LV2Node.h4
-rw-r--r--src/libs/engine/NodeFactory.cpp25
-rw-r--r--src/libs/engine/Plugin.h15
4 files changed, 30 insertions, 18 deletions
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 3e88efc5..ebc6a72c 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -63,7 +63,7 @@ LV2Node::instantiate()
_ports = new Raul::Array<Port*>(num_ports);
- _instances = new SLV2Instance*[_poly];
+ _instances = new SLV2Instance[_poly];
size_t port_buffer_size = 0;
@@ -100,7 +100,7 @@ LV2Node::instantiate()
if (port_class == SLV2_CONTROL_INPUT || port_class == SLV2_AUDIO_INPUT) {
port = new InputPort<Sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
_ports->at(j) = port;
- } else if (port_class == SLV2_CONTROL_INPUT || port_class == SLV2_AUDIO_INPUT) {
+ } else if (port_class == SLV2_CONTROL_OUTPUT || port_class == SLV2_AUDIO_OUTPUT) {
port = new OutputPort<Sample>(this, port_name, j, _poly, DataType::FLOAT, port_buffer_size);
_ports->at(j) = port;
} else if (port_class == SLV2_MIDI_INPUT) {
diff --git a/src/libs/engine/LV2Node.h b/src/libs/engine/LV2Node.h
index cbb5886b..f0547161 100644
--- a/src/libs/engine/LV2Node.h
+++ b/src/libs/engine/LV2Node.h
@@ -55,8 +55,8 @@ public:
protected:
//void get_port_vals(ulong port_index, PortInfo* info);
- const SLV2Plugin* _lv2_plugin;
- SLV2Instance** _instances;
+ SLV2Plugin _lv2_plugin;
+ SLV2Instance* _instances;
};
diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp
index 3c5e655c..dd8d029d 100644
--- a/src/libs/engine/NodeFactory.cpp
+++ b/src/libs/engine/NodeFactory.cpp
@@ -58,6 +58,10 @@ namespace Ingen {
NodeFactory::NodeFactory()
: _has_loaded(false)
{
+#ifdef HAVE_SLV2
+ slv2_init();
+#endif
+
// Add builtin plugin types to _internal_plugins list
// FIXME: ewwww, definitely a better way to do this!
@@ -77,7 +81,6 @@ NodeFactory::NodeFactory()
_internal_plugins.push_back(new Plugin(n->plugin()));
delete n;
-
delete parent;
}
@@ -91,6 +94,10 @@ NodeFactory::~NodeFactory()
(*i)->close();
delete (*i);
}
+#ifdef HAVE_SLV2
+ slv2_finish();
+#endif
+
}
@@ -259,16 +266,14 @@ NodeFactory::load_internal_plugin(const string& uri,
void
NodeFactory::load_lv2_plugins()
{
- slv2_init();
+ SLV2Plugins plugins = slv2_plugins_new();
+ slv2_plugins_load_all(plugins);
- SLV2List plugins = slv2_list_new();
- slv2_list_load_all(plugins);
-
- //cerr << "[NodeFactory] Found " << slv2_list_get_length(plugins) << " LV2 plugins." << endl;
+ //cerr << "[NodeFactory] Found " << slv2_plugins_get_length(plugins) << " LV2 plugins." << endl;
- for (unsigned long i=0; i < slv2_list_get_length(plugins); ++i) {
+ for (unsigned i=0; i < slv2_plugins_size(plugins); ++i) {
- SLV2Plugin* lv2_plug = slv2_list_get_plugin_by_index(plugins, i);
+ SLV2Plugin lv2_plug = slv2_plugins_get_at(plugins, i);
//om_plug->library(plugin_library);
@@ -301,9 +306,7 @@ NodeFactory::load_lv2_plugins()
}
}
- slv2_list_free(plugins);
-
- slv2_finish();
+ slv2_plugins_free(plugins);
}
diff --git a/src/libs/engine/Plugin.h b/src/libs/engine/Plugin.h
index 7e4921aa..d1a72fac 100644
--- a/src/libs/engine/Plugin.h
+++ b/src/libs/engine/Plugin.h
@@ -69,6 +69,15 @@ public:
#endif
}
+#ifdef HAVE_SLV2
+ ~Plugin()
+ {
+ if (_slv2_plugin)
+ slv2_plugin_free(_slv2_plugin);
+ }
+#endif
+
+
Plugin(const Plugin* const copy) {
// Copying only allowed for Internal plugins. Bit of a hack, but
// allows the PluginInfo to be defined in the Node class which keeps
@@ -126,8 +135,8 @@ public:
// FIXME: ew
#ifdef HAVE_SLV2
- SLV2Plugin* slv2_plugin() const { return _slv2_plugin; }
- void slv2_plugin(const SLV2Plugin* p) { _slv2_plugin = p; }
+ SLV2Plugin slv2_plugin() const { return _slv2_plugin; }
+ void slv2_plugin(const SLV2Plugin p) { _slv2_plugin = slv2_plugin_duplicate(p); }
#endif
@@ -145,7 +154,7 @@ private:
PluginLibrary* _library;
#ifdef HAVE_SLV2
- SLV2Plugin* _slv2_plugin;
+ SLV2Plugin _slv2_plugin;
#endif
};