From e43b05b410d8dddcacbcbbdf34c3679ae3bc983a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 18 Jun 2006 18:13:51 +0000 Subject: Commit to allow move (broken revision) git-svn-id: http://svn.drobilla.net/lad/grauph@54 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/LV2Plugin.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/libs/engine') diff --git a/src/libs/engine/LV2Plugin.cpp b/src/libs/engine/LV2Plugin.cpp index 660bf962..411caa36 100644 --- a/src/libs/engine/LV2Plugin.cpp +++ b/src/libs/engine/LV2Plugin.cpp @@ -43,10 +43,6 @@ LV2Plugin::LV2Plugin(const string& name, _instances(NULL) { assert(_lv2_plugin); - - // Note that this may be changed by an overriding DSSIPlugin - // ie do not assume _ports is all LV2 plugin ports - _num_ports = slv2_plugin_get_num_ports(_lv2_plugin); } @@ -61,7 +57,9 @@ LV2Plugin::LV2Plugin(const string& name, bool LV2Plugin::instantiate() { - _ports->alloc(_num_ports); + size_t num_ports = slv2_plugin_get_num_ports(_lv2_plugin); + assert(num_ports > 0); + _ports->alloc(num_ports); _instances = new SLV2Instance*[_poly]; @@ -80,7 +78,7 @@ LV2Plugin::instantiate() Port* port = NULL; - for (size_t j=0; j < _num_ports; ++j) { + for (size_t j=0; j < num_ports; ++j) { // LV2 shortnames are guaranteed to be unique, valid C identifiers port_name = (char*)slv2_port_get_symbol(_lv2_plugin, j); @@ -141,7 +139,7 @@ LV2Plugin::activate() PortBase* port = NULL; for (size_t i=0; i < _poly; ++i) { - for (unsigned long j=0; j < _num_ports; ++j) { + for (unsigned long j=0; j < num_ports(); ++j) { port = static_cast*>(_ports->at(j)); set_port_buffer(i, j, ((PortBase*)_ports->at(j))->buffer(i)->data()); if (port->type() == DataType::FLOAT && port->buffer_size() == 1) @@ -179,7 +177,7 @@ LV2Plugin::set_port_buffer(size_t voice, size_t port_num, void* buf) assert(voice < _poly); // Could be a MIDI port after this - if (port_num < _num_ports) { + if (port_num < num_ports()) { slv2_instance_connect_port(_instances[voice], port_num, buf); } } -- cgit v1.2.1