commit 82ae966b21b3c176cf16174fe476b6a751bf1a85
parent 44cb911f21757ec126757e7b2e24ecab277a1e21
Author: Adam M <aemalone@gmail.com>
Date: Fri, 30 Nov 2018 21:57:12 -0600
Fixed some of it I suppose...
Diffstat:
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp
@@ -214,6 +214,7 @@ ComputerscareILoveCookies() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LI
}
void onRandomize() override {
+ srand (time(NULL));
randomizeAllFields();
}
void randomizeShuffle() {
@@ -252,6 +253,7 @@ ComputerscareILoveCookies() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LI
nextAbsoluteSequences[index] = parseStringAsValues(textFields[index]->text,knobandinputlookup);
printf("setNextAbsoluteSequence index:%i,val[0]:%i\n",index,nextAbsoluteSequences[index][0]);
newABS[index] = AbsoluteSequence(textFields[index]->text,knobandinputlookup);
+ newABS[index].print();
}
void setAbsoluteSequenceFromQueue(int index) {
absoluteSequences[index].resize(0);
@@ -295,8 +297,10 @@ void onCreate () override
*/
void incrementInternalStep(int i) {
newABS[i].incrementAndCheck();
+ activeKnobIndex[i] = newABS[i].peekWorkingStep();
+
if(i==0) {
- printVector(newABS[i].workingIndexSequence);
+ //printVector(newABS[i].workingIndexSequence);
}
this->displayString[i] = this->getDisplayString(i);
if(this->absoluteStep[i] == 0) {
@@ -414,10 +418,13 @@ void ComputerscareILoveCookies::step() {
checkIfShouldChange(i);
}
}
- activeKnobIndex[i] = absoluteSequences[i][this->absoluteStep[i]];
+ //activeKnobIndex[i] = absoluteSequences[i][this->absoluteStep[i]];
}
- activeKnobIndex[i] = newABS[i].peekWorkingStep();
+ //activeKnobIndex[i] = newABS[i].peekWorkingStep();
+
+
+
//outputs[TRG_OUTPUT + i].value = params[KNOB_PARAM + activeKnob].value;
// how to handle a randomization input here?
// negative integers?
@@ -498,7 +505,7 @@ void MyTextFieldCookie::onTextChange() {
if(matchParens(value)) {
//whoKnows(value);
- printf("row: %i\n",this->rowIndex);
+ //printf("row: %i\n",this->rowIndex);
module->setNextAbsoluteSequence(this->rowIndex);
}
}
diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp
@@ -225,7 +225,7 @@ std::vector<Token> interleaveExpand(std::vector<std::vector<Token>> blocks) {
lengths.push_back(blocks[i].size());
}
printf("interleaveExpand lengths:");
- printVector(lengths);
+ //printVector(lengths);
while(outerLength && ((!allAtZero && steps < 6000 ) || steps == 0)) {
if(lengths[outerIndex]) {
output.push_back(blocks[outerIndex][indices[outerIndex]]);
@@ -412,11 +412,11 @@ int AbsoluteSequence::peekStep() {
return indexSequence[readHead];
}
int AbsoluteSequence::peekWorkingStep() {
- return workingIndexSequence[readHead];
+ return readHead >=0 ? workingIndexSequence[readHead] : 0;
}
void AbsoluteSequence::incrementAndCheck() {
//printf("readHead:%i, peek:%i\n",readHead,peekStep());
- if(skipAndPeek()>=78) {
+ if(myRandomTokens.size() > 0 && skipAndPeek()>=78) {
randomizeIndex(readHead);
}
}
@@ -556,26 +556,28 @@ void Parser::ParseRandomSequence(Token t) {
} // not a LeftCurly, dont do shit
}
void Parser::ParseInterleave(Token t) {
- std::vector<std::vector<std::vector<Token>>> stackVec;
+ std::vector<std::vector<Token>> stackVec;
std::vector<Token> tempStack;
std::vector<Token> output;
stackVec.push_back({});
- stackVec[0].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({});
- stackVec.back().push_back({});
}
else if(t.type=="RightParen") {
//evaluate top of stack
- tempStack = interleaveExpand(stackVec.back());
- //pop top of stack
- stackVec.pop_back();
+ tempStack = interleaveExpand({stackVec.back()});
+ //tempStack = stackVec.back();
+
+ //pop top of stack
+ stackVec.pop_back();
if(stackVec.size() > 0) {
+
//push this evaluated string to new top
- stackVec.back().push_back(tempStack);
+ stackVec.push_back(tempStack);
+ //stackVec.push_back({});
}
else {
@@ -583,13 +585,13 @@ void Parser::ParseInterleave(Token t) {
}
//Letter, ExactValue, or RandomSequence
else {
- stackVec.back().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(last);
+ //std::vector<std::vector<Token>> last = stackVec.back();
+ output = interleaveExpand(stackVec);
tokenStack = output;
}
void parseRecur(Token t) {
@@ -601,13 +603,16 @@ void parseRecur(Token t) {
else if(c == ")") {
//evaluate top of stack
tempString = interleaveExpand(stackVec.back());
- //pop top of stack
+
+ //pop top of stack
stackVec.pop_back();
- if(stackVec.size() > 0) {
+
+ if(stackVec.size() > 0) {
//push this evaluated string to new top
stackVec.back().push_back(tempString);
}
- else {
+
+ else {
return "";
}
}