computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 77243e588220576f1561e208630a1e5fe501711b
parent b79aed5b78095f80677e6ad4b83524d9b6db3b64
Author: Adam Malone <[email protected]>
Date:   Tue, 20 Nov 2018 17:04:00 -0600

partial fix to the dtpulse parens problem

Diffstat:
Msrc/dtpulse.cpp | 17+++++++++++------
Msrc/test.cpp | 1+
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/dtpulse.cpp b/src/dtpulse.cpp @@ -164,9 +164,9 @@ std::string splitRecur(std::string input) { else { stackVec.back().push_back(c); } - } - output = interleaveExpand(stackVec[0]); + std::vector<std::string> last = stackVec.back(); + output = interleaveExpand(last); return output; } @@ -175,6 +175,7 @@ std::string interleaveExpand(std::vector<std::string> blocks) { // somewhat like bash shell expansion // ["a","b","cd"] --> "abcabd" // ["ab","cde"] ----> "acbdaebcadbe" + printf("interleaveExpand %i\n",blocks.size()); std::vector<int> indices; std::vector<int> lengths; int outerIndex = 0; @@ -185,11 +186,15 @@ std::string interleaveExpand(std::vector<std::string> blocks) { for(int i = 0; i < outerLength; i++) { indices.push_back(0); lengths.push_back(blocks[i].length()); + printf("len: %i\n",blocks[i].length()); } - while((!allAtZero && steps < 6000 ) || steps == 0) { - output+=blocks[outerIndex][indices[outerIndex]]; - indices[outerIndex]++; - indices[outerIndex]%=lengths[outerIndex]; + while(outerLength && ((!allAtZero && steps < 6000 ) || steps == 0)) { + if(lengths[outerIndex]) { + output+=blocks[outerIndex][indices[outerIndex]]; + printf("output:%s\n",output.c_str()); + indices[outerIndex]++; + indices[outerIndex]%=lengths[outerIndex]; + } outerIndex++; outerIndex%=outerLength; steps++; diff --git a/src/test.cpp b/src/test.cpp @@ -26,6 +26,7 @@ int main(int argc, char** argv) input.push_back(argv[i+3]); } strResult = interleaveExpand(input); + printf("%s\n",strResult.c_str()); } else if(type==4) { output = parseEntireString(argv[1],knobandinputlookup,1);