commit 38b64f00838e2fced58fb964fce9e3101abcc1e7
parent b5521a1a509d51199602ccbcc2d9db6a6bd359a7
Author: Matt Demanett <matt@demanett.net>
Date: Mon, 24 Aug 2020 18:05:34 -0400
S&H: fix the top-to-bottom-section normalling of GATE to apply to polyphony channels. #138
Diffstat:
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/README-prerelease.md b/README-prerelease.md
@@ -743,7 +743,7 @@ Each channel may also be have its output inverted with the INV button.
The GATE input on the lower section is normalled to GATE in the top section (but a press on the top button does not trigger the lower section).
-_Polyphony:_ <a href="#polyphony">Polyphonic</a>, with polyphony defined by the GATE input, independently on the top and bottom sections of the module. The polyphony port can be changed to IN on the context menu (this applies to both top and bottom sections of the module).
+_Polyphony:_ <a href="#polyphony">Polyphonic</a>, with polyphony defined by the GATE input in each section. If the bottom GATE is patched, the two sections will independently take their channels from their respective GATE inputs; if only the top GATE is patched, the bottom section normals to the top input and both sections have the same number of channels. The polyphony port can be changed to IN on the context menu (this change applies to both top and bottom sections of the module; IN does not normal to the bottom section, and both sections will set their channels independently, from whatever is patched to their own IN).
#### <a name="walk2"></a> WALK2
diff --git a/src/SampleHold.cpp b/src/SampleHold.cpp
@@ -81,8 +81,18 @@ void SampleHold::handleChannel(
float* value,
Output& out
) {
- int n = std::max(1, _polyInputID == IN1_INPUT ? in.getChannels() : triggerInput.getChannels());
+ int n = 0;
+ if (_polyInputID == IN1_INPUT) {
+ n = in.getChannels();
+ }
+ else if (triggerInput.isConnected()) {
+ n = triggerInput.getChannels();
+ } else if (altTriggerInput) {
+ n = altTriggerInput->getChannels();
+ }
+ n = std::max(1, n);
out.setChannels(n);
+
for (int i = 0; i < n; ++i) {
float triggerIn = 0.0f;
if (triggerInput.isConnected()) {