diff options
author | David Robillard <d@drobilla.net> | 2010-01-04 20:59:01 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-01-04 20:59:01 +0000 |
commit | bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431 (patch) | |
tree | 39ca3cffc0e404fe33fac66663444d9e1a603b96 /src/engine/InputPort.cpp | |
parent | 29b77e922d7fd883795b04eadd528eca21a37a2f (diff) | |
download | ingen-bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431.tar.gz ingen-bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431.tar.bz2 ingen-bfca1f3a2739c1c0148b0641d3bdb8f4ea16b431.zip |
Remove redundant LV2EventBuffer class and merge with EventBuffer.
Refactor mixing from an in-place Buffer method (which doesn't work with EventBuffer) to a single function that takes an out of place destination and an array of sources.
Fix audio buffer mixing for control<->audio.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2333 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/InputPort.cpp')
-rw-r--r-- | src/engine/InputPort.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/engine/InputPort.cpp b/src/engine/InputPort.cpp index 484e8b53..b980f2e6 100644 --- a/src/engine/InputPort.cpp +++ b/src/engine/InputPort.cpp @@ -21,13 +21,14 @@ #include <cassert> #include "interface/Patch.hpp" #include "AudioBuffer.hpp" +#include "BufferFactory.hpp" #include "ConnectionImpl.hpp" #include "EventBuffer.hpp" #include "NodeImpl.hpp" #include "OutputPort.hpp" #include "ProcessContext.hpp" #include "ThreadManager.hpp" -#include "BufferFactory.hpp" +#include "mix.hpp" #include "util.hpp" using namespace std; @@ -198,13 +199,15 @@ InputPort::pre_process(Context& context) // Multiple connections, mix them all into our local buffers if (_connections.size() > 1) { for (uint32_t v = 0; v < _poly; ++v) { - // Copy first connection - buffer(v)->copy(context, _connections.front()->buffer(v).get()); - - // Mix in the rest - Connections::iterator c = _connections.begin(); - for (++c; c != _connections.end(); ++c) - buffer(v)->mix(context, (*c)->buffer(v).get()); + const uint32_t num_srcs = _connections.size(); + Connections::iterator c = _connections.begin(); + Buffer* srcs[num_srcs]; + for (uint32_t i = 0; c != _connections.end(); ++c) { + assert(i < num_srcs); + srcs[i++] = (*c)->buffer(v).get(); + } + + mix(context, buffer(v).get(), srcs, num_srcs); } } |