Browse Source

Remove unnecessary resetting of output channels in engine module step function.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
59630bf52e
2 changed files with 5 additions and 16 deletions
  1. +4
    -4
      src/app/CableWidget.cpp
  2. +1
    -12
      src/engine/Engine.cpp

+ 4
- 4
src/app/CableWidget.cpp View File

@@ -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;
}


+ 1
- 12
src/engine/Engine.cpp View File

@@ -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;


Loading…
Cancel
Save