Browse Source

Clear voltages of higher channels when a Cable copies from Output to Input.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
2307845b94
1 changed files with 7 additions and 2 deletions
  1. +7
    -2
      src/engine/Engine.cpp

+ 7
- 2
src/engine/Engine.cpp View File

@@ -272,11 +272,16 @@ static void Cable_step(Cable *that) {
Output *output = &that->outputModule->outputs[that->outputId];
Input *input = &that->inputModule->inputs[that->inputId];
// Match number of polyphonic channels to output port
input->channels = output->channels;
int channels = output->channels;
input->channels = channels;
// Copy all voltages from output to input
for (int i = 0; i < PORT_MAX_CHANNELS; i++) {
for (int i = 0; i < channels; i++) {
input->voltages[i] = output->voltages[i];
}
// Clear all voltages of higher channels
for (int i = channels; i < PORT_MAX_CHANNELS; i++) {
input->voltages[i] = 0.f;
}
}

static void Engine_step(Engine *that) {


Loading…
Cancel
Save