From 21064b41624572e7a01b5ab2e52eee28fe7ec93e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 16 Jul 2015 17:22:52 +0000 Subject: Clear extra output buffers when bypassing blocks. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5695 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/BlockImpl.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/server/BlockImpl.cpp') 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(); + } } } } -- cgit v1.2.1