summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/LV2Node.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-20 20:54:31 +0000
committerDavid Robillard <d@drobilla.net>2007-09-20 20:54:31 +0000
commit615ceaaf519d0c42a9215c4835e1f7348f2e5dca (patch)
tree79093453605d8a1b2ff97dc07cff14324bc14f06 /src/libs/engine/LV2Node.cpp
parenta4625db3f26716fb7a34614c76582ab92b5212e8 (diff)
downloadingen-615ceaaf519d0c42a9215c4835e1f7348f2e5dca.tar.gz
ingen-615ceaaf519d0c42a9215c4835e1f7348f2e5dca.tar.bz2
ingen-615ceaaf519d0c42a9215c4835e1f7348f2e5dca.zip
Remove useless InternalNode class.
Percolate boolean polyphony down through Node class heirarchy (instead of integer). git-svn-id: http://svn.drobilla.net/lad/ingen@742 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/LV2Node.cpp')
-rw-r--r--src/libs/engine/LV2Node.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index 146bc4bf..6d66f332 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -39,15 +39,14 @@ namespace Ingen {
*/
LV2Node::LV2Node(const Plugin* plugin,
const string& name,
- uint32_t poly,
+ bool polyphonic,
Patch* parent,
SampleRate srate,
size_t buffer_size)
- : NodeBase(plugin, name, poly, parent, srate, buffer_size)
+ : NodeBase(plugin, name, polyphonic, parent, srate, buffer_size)
, _lv2_plugin(plugin->slv2_plugin())
, _instances(NULL)
, _prepared_instances(NULL)
- , _prepared_poly(poly)
{
assert(_lv2_plugin);
}
@@ -56,14 +55,16 @@ LV2Node::LV2Node(const Plugin* plugin,
bool
LV2Node::prepare_poly(uint32_t poly)
{
+ if (!_polyphonic)
+ return true;
+
NodeBase::prepare_poly(poly);
- if (poly <= _prepared_poly)
+ if (poly <= _prepared_instances->size())
return true;
- _prepared_poly = poly;
- _prepared_instances = new Raul::Array<SLV2Instance>(_prepared_poly, *_instances);
- for (uint32_t i = _polyphony; i < _prepared_poly; ++i) {
+ _prepared_instances = new Raul::Array<SLV2Instance>(poly, *_instances);
+ for (uint32_t i = _polyphony; i < _prepared_instances->size(); ++i) {
_prepared_instances->at(i) = slv2_plugin_instantiate(_lv2_plugin, _srate, NULL);
if ((*_prepared_instances)[i] == NULL) {
cerr << "Failed to instantiate plugin!" << endl;
@@ -81,7 +82,10 @@ LV2Node::prepare_poly(uint32_t poly)
bool
LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly)
{
- assert(poly <= _prepared_poly);
+ if (!_polyphonic)
+ return true;
+
+ assert(poly <= _prepared_instances->size());
NodeBase::apply_poly(maid, poly);
@@ -90,13 +94,14 @@ LV2Node::apply_poly(Raul::Maid& maid, uint32_t poly)
_instances = _prepared_instances;
for (uint32_t port=0; port < num_ports(); ++port)
- for (uint32_t voice = _polyphony; voice < _prepared_poly; ++voice)
+ for (uint32_t voice = _polyphony; voice < _prepared_instances->size(); ++voice)
slv2_instance_connect_port((*_instances)[voice], port,
_ports->at(port)->buffer(voice)->raw_data());
+
+ _prepared_instances = NULL;
}
_polyphony = poly;
- _prepared_instances = NULL;
return true;
}