computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 775bd5968ac9c7b11f7a4a8bb3d4ef980a30c4fe
parent d3a737aa34f2985bb9d893906003be059d6398b6
Author: Adam M <aemalone@gmail.com>
Date:   Thu, 15 Nov 2018 00:22:18 -0600

they told me they fixed it

Diffstat:
Msrc/Computerscare.cpp | 1-
Msrc/Computerscare.hpp | 1+
Msrc/ComputerscareILoveCookies.cpp | 11+++++++----
Msrc/dtpulse.cpp | 9++++++---
Msrc/dtpulse.hpp | 17++++++++++++-----
Msrc/test.cpp | 4++--
6 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/src/Computerscare.cpp b/src/Computerscare.cpp @@ -1,6 +1,5 @@ #include "Computerscare.hpp" - Plugin *plugin; diff --git a/src/Computerscare.hpp b/src/Computerscare.hpp @@ -1,3 +1,4 @@ +#pragma once #include "rack.hpp" diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -18,7 +18,7 @@ const int numInputColumns = 2; const int numKnobs = numKnobRows * numKnobColumns; const int numInputs = numInputRows * numInputColumns; - +const std::string knobandinputlookup = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; const std::vector<NVGcolor> outlineColorMap = {COLOR_COMPUTERSCARE_RED,COLOR_COMPUTERSCARE_YELLOW,COLOR_COMPUTERSCARE_BLUE}; class MyTextFieldCookie : public LedDisplayTextField { @@ -105,7 +105,7 @@ struct ComputerscareILoveCookies : Module { std::vector<int> absoluteSequences[numFields]; std::vector<int> nextAbsoluteSequences[numFields]; - std::string knobandinputlookup = knoblookup + inputlookup; + bool shouldChange[numFields] = {false}; int absoluteStep[numFields] = {0}; @@ -171,12 +171,13 @@ ComputerscareILoveCookies() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LI shouldChange[index] = true; nextAbsoluteSequences[index].resize(0); nextAbsoluteSequences[index] = parseStringAsValues(textFields[index]->text,knobandinputlookup); - printf("index:%i,val[0]:%i\n",index,nextAbsoluteSequences[index][0]); + printf("setNextAbsoluteSequence index:%i,val[0]:%i\n",index,nextAbsoluteSequences[index][0]); } void setAbsoluteSequenceFromQueue(int index) { absoluteSequences[index].resize(0); absoluteSequences[index] = nextAbsoluteSequences[index]; numSteps[index] = nextAbsoluteSequences[index].size() > 0 ? nextAbsoluteSequences[index].size() : 1; + printf("setAbsoluteSequenceFromQueue index:%i,val[0]:%i\n",index,nextAbsoluteSequences[index][0]); } void checkIfShouldChange(int index) { if(shouldChange[index]) { @@ -216,7 +217,9 @@ void onCreate () override void incrementInternalStep(int i) { this->absoluteStep[i] +=1; this->absoluteStep[i] %= this->numSteps[i]; - printf("row:%i, step:%i, val:%i\n",i,this->absoluteStep[i],this->absoluteSequences[i][this->absoluteStep[i]]); + if(i==0) { + printf("row:%i, step:%i, val:%i\n",i,this->absoluteStep[i],this->absoluteSequences[i][this->absoluteStep[i]]); + } } void resetOneOfThem(int i) { diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -1,5 +1,10 @@ #include "dtpulse.hpp" +std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; +std::string integerlookup = "0123456789"; +std::string knoblookup = "abcdefghijklmnopqrstuvwxyz"; +std::string inputlookup= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + bool is_digits(const std::string &str) { @@ -134,7 +139,7 @@ std::string splitRecur(std::string input) { std::string output; std::string c; bool inside = false; - for(int i = 0; i < input.length(); i++) { + for(unsigned int i = 0; i < input.length(); i++) { c = input[i]; if(c == "(") { tempStack = ""; @@ -222,9 +227,7 @@ std::string atExpand(std::string input, int atnum, std::string lookup) { std::string countExpand(std::string input, int atnum) { std::string output=""; int length = input.length(); - int total = 0; int index = 0; - int lookupVal; if(atnum == -1) { return input; } diff --git a/src/dtpulse.hpp b/src/dtpulse.hpp @@ -1,9 +1,19 @@ + #include <string> #include <sstream> #include <iomanip> #include <iostream> #include <vector> #include <algorithm> + +#ifndef MY_GLOBALS_H +#define MY_GLOBALS_H +extern std::string b64lookup; +extern std::string integerlookup; +extern std::string knoblookup; +extern std::string inputlookup; +#endif + bool is_digits(const std::string &str); std::vector <int> parseString(std::string expr); std::vector <int> parseDt(std::string input, int offset, std::string lookup); @@ -16,8 +26,4 @@ std::string splitRecur(std::string input); std::string interleaveExpand(std::vector<std::string> blocks); std::string hashExpand(std::string input, int hashnum); std::string atExpand(std::string input, int atnum, std::string lookup); -std::string countExpand(std::string input, int atnum); -std::string b64lookup = "123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&$0"; -std::string integerlookup = "0123456789"; -std::string knoblookup = "abcdefghijklmnopqrstuvwxyz"; -std::string inputlookup= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +std::string countExpand(std::string input, int atnum); +\ No newline at end of file diff --git a/src/test.cpp b/src/test.cpp @@ -1,4 +1,4 @@ -#include "dtpulse.cpp" +#include "dtpulse.hpp" int main(int argc, char** argv) { int type = 0; @@ -21,7 +21,7 @@ int main(int argc, char** argv) } strResult = interleaveExpand(input); strParens = splitRecur(argv[1]); - printf("splitRecur:%s\ninterleaveExpand:%s\n",strParens.c_str(),strResult.c_str()); + printf(" splitRecur: %s\ninterleaveExpand: %s\n",strParens.c_str(),strResult.c_str()); } printVector(output); return 0;