computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit f8febc58d076f116937874e9774825d29be96c34
parent 8870e74f9f7f4d4ae46540a1191ac10f7deadac7
Author: Adam M <aemalone@gmail.com>
Date:   Thu, 28 Oct 2021 16:37:54 -0500

set poly channels on debug to same as poly input when in single clock mode

Diffstat:
Msrc/ComputerscareDebug.cpp | 26+++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp @@ -167,10 +167,18 @@ void ComputerscareDebug::process(const ProcessArgs &args) { inputChannel = floor(params[INPUT_CHANNEL_FOCUS].getValue()); clockChannel = floor(params[CLOCK_CHANNEL_FOCUS].getValue()); + int numInputChannels = inputs[VAL_INPUT].getChannels(); + int numClockChannels = inputs[TRG_INPUT].getChannels(); + + int numOutputChannels = 16; + float min = outputRanges[outputRangeEnum][0]; float max = outputRanges[outputRangeEnum][1]; float spread = max - min; if (clockMode == SINGLE_MODE) { + if (inputMode == POLY_MODE) { + numOutputChannels = numInputChannels; + } if (clockTriggers[clockChannel].process(inputs[TRG_INPUT].getVoltage(clockChannel) / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].getValue()) ) { if (inputMode == POLY_MODE) { for (int i = 0; i < 16; i++) { @@ -195,6 +203,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) { } else if (clockMode == INTERNAL_MODE) { if (inputMode == POLY_MODE) { + numOutputChannels = numInputChannels; for (int i = 0; i < 16; i++) { logLines[i] = inputs[VAL_INPUT].getVoltage(i); } @@ -210,6 +219,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) { } else if (clockMode == POLY_MODE) { if (inputMode == POLY_MODE) { + numOutputChannels = std::min(numInputChannels, numClockChannels); for (int i = 0; i < 16; i++) { if (clockTriggers[i].process(inputs[TRG_INPUT].getVoltage(i) / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].getValue()) ) { logLines[i] = inputs[VAL_INPUT].getVoltage(i); @@ -217,6 +227,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) { } } else if (inputMode == SINGLE_MODE) { + numOutputChannels = numClockChannels; for (int i = 0; i < 16; i++) { if (clockTriggers[i].process(inputs[TRG_INPUT].getVoltage(i) / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].getValue()) ) { logLines[i] = inputs[VAL_INPUT].getVoltage(inputChannel); @@ -224,6 +235,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) { } } else if (inputMode == INTERNAL_MODE) { + numOutputChannels = numClockChannels; for (int i = 0; i < 16; i++) { if (clockTriggers[i].process(inputs[TRG_INPUT].getVoltage(i) / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].getValue()) ) { logLines[i] = min + spread * random::uniform(); @@ -240,6 +252,7 @@ void ComputerscareDebug::process(const ProcessArgs &args) { strValue = defaultStrValue; } outputs[POLY_OUTPUT].setChannels(16); + outputs[POLY_OUTPUT].setChannels(numOutputChannels); stepCounter++; if (stepCounter > 1025) { @@ -249,9 +262,16 @@ void ComputerscareDebug::process(const ProcessArgs &args) { std::string thisLine = ""; for ( unsigned int a = 0; a < NUM_LINES; a = a + 1 ) { - thisLine = logLines[a] >= 0 ? "+" : ""; - thisLine += std::to_string(logLines[a]); - thisLine = thisLine.substr(0, 9); + + if (a < numOutputChannels) { + thisLine = logLines[a] >= 0 ? "+" : ""; + thisLine += std::to_string(logLines[a]); + thisLine = thisLine.substr(0, 9); + } + else { + thisLine = ""; + } + thisVal += (a > 0 ? "\n" : "") + thisLine; outputs[POLY_OUTPUT].setVoltage(logLines[a], a);