From 4326f8ba71f4af1f3e3c48c9f3a02d8e3e0590f7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 15 Jan 2015 19:49:29 +0000 Subject: Node bypass. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5515 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/BlockImpl.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/server/BlockImpl.cpp') diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp index 069ecdfa..3d684e6c 100644 --- a/src/server/BlockImpl.cpp +++ b/src/server/BlockImpl.cpp @@ -45,6 +45,7 @@ BlockImpl::BlockImpl(PluginImpl* plugin, , _polyphony((polyphonic && parent) ? parent->internal_poly() : 1) , _polyphonic(polyphonic) , _activated(false) + , _enabled(true) , _traversed(false) { assert(_plugin); @@ -144,6 +145,21 @@ BlockImpl::set_buffer_size(Context& context, } } +PortImpl* +BlockImpl::nth_port_by_type(uint32_t n, bool input, PortType type) +{ + uint32_t count = 0; + for (uint32_t i = 0; _ports && i < _ports->size(); ++i) { + PortImpl* const port = _ports->at(i); + if (port->is_input() == input && port->type() == type) { + if (count++ == n) { + return port; + } + } + } + return NULL; +} + void BlockImpl::pre_process(ProcessContext& context) { @@ -160,6 +176,24 @@ BlockImpl::process(ProcessContext& context) { pre_process(context); + if (!_enabled) { + 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))) { + for (uint32_t v = 0; v < _polyphony; ++v) { + out->buffer(v)->copy(context, in->buffer(v).get()); + } + } else { + break; + } + } + } + post_process(context); + return; + } + ProcessContext subcontext(context); for (SampleCount offset = 0; offset < context.nframes();) { // Find earliest offset of a value change -- cgit v1.2.1