summaryrefslogtreecommitdiffstats
path: root/src/server/BlockImpl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-01-15 19:49:29 +0000
committerDavid Robillard <d@drobilla.net>2015-01-15 19:49:29 +0000
commit4326f8ba71f4af1f3e3c48c9f3a02d8e3e0590f7 (patch)
tree15d37aa76d390385e847fad8160bd22df52dfe2c /src/server/BlockImpl.cpp
parent81df927a7faa49fd7057276df6dc67e386ca565c (diff)
downloadingen-4326f8ba71f4af1f3e3c48c9f3a02d8e3e0590f7.tar.gz
ingen-4326f8ba71f4af1f3e3c48c9f3a02d8e3e0590f7.tar.bz2
ingen-4326f8ba71f4af1f3e3c48c9f3a02d8e3e0590f7.zip
Node bypass.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5515 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/BlockImpl.cpp')
-rw-r--r--src/server/BlockImpl.cpp34
1 files changed, 34 insertions, 0 deletions
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