From 59630bf52e0a9f599e5aaf904d157e672935cf0b Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 1 Feb 2019 09:19:20 -0500 Subject: [PATCH] Remove unnecessary resetting of output channels in engine module step function. --- src/app/CableWidget.cpp | 8 ++++---- src/engine/Engine.cpp | 13 +------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/app/CableWidget.cpp b/src/app/CableWidget.cpp index 30b96e01..f7ee94fd 100644 --- a/src/app/CableWidget.cpp +++ b/src/app/CableWidget.cpp @@ -212,17 +212,17 @@ void CableWidget::draw(const widget::DrawContext &ctx) { float thickness = 5; if (isComplete()) { - Input *input = &cable->inputModule->inputs[cable->inputId]; + Output *output = &cable->outputModule->outputs[cable->outputId]; // Draw opaque if mouse is hovering over a connected port - if (input->channels > 1) { - // Increase thickness if input port is polyphonic + if (output->channels > 1) { + // Increase thickness if output port is polyphonic thickness = 8; } if (outputPort->hovered || inputPort->hovered) { opacity = 1.0; } - else if (input->channels == 0) { + else if (output->channels == 0) { // Draw translucent cable if not active (i.e. 0 channels) opacity *= 0.25; } diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp index e255ed73..8e4739fe 100644 --- a/src/engine/Engine.cpp +++ b/src/engine/Engine.cpp @@ -212,11 +212,6 @@ static void Engine_stepModules(Engine *engine, int id) { for (int i = id; i < modulesLen; i += threadCount) { Module *module = internal->modules[i]; if (!module->bypass) { - for (Output &output : module->outputs) { - // Reset output channels without clearing channel voltages - output.channels = 1; - } - // Step module if (settings::powerMeter) { auto startTime = std::chrono::high_resolution_clock::now(); @@ -233,11 +228,6 @@ static void Engine_stepModules(Engine *engine, int id) { module->step(); } } - else { - for (Output &output : module->outputs) { - output.setChannels(0); - } - } // Iterate ports and step plug lights for (Input &input : module->inputs) { @@ -461,8 +451,7 @@ void Engine::bypassModule(Module *module, bool bypass) { else { // Set all outputs to 1 channel for (Output &output : module->outputs) { - // Don't use Port::setChannels() so we maintain all previous voltages - output.channels = 1; + output.setChannels(1); } } module->bypass = bypass;