summaryrefslogtreecommitdiffstats
path: root/src/server/BlockImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/BlockImpl.cpp')
-rw-r--r--src/server/BlockImpl.cpp61
1 files changed, 36 insertions, 25 deletions
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp
index bdcf1500..3b051fd4 100644
--- a/src/server/BlockImpl.cpp
+++ b/src/server/BlockImpl.cpp
@@ -185,37 +185,48 @@ BlockImpl::pre_process(RunContext& context)
}
void
-BlockImpl::process(RunContext& context)
+BlockImpl::bypass(RunContext& context)
{
- pre_process(context);
+ if (!_ports) {
+ return;
+ }
- if (!_enabled) {
- // Prepare port buffers for reading, converting/mixing if necessary
- for (uint32_t i = 0; _ports && i < _ports->size(); ++i) {
- _ports->at(i)->connect_buffers();
- _ports->at(i)->pre_run(context);
- }
+ // Prepare port buffers for reading, converting/mixing if necessary
+ for (uint32_t i = 0; i < _ports->size(); ++i) {
+ _ports->at(i)->connect_buffers();
+ _ports->at(i)->pre_run(context);
+ }
- // 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 = 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 {
- // Output but no corresponding input, clear
- for (uint32_t v = 0; v < _polyphony; ++v) {
- out->buffer(v)->clear();
- }
+ // 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 = 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 {
+ // Output but no corresponding input, clear
+ for (uint32_t v = 0; v < _polyphony; ++v) {
+ out->buffer(v)->clear();
}
}
}
+ }
+ post_process(context);
+}
+
+void
+BlockImpl::process(RunContext& context)
+{
+ pre_process(context);
+
+ if (!_enabled) {
+ bypass(context);
post_process(context);
return;
}