computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit b7f53d74ff7834a2cbe735627bd8eb67454f6a1d
parent 14685059ace96afcb2d7199831322ccacf3212b2
Author: Adam Malone <[email protected]>
Date:   Fri,  7 Dec 2018 16:07:09 -0600

some minimal input handling for ilovecookies

Diffstat:
Msrc/ComputerscareILoveCookies.cpp | 5++++-
Msrc/dtpulse.cpp | 13++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -428,7 +428,10 @@ void ComputerscareILoveCookies::step() { // values greater than 52 for randomization // then must keep a separate dictionary // dict[52] = [1,2,24] and then it must look this up and randomize - if(activeKnobIndex[i] < 26) { + if(activeKnobIndex[i] == -1) { + outputs[TRG_OUTPUT + i].value = 0.f; + } + else if(activeKnobIndex[i] < 26) { knobRawValue = params[activeKnobIndex[i]].value; outputs[TRG_OUTPUT + i].value = mapKnobValue(knobRawValue,i); } diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -377,6 +377,7 @@ AbsoluteSequence::AbsoluteSequence() { AbsoluteSequence("a",knobandinputlookup); } AbsoluteSequence::AbsoluteSequence(std::string expr, std::string lookup) { + expr = expr=="" ? "<0.0>" : expr; Parser p = Parser(expr); exactFloats = p.exactFloats; randomTokens=p.randomVector; @@ -460,6 +461,7 @@ void AbsoluteSequence::print() { Token::Token(std::string t, std::string v) { type = t; value = v; + index = -1; } Token::Token(std::string t, std::string v, int dex) { type = t; @@ -670,12 +672,17 @@ void Parser::ParseAtExpand(Token t) { tokenStack.insert(tokenStack.end(),proposedTokens.begin(),proposedTokens.end()); } std::vector<Token> Parser::countExpandTokens(std::vector<std::vector<Token>> tokenVecVec, int atNum) { - std::vector<Token> output; + std::vector<Token> output; for(unsigned int i=0; i < tokenVecVec.size(); i++) { int sizeMod = (int) tokenVecVec[i].size(); atNum = atNum==-1 ? sizeMod : atNum; for(int j = 0; j < atNum; j++) { - output.push_back(tokenVecVec[i][j % sizeMod]); + if(tokenVecVec[i].size()) { + output.push_back(tokenVecVec[i][j % sizeMod]); + } + else { + output.push_back(Token("Zero","")); + } } } return output; @@ -689,7 +696,7 @@ int Parser::ParseAtPart(Token t) { atString+=t.value; t=skipAndPeekToken(); } - atNum = std::stoi(atString); + atNum = atString != "" ? std::stoi(atString) : -1; } return atNum; }