computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit f9800b68a95a205c2052ee5c612d9e980e565393
parent 8624e23b3f7087d5d2db71965c927470709909e9
Author: Adam M <aemalone@gmail.com>
Date:   Sun, 12 Apr 2020 10:19:36 -0500

Boly puttons handles polyphony per spec.  mono A,B apply to all poly channels

Diffstat:
Msrc/ComputerscareBolyPuttons.cpp | 17++++++++++++++---
Msrc/ComputerscareDebug.cpp | 9++++++---
2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/ComputerscareBolyPuttons.cpp b/src/ComputerscareBolyPuttons.cpp @@ -120,7 +120,7 @@ struct ComputerscareBolyPuttons : ComputerscarePolyModule { int bChannels = inputs[B_INPUT].getChannels(); int knobSetting = params[POLY_CHANNELS].getValue(); if (knobSetting == 0) { - polyChannels = (aChannels == 0 && bChannels == 0) ? 16 : std::max(aChannels, bChannels); + polyChannels = (aChannels <= 1 && bChannels <= 1) ? 16 : std::max(aChannels, bChannels); } else { polyChannels = knobSetting; @@ -155,9 +155,20 @@ struct ComputerscareBolyPuttons : ComputerscarePolyModule { if (radioMode && !momentary) { checkForParamChanges(); } + + if(numAChannels == 1) { + min = inputs[A_INPUT].getVoltage(0); + } + if(numBChannels == 1) { + max = inputs[B_INPUT].getVoltage(0); + } for(int i = 0; i < polyChannels; i++) { - min = i< numAChannels ? inputs[A_INPUT].getVoltage(i) : rangeMin; - max = i< numBChannels ? inputs[B_INPUT].getVoltage(i) : rangeMax; + if(numAChannels != 1) { + min = i< numAChannels ? inputs[A_INPUT].getVoltage(i) : rangeMin; + } + if(numBChannels != 1) { + max = i< numBChannels ? inputs[B_INPUT].getVoltage(i) : rangeMax; + } spread = max-min; outputs[POLY_OUTPUT].setVoltage(params[TOGGLE + i].getValue()*spread + min, i); } diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp @@ -246,11 +246,14 @@ void ComputerscareDebug::process(const ProcessArgs &args) { stepCounter = 0; thisVal = ""; + std::string thisLine=""; for ( unsigned int a = 0; a < NUM_LINES; a = a + 1 ) { - thisVal += a > 0 ? "\n" : ""; - thisVal += logLines[a] >= 0 ? "+" : ""; - thisVal += std::to_string(logLines[a]).substr(0, 10); + thisLine = logLines[a] >= 0 ? "+" : ""; + thisLine += std::to_string(logLines[a]); + thisLine = thisLine.substr(0, 9); + thisVal+= (a > 0 ? "\n" : "")+thisLine; + outputs[POLY_OUTPUT].setVoltage(logLines[a], a); } strValue = thisVal;