Browse Source

Fix polyphony issues in SequentialSwitch.

tags/v1.3.0
Andrew Belt 4 years ago
parent
commit
3ad450c1e5
1 changed files with 6 additions and 13 deletions
  1. +6
    -13
      src/SequentialSwitch.cpp

+ 6
- 13
src/SequentialSwitch.cpp View File

@@ -53,15 +53,12 @@ struct SequentialSwitch : Module {
index = 0;

// Use first input to get number of channels
int channels = inputs[IN_INPUTS + 0].getChannels();
int channels = std::max(inputs[IN_INPUTS + 0].getChannels(), 1);

if (INPUTS == 1) {
// <1, 4>
// Get input
float in[16];
for (int c = 0; c < channels; c++) {
in[c] = inputs[IN_INPUTS].getVoltage(c);
}
float* in = inputs[IN_INPUTS + 0].getVoltages();

// Set output
for (int i = 0; i < OUTPUTS; i++) {
@@ -70,13 +67,11 @@ struct SequentialSwitch : Module {
if (gain != 0.f) {
for (int c = 0; c < channels; c++) {
float out = in[c] * gain;
outputs[OUT_OUTPUTS + i].setVoltage(out);
outputs[OUT_OUTPUTS + i].setVoltage(out, c);
}
}
else {
for (int c = 0; c < channels; c++) {
outputs[OUT_OUTPUTS + i].setVoltage(0.f);
}
outputs[OUT_OUTPUTS + i].clearVoltages();
}
}
}
@@ -95,10 +90,8 @@ struct SequentialSwitch : Module {
}

// Set output
for (int c = 0; c < channels; c++) {
outputs[OUT_OUTPUTS].setVoltage(out[c], c);
}
outputs[OUT_OUTPUTS].setChannels(channels);
outputs[OUT_OUTPUTS + 0].setChannels(channels);
outputs[OUT_OUTPUTS + 0].writeVoltages(out);
}

// Set lights


Loading…
Cancel
Save