summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-07-16 17:22:52 +0000
committerDavid Robillard <d@drobilla.net>2015-07-16 17:22:52 +0000
commit21064b41624572e7a01b5ab2e52eee28fe7ec93e (patch)
treec8d8bf286b35cea19d1b792f0f91b65f5ba1cc28 /src
parentaf665803f64b8e4ce7e7c184beb1f33e17c3595f (diff)
downloadingen-21064b41624572e7a01b5ab2e52eee28fe7ec93e.tar.gz
ingen-21064b41624572e7a01b5ab2e52eee28fe7ec93e.tar.bz2
ingen-21064b41624572e7a01b5ab2e52eee28fe7ec93e.zip
Clear extra output buffers when bypassing blocks.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5695 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/BlockImpl.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp
index e61dea5f..ecc73090 100644
--- a/src/server/BlockImpl.cpp
+++ b/src/server/BlockImpl.cpp
@@ -188,16 +188,23 @@ BlockImpl::process(ProcessContext& context)
pre_process(context);
if (!_enabled) {
+ // Dumb bypass
for (PortType t : { PortType::AUDIO, PortType::CV, PortType::ATOM }) {
for (uint32_t i = 0;; ++i) {
- PortImpl* in = nth_port_by_type(i, true, t);
- PortImpl* out;
- if (in && (out = nth_port_by_type(i, false, t))) {
+ PortImpl* in = nth_port_by_type(i, true, t);
+ PortImpl* out = nth_port_by_type(i, false, t);
+ if (!out) {
+ break; // Finished writing all outputs
+ } else if (in) {
+ // Copy corresponding input to output
for (uint32_t v = 0; v < _polyphony; ++v) {
out->buffer(v)->copy(context, in->buffer(v).get());
}
} else {
- break;
+ // Output but no corresponding input, clear
+ for (uint32_t v = 0; v < _polyphony; ++v) {
+ out->buffer(v)->clear();
+ }
}
}
}