computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 8920f55ac9c6a38f08dc0b968910f3939dc334e7
parent 27c7384627b8421753542c552845df0d1a92864d
Author: Adam M <aemalone@gmail.com>
Date:   Sat, 16 Nov 2019 09:04:03 -0600

LaundryPoly inError state on initialization.  Fix a few compiler warnings in dtpulse.  Show 1st channel step counter in LaundrySoup

Diffstat:
Msrc/ComputerscareLaundrySoup.cpp | 11++++++-----
Msrc/dtpulse.cpp | 11++++++-----
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp @@ -150,7 +150,7 @@ struct ComputerscareLaundrySoup : Module { laundrySequences[index] = lss; laundryPoly[index] = LaundryPoly(currentFormula[index]); - laundryPoly[index].print(); + //laundryPoly[index].print(); //laundryPoly.update(index,currentFormula[index]); if (!lss.inError) { @@ -158,7 +158,7 @@ struct ComputerscareLaundrySoup : Module { //laundrySequences[index].print(); } else { - printf("ERROR ch:%i\n",index); + DEBUG("ERROR ch:%i",index); //lss.print(); //textFields[index]->inError = true; } @@ -192,8 +192,8 @@ struct ComputerscareLaundrySoup : Module { } } std::string getDisplayString(int index) { - std::string lhs = std::to_string(this->laundrySequences[index].readHead + 1); - std::string rhs = std::to_string(this->laundrySequences[index].numSteps); + std::string lhs = std::to_string(this->laundryPoly[index].lss[0].readHead + 1); + std::string rhs = std::to_string(this->laundryPoly[index].lss[0].numSteps); padTo(lhs, 3, ' '); padTo(rhs, 3, ' '); @@ -328,7 +328,6 @@ struct LaundryTF2 : ComputerscareTextField { LaundrySoupSequence lss = LaundrySoupSequence(value); LaundryPoly lp = LaundryPoly(value); - lp.print(); module->lastValue[rowIndex] = value; if (!lp.inError && matchParens(value)) { @@ -337,6 +336,8 @@ struct LaundryTF2 : ComputerscareTextField module->setNextAbsoluteSequence(this->rowIndex); } else { + DEBUG("Channel %i in error",rowIndex); + lp.print(); inError = true; } } diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -367,8 +367,8 @@ bool matchParens(std::string value) { return theyMatch; } void printVector(std::vector <int> intVector) { - printf("int vector of size %i\n",intVector.size()); - for(int i= 0; i < intVector.size(); i++) { + //printf("int vector of size %i\n",intVector.size()); + for(unsigned int i= 0; i < intVector.size(); i++) { printf("%i ",intVector[i]); } printf("\n"); @@ -393,12 +393,14 @@ void whoKnowsLaundryPoly(std::string input) { } LaundryPoly::LaundryPoly(std::string formula) { std::string newFormula = ""; + bool myInError=false; for (int i = 0; i < 16; i++ ) { newFormula = formula; - //replaceAll(newFormula, "2^#", "<" + std::to_string(static_cast<long long>(1 << i)) + ">"); replaceAll(newFormula, "#", "<" + std::to_string(static_cast<long long>(i + 1)) + ">"); lss[i] = LaundrySoupSequence(newFormula); + myInError = myInError || lss[i].inError; } + inError=myInError; } LaundryPoly::LaundryPoly() { LaundryPoly(""); @@ -470,7 +472,6 @@ void LaundrySoupSequence::print() { std::vector<int> LaundrySoupSequence::makePulseSequence(std::vector<Token> tokens) { std::vector<int> output = {}; int length = 0; - int zeroCounter=1; int thisVal; int thisGate; for (unsigned int i = 0; i < tokens.size(); i++) { @@ -919,7 +920,7 @@ void Parser::ParseFormula(Token t,std::vector<std::string> operatorWhitelist, bo operatorStack.pop_back(); int lhs = terminalStack.back().duration; int rhs = t.duration; - int result; + int result =lhs; terminalStack.pop_back(); if(op=="Asterix") { result=lhs*rhs;