computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit bd2d5b4b414765adb32b2c70598e1d11f2309089
parent 82ae966b21b3c176cf16174fe476b6a751bf1a85
Author: Adam M <aemalone@gmail.com>
Date:   Sat,  1 Dec 2018 10:16:55 -0600

interleaveExpand mostly working for cookies

Diffstat:
Msrc/ComputerscareILoveCookies.cpp | 6+++---
Msrc/dtpulse.cpp | 53++++++++---------------------------------------------
2 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -297,8 +297,8 @@ void onCreate () override */ void incrementInternalStep(int i) { newABS[i].incrementAndCheck(); - activeKnobIndex[i] = newABS[i].peekWorkingStep(); - + //activeKnobIndex[i] = newABS[i].peekWorkingStep(); + if(i==0) { //printVector(newABS[i].workingIndexSequence); } @@ -421,7 +421,7 @@ void ComputerscareILoveCookies::step() { //activeKnobIndex[i] = absoluteSequences[i][this->absoluteStep[i]]; } - //activeKnobIndex[i] = newABS[i].peekWorkingStep(); + activeKnobIndex[i] = newABS[i].peekWorkingStep(); diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -416,7 +416,7 @@ int AbsoluteSequence::peekWorkingStep() { } void AbsoluteSequence::incrementAndCheck() { //printf("readHead:%i, peek:%i\n",readHead,peekStep()); - if(myRandomTokens.size() > 0 && skipAndPeek()>=78) { + if(skipAndPeek()>=78) { randomizeIndex(readHead); } } @@ -556,28 +556,23 @@ void Parser::ParseRandomSequence(Token t) { } // not a LeftCurly, dont do shit } void Parser::ParseInterleave(Token t) { - std::vector<std::vector<Token>> stackVec; + std::vector<std::vector<std::vector<Token>>> stackVec; std::vector<Token> tempStack; std::vector<Token> output; stackVec.push_back({}); while(t.type=="Letter"||t.type=="ExactValue"||t.type=="RandomSequence"||t.type=="LeftParen"||t.type=="RightParen") { - printf("size:%i ",stackVec.size()); - t.print(); if(t.type=="LeftParen") { stackVec.push_back({}); } else if(t.type=="RightParen") { - //evaluate top of stack - tempStack = interleaveExpand({stackVec.back()}); - //tempStack = stackVec.back(); + //evaluate top of stack + tempStack = interleaveExpand(stackVec.back()); //pop top of stack stackVec.pop_back(); if(stackVec.size() > 0) { - - //push this evaluated string to new top - stackVec.push_back(tempStack); - //stackVec.push_back({}); + //push this evaluated vector<Token> to new top + stackVec.back().push_back(tempStack); } else { @@ -585,45 +580,13 @@ void Parser::ParseInterleave(Token t) { } //Letter, ExactValue, or RandomSequence else { - stackVec.back().push_back(t); + stackVec.back().push_back({t}); } t=skipAndPeekToken(); } - printf("stackVec.size::%i, stackVec.back().size:%i \n",stackVec.size(),stackVec.back().size()); - //std::vector<std::vector<Token>> last = stackVec.back(); - output = interleaveExpand(stackVec); + output = interleaveExpand(stackVec.back()); tokenStack = output; } -void parseRecur(Token t) { - /*for(unsigned int i = 0; i < input.length(); i++) { - c = input[i]; - if(c == "(") { - stackVec.push_back({}); - } - else if(c == ")") { - //evaluate top of stack - tempString = interleaveExpand(stackVec.back()); - - //pop top of stack - stackVec.pop_back(); - - if(stackVec.size() > 0) { - //push this evaluated string to new top - stackVec.back().push_back(tempString); - } - - else { - return ""; - } - } - else { - stackVec.back().push_back(c); - } - } - std::vector<std::string> last = stackVec.back(); - output = interleaveExpand(last); - */ -} char Parser::peekChar() { if (currentIndex < (int) expression.size()) return expression[currentIndex];