summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-10-11 17:48:37 +0000
committerDavid Robillard <d@drobilla.net>2008-10-11 17:48:37 +0000
commit3e8901c2edc5fa4b670cd3d0c1096bf73b03a96c (patch)
treef1bdd48926d29d607b36584f5a8c0daac59f6020 /src
parent2ca16790ea78cdfb8d558878dd4cadd8821d8ecc (diff)
downloadingen-3e8901c2edc5fa4b670cd3d0c1096bf73b03a96c.tar.gz
ingen-3e8901c2edc5fa4b670cd3d0c1096bf73b03a96c.tar.bz2
ingen-3e8901c2edc5fa4b670cd3d0c1096bf73b03a96c.zip
Fix 'extending' logic (control->audio connections) to deal with varying poly (where possible).
Fix ticket #232 for real this time. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1638 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/ConnectionImpl.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/engine/ConnectionImpl.cpp b/src/engine/ConnectionImpl.cpp
index 2e8e1d25..af71dd8a 100644
--- a/src/engine/ConnectionImpl.cpp
+++ b/src/engine/ConnectionImpl.cpp
@@ -202,16 +202,16 @@ ConnectionImpl::process(ProcessContext& context)
} else if (_mode == EXTEND) {
assert(type() == DataType::AUDIO || type() == DataType::CONTROL);
- assert(src_port()->poly() == dst_port()->poly()); // otherwise we should be mixing
+ assert(src_port()->poly() == 1 || src_port()->poly() == dst_port()->poly());
- const size_t poly = src_port()->poly();
+ const uint32_t poly = dst_port()->poly();
+ const uint32_t copy_size = std::min(src_port()->buffer(0)->size(),
+ dst_port()->buffer(0)->size());
- const size_t copy_size = std::min(src_port()->buffer(0)->size(),
- dst_port()->buffer(0)->size());
-
- for (size_t i = 0; i < poly; ++i) {
- AudioBuffer* src_buf = (AudioBuffer*)src_port()->buffer(0);
- AudioBuffer* dst_buf = (AudioBuffer*)dst_port()->buffer(0);
+ for (uint32_t i = 0; i < poly; ++i) {
+ uint32_t src_voice = std::min(i, src_port()->poly() - 1);
+ AudioBuffer* src_buf = (AudioBuffer*)src_port()->buffer(src_voice);
+ AudioBuffer* dst_buf = (AudioBuffer*)dst_port()->buffer(i);
// Copy src to start of dst
dst_buf->copy(src_buf, 0, copy_size-1);