Skip to content

Commit

Permalink
changed low/high/step cv in handling to just add to knob settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Stubs42 committed Oct 31, 2019
1 parent 80b10bd commit 3932a33
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions src/Fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,33 +553,17 @@ struct Fence : Module {
effectiveLow = getStateParam ( LOW_PARAM);
effectiveHigh = getStateParam (HIGH_PARAM);

if (link != LINK_CENTER_INT) {
if (getInputConnected (LOW_INPUT))
effectiveLow += getStateInput (LOW_INPUT);
else
if ((link == LINK_RANGE_INT) && getInputConnected (HIGH_INPUT)) {
effectiveLow += getStateInput (HIGH_INPUT);
}
if (getInputConnected (HIGH_INPUT))
effectiveHigh += getStateInput (HIGH_INPUT);
else
if ((link == LINK_RANGE_INT) && getInputConnected (LOW_INPUT)) {
effectiveHigh += getStateInput (LOW_INPUT);
}
}
else {
effectiveLow = clamp (effectiveLow, 0, maxLow);
if (getInputConnected (LOW_INPUT))
// left knob is attenuator if low cv in is connected
effectiveLow = getStateInput (LOW_INPUT) * (effectiveLow / maxLow);
if (getInputConnected (HIGH_INPUT))
effectiveHigh += getStateInput (HIGH_INPUT);
if (getInputConnected (LOW_INPUT))
effectiveLow += getStateInput (LOW_INPUT);

if (getInputConnected (HIGH_INPUT))
effectiveHigh += getStateInput (HIGH_INPUT);

if (link == LINK_CENTER_INT) {
float spread = effectiveLow;
effectiveLow = effectiveHigh - spread;
effectiveHigh = effectiveHigh + spread;
}
if (effectiveLow + maxHigh - maxLow > effectiveHigh)
effectiveHigh = effectiveLow + maxHigh - maxLow;

effectiveLow = clamp (effectiveLow, minLow, maxLow);
effectiveHigh = clamp (effectiveHigh, minHigh, maxHigh);
Expand Down

0 comments on commit 3932a33

Please sign in to comment.