From 2fd281a285e4b0bc31e0a0dc6f970359440612c8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Sep 2007 00:46:21 +0000 Subject: Somewhat functional dynamic polyphony (LV2 and internal nodes only). git-svn-id: http://svn.drobilla.net/lad/ingen@744 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/Port.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/libs/engine/Port.cpp') diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp index bcf47e90..30ee73f2 100644 --- a/src/libs/engine/Port.cpp +++ b/src/libs/engine/Port.cpp @@ -31,7 +31,7 @@ const char* const DataType::type_uris[4] = { "UNKNOWN", "FLOAT", "MIDI", "OSC" } Port::Port(Node* const node, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size) - : GraphObject(node, name) + : GraphObject(node, name, true) , _index(index) , _poly(poly) , _type(type) @@ -45,6 +45,9 @@ Port::Port(Node* const node, const string& name, uint32_t index, uint32_t poly, allocate_buffers(); clear_buffers(); + if (node->parent() == NULL) + _polyphonic = false; + assert(_buffers->size() > 0); } @@ -61,6 +64,9 @@ Port::~Port() bool Port::prepare_poly(uint32_t poly) { + if (!_polyphonic || !_parent->polyphonic()) + return true; + /* FIXME: poly never goes down, harsh on memory.. */ if (poly > _poly) { _prepared_buffers = new Raul::Array(poly, *_buffers); @@ -76,6 +82,9 @@ Port::prepare_poly(uint32_t poly) bool Port::apply_poly(Raul::Maid& maid, uint32_t poly) { + if (!_polyphonic || !_parent->polyphonic()) + return true; + assert(poly <= _prepared_poly); // Apply a new set of buffers from a preceding call to prepare_poly @@ -86,6 +95,8 @@ Port::apply_poly(Raul::Maid& maid, uint32_t poly) _poly = poly; + connect_buffers(); + return true; } -- cgit v1.2.1