computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 4f8f2efa0f2ceeb4f497359d11b35cdb947289f2
parent 84020fd7e29afee16944378ce6fdb5e8d17d60a9
Author: AdamPorcineFudgepuppy <>
Date:   Thu,  6 Jun 2024 17:01:56 -0500

show some more reasonable rotation knob values when input is not connected

Diffstat:
Mplugin.json | 2+-
Msrc/ComputerscareTolyPools-v2.cpp | 13+++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/plugin.json b/plugin.json @@ -1,6 +1,6 @@ { "slug": "computerscare", - "version": "2.1.9", + "version": "2.1.10", "name": "computerscare", "brand": "computerscare", "author": "computerscare", diff --git a/src/ComputerscareTolyPools-v2.cpp b/src/ComputerscareTolyPools-v2.cpp @@ -85,12 +85,20 @@ struct ComputerscareTolyPoolsV2 : Module { int finalPositiveRotation = 0; + bool inputIsConnected = inputs[POLY_INPUT].isConnected(); + if (counter > 982) { counter = 0; numChannelsKnob = params[NUM_CHANNELS_KNOB].getValue(); knobRotation = (int) round(params[ROTATE_KNOB].getValue()); + } + + if(inputIsConnected) { numInputChannels = inputs[POLY_INPUT].getChannels(); + } else { + numInputChannels = 0; } + if (inputs[NUM_CHANNELS_CV].isConnected()) { cvOutputChannels = (int) round(inputs[NUM_CHANNELS_CV].getVoltage(0)*1.6f); } @@ -104,17 +112,18 @@ struct ComputerscareTolyPoolsV2 : Module { if(numOutputChannelsControlValue == 0) { - numOutputChannels = numInputChannels; + numOutputChannels = inputIsConnected ? numInputChannels : 1; } else { numOutputChannels = numOutputChannelsControlValue; } + outputs[POLY_OUTPUT].setChannels(numOutputChannels); outputs[NUM_CHANNELS_OUTPUT].setVoltage(mapChannelCountToVoltage(numInputChannels)); if(rotationModeEnum == 0) { - rotationBase = numInputChannels; + rotationBase = inputIsConnected ? numInputChannels : 16; // so when unconnected, the rotation knob illustrates the normal range } else if(rotationModeEnum == 1) { rotationBase = std::max(numOutputChannels,numInputChannels); } else if(rotationModeEnum == 2) {