summaryrefslogtreecommitdiffstats
path: root/src/engine/ConnectionImpl.cpp
diff options
context:
space:
mode:
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);
+ }
}