summaryrefslogtreecommitdiffstats
path: root/src/engine/ConnectionImpl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-04 20:59:01 +0000
committerDavid Robillard <d@drobilla.net>2010-01-04 20:59:01 +0000
commitbfca1f3a2739c1c0148b0641d3bdb8f4ea16b431 (patch)
tree39ca3cffc0e404fe33fac66663444d9e1a603b96 /src/engine/ConnectionImpl.cpp
parent29b77e922d7fd883795b04eadd528eca21a37a2f (diff)
downloadingen-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/ConnectionImpl.cpp')
-rw-r--r--src/engine/ConnectionImpl.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index db71df70..b64875c2 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -17,7 +17,6 @@
#include <algorithm>
#include "raul/Maid.hpp"
-#include "util.hpp"
#include "AudioBuffer.hpp"
#include "BufferFactory.hpp"
#include "ConnectionImpl.hpp"
@@ -27,6 +26,8 @@
#include "MessageContext.hpp"
#include "PortImpl.hpp"
#include "ProcessContext.hpp"
+#include "mix.hpp"
+#include "util.hpp"
namespace Ingen {
@@ -52,6 +53,7 @@ ConnectionImpl::ConnectionImpl(BufferFactory& bufs, PortImpl* src_port, PortImpl
if (must_mix() || must_queue())
_local_buffer = bufs.get(dst_port->type(), dst_port->buffer_size());
+
if (must_queue())
_queue = new Raul::RingBuffer<LV2_Object>(src_port->buffer_size() * 2);
@@ -118,18 +120,15 @@ ConnectionImpl::process(Context& context)
_queue->full_peek(sizeof(LV2_Object), &obj);
_queue->full_read(sizeof(LV2_Object) + obj.size, local_buf->object());
}
- return;
- }
-
- if (!must_mix())
- return;
- // Copy the first voice
- _local_buffer->copy(context, src_port()->buffer(0).get());
+ } else if (must_mix()) {
+ const uint32_t num_srcs = src_port()->poly();
+ Buffer* srcs[num_srcs];
+ for (uint32_t v = 0; v < num_srcs; ++v)
+ srcs[v] = src_port()->buffer(v).get();
- // Mix in the rest
- for (uint32_t v = 0; v < src_port()->poly(); ++v)
- _local_buffer->mix(context, src_port()->buffer(v).get());
+ mix(context, _local_buffer.get(), srcs, num_srcs);
+ }
}