summaryrefslogtreecommitdiffstats
path: root/src/engine/ConnectionImpl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-10-13 01:59:53 +0000
committerDavid Robillard <d@drobilla.net>2008-10-13 01:59:53 +0000
commitb2d51e16571190becea1476080cff1b0a258a4f6 (patch)
tree14fc29ec1408a43b3a9688cc09aec8733f3d3d54 /src/engine/ConnectionImpl.cpp
parentef8f39fedbd51f414f19d1282b21ea4de46cf449 (diff)
downloadingen-b2d51e16571190becea1476080cff1b0a258a4f6.tar.gz
ingen-b2d51e16571190becea1476080cff1b0a258a4f6.tar.bz2
ingen-b2d51e16571190becea1476080cff1b0a258a4f6.zip
Fix various problems with subpatch connecting/disconnecting (and probably introduce new ones).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1668 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/ConnectionImpl.cpp')
-rw-r--r--src/engine/ConnectionImpl.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index 64d51edf..53cef102 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -72,7 +72,9 @@ ConnectionImpl::~ConnectionImpl()
void
ConnectionImpl::set_mode()
{
- if (must_mix())
+ if (must_copy())
+ _mode = COPY;
+ else if (must_mix())
_mode = MIX;
else if (must_extend())
_mode = EXTEND;
@@ -97,13 +99,18 @@ ConnectionImpl::set_buffer_size(size_t size)
bool
-ConnectionImpl::must_mix() const
+ConnectionImpl::must_copy() const
{
- bool mix = ( /*(_src_port->poly() != _dst_port->poly())
- ||*/ (_src_port->polyphonic() && !_dst_port->polyphonic())
- || (_src_port->parent()->polyphonic() && !_dst_port->parent()->polyphonic()) );
+ return (_dst_port->fixed_buffers() && (_src_port->poly() == _dst_port->poly()));
+}
- return mix;
+
+bool
+ConnectionImpl::must_mix() const
+{
+ return ( (_src_port->polyphonic() && !_dst_port->polyphonic())
+ || (_src_port->parent()->polyphonic() && !_dst_port->parent()->polyphonic())
+ || (_dst_port->fixed_buffers()) );
}
@@ -164,7 +171,13 @@ ConnectionImpl::process(ProcessContext& context)
<< " -> " << dst_port()->path() << " * " << dst_port()->poly()
<< "\t\tmode: " << (int)_mode << endl;*/
- if (_mode == MIX) {
+ if (_mode == COPY) {
+ assert(src_port()->poly() == dst_port()->poly());
+ const size_t copy_size = std::min(src_port()->buffer_size(), dst_port()->buffer_size());
+ for (uint32_t i=0; i < src_port()->poly(); ++i) {
+ dst_port()->buffer(i)->copy(src_port()->buffer(i), 0, copy_size);
+ }
+ } else if (_mode == MIX) {
assert(type() == DataType::AUDIO || type() == DataType::CONTROL);
const AudioBuffer* const src_buffer = (AudioBuffer*)src_port()->buffer(0);