summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/Port.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-21 00:46:21 +0000
committerDavid Robillard <d@drobilla.net>2007-09-21 00:46:21 +0000
commit2fd281a285e4b0bc31e0a0dc6f970359440612c8 (patch)
treeb4537d5196d13608cacb32f4c96bdb24ff180b3d /src/libs/engine/Port.cpp
parentc4faafc0d3b9c68d41706ad40edde1ecfb7f4338 (diff)
downloadingen-2fd281a285e4b0bc31e0a0dc6f970359440612c8.tar.gz
ingen-2fd281a285e4b0bc31e0a0dc6f970359440612c8.tar.bz2
ingen-2fd281a285e4b0bc31e0a0dc6f970359440612c8.zip
Somewhat functional dynamic polyphony (LV2 and internal nodes only).
git-svn-id: http://svn.drobilla.net/lad/ingen@744 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/Port.cpp')
-rw-r--r--src/libs/engine/Port.cpp13
1 files changed, 12 insertions, 1 deletions
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<Buffer*>(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;
}