computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit 76dbe73177b78dd4ebca09814770103830e0126d
parent ff91242f2200a6a01d8a19822def960f0fdd764a
Author: Adam M <aemalone@gmail.com>
Date:   Sat, 10 Nov 2018 19:26:51 -0600

add inputs to ilovecookies

Diffstat:
Mres/ComputerscareILoveCookiesPanel.svg | 16++++++++--------
Msrc/ComputerscareILoveCookies.cpp | 50++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/res/ComputerscareILoveCookiesPanel.svg b/res/ComputerscareILoveCookiesPanel.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="200" + width="240" height="380" - viewBox="0 0 52.916669 100.54167" + viewBox="0 0 63.500003 100.54167" version="1.1" id="svg8" inkscape:version="0.92.2 5c3e80d, 2017-08-06" @@ -34,7 +34,7 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="4.0000001" + inkscape:zoom="1" inkscape:cx="86.288455" inkscape:cy="164.40634" inkscape:document-units="mm" @@ -61,7 +61,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> + <dc:title></dc:title> </cc:Work> </rdf:RDF> </metadata> @@ -74,11 +74,11 @@ <path inkscape:connector-curvature="0" id="path1647" - d="M 0,196.45832 H 52.916667 V 297 H 0 Z" - style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.72459143;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> + d="M 0,196.45832 H 63.5 V 297 H 0 Z" + style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.79375011;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" /> <g aria-label="computerscare" - transform="matrix(0.98656289,0.0441007,-0.12576361,1.0079983,50.102321,-2.779225)" + transform="matrix(0.98656289,0.0441007,-0.12576361,1.0079983,61.743995,-2.779225)" style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" id="text1651"> <path @@ -356,7 +356,7 @@ id="text1057" /> <g id="g8072" - transform="matrix(0.26889251,-0.01002392,-0.03200614,0.19788514,10.15233,292.24297)"> + transform="matrix(0.26889251,-0.01002392,-0.03200614,0.19788514,21.794004,292.24297)"> <g style="display:inline" inkscape:label="Layer 1" diff --git a/src/ComputerscareILoveCookies.cpp b/src/ComputerscareILoveCookies.cpp @@ -13,7 +13,11 @@ struct ComputerscareILoveCookies; const int numFields = 3; const int numKnobRows = 5; const int numKnobColumns = 5; +const int numInputRows = 13; +const int numInputColumns = 2; + const std::string knoblookup = "abcdefghijklmnopqrstuvwxy"; +const std::string inputlookup= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const std::vector<NVGcolor> outlineColorMap = {COLOR_COMPUTERSCARE_RED,COLOR_COMPUTERSCARE_YELLOW,COLOR_COMPUTERSCARE_BLUE}; class MyTextFieldCookie : public LedDisplayTextField { @@ -76,7 +80,8 @@ struct ComputerscareILoveCookies : Module { GLOBAL_CLOCK_INPUT, GLOBAL_RESET_INPUT, CLOCK_INPUT, - RESET_INPUT = CLOCK_INPUT + numFields, + SIGNAL_INPUT= CLOCK_INPUT + numInputRows * numInputColumns, + RESET_INPUT = SIGNAL_INPUT + numFields, NUM_INPUTS = RESET_INPUT + numFields }; enum OutputIds { @@ -389,13 +394,21 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { double verticalSpacing = 18.4; int verticalStart = 80; + double xStart = 16; int index=0; double knobPosX=0.0; double knobPosY=0.0; - double knobXStart = 2; + double knobXStart = 2+xStart; double knobYStart = 16; double knobRowWidth = 13; double knobColumnHeight = 10; + + double inputPosX = 0.0; + double inputPosY = 0.0; + double inputXStart = 0; + double inputYStart = 0; + double inputRowWidth = 7; + double inputColumnHeight = 9.5; ComputerscareILoveCookiesWidget(ComputerscareILoveCookies *module) : ModuleWidget(module) { setPanel(SVG::load(assetPlugin(plugin, "res/ComputerscareILoveCookiesPanel.svg"))); @@ -420,32 +433,49 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { ParamWidget* knob = ParamWidget::create<SmoothKnob>(mm2px(Vec(knobPosX,knobPosY)), module, ComputerscareILoveCookies::KNOB_PARAM +index, 0.f, 10.0f, 0.0f); + + addParam(knob); } } + for(int k = 0; k < numInputRows; k++) { + for(int m=0; m<numInputColumns; m++) { + inputPosX = inputXStart + m*inputRowWidth; + inputPosY = inputYStart + k*inputColumnHeight; + index = numInputColumns*k + m; + + if(m%2) { + addInput(Port::create<InPort>(mm2px(Vec(inputPosX , inputPosY)), Port::INPUT, module, ComputerscareILoveCookies::SIGNAL_INPUT + index)); + } + else { + addInput(Port::create<PointingUpPentagonPort>(mm2px(Vec(inputPosX , inputPosY+4.9)), Port::INPUT, module, ComputerscareILoveCookies::SIGNAL_INPUT + index)); + + } + } + } //global clock input - addInput(Port::create<InPort>(mm2px(Vec(2 , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_CLOCK_INPUT)); + addInput(Port::create<InPort>(mm2px(Vec(2+xStart , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_CLOCK_INPUT)); //global reset input - addInput(Port::create<InPort>(mm2px(Vec(12 , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_RESET_INPUT)); + addInput(Port::create<InPort>(mm2px(Vec(12+xStart , 0)), Port::INPUT, module, ComputerscareILoveCookies::GLOBAL_RESET_INPUT)); for(int i = 0; i < numFields; i++) { //first-step output - addOutput(Port::create<OutPort>(mm2px(Vec(42 , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::FIRST_STEP_OUTPUT + i)); + addOutput(Port::create<OutPort>(mm2px(Vec(42+xStart , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::FIRST_STEP_OUTPUT + i)); //individual output - addOutput(Port::create<OutPort>(mm2px(Vec(54 , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::TRG_OUTPUT + i)); + addOutput(Port::create<OutPort>(mm2px(Vec(54+xStart , verticalStart + verticalSpacing*i - 11)), Port::OUTPUT, module, ComputerscareILoveCookies::TRG_OUTPUT + i)); //individual clock input - addInput(Port::create<InPort>(mm2px(Vec(2, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::CLOCK_INPUT + i)); + addInput(Port::create<InPort>(mm2px(Vec(2+xStart, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::CLOCK_INPUT + i)); //individual reset input - addInput(Port::create<InPort>(mm2px(Vec(12, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::RESET_INPUT + i)); + addInput(Port::create<InPort>(mm2px(Vec(12+xStart, verticalStart + verticalSpacing*i-10)), Port::INPUT, module, ComputerscareILoveCookies::RESET_INPUT + i)); //sequence input field - textField = Widget::create<MyTextFieldCookie>(mm2px(Vec(1, verticalStart + verticalSpacing*i))); + textField = Widget::create<MyTextFieldCookie>(mm2px(Vec(1+xStart, verticalStart + verticalSpacing*i))); textField->setModule(module); textField->box.size = mm2px(Vec(63, 7)); textField->multiline = false; @@ -456,7 +486,7 @@ struct ComputerscareILoveCookiesWidget : ModuleWidget { //active step display NumberDisplayWidget3cookie *display = new NumberDisplayWidget3cookie(); - display->box.pos = mm2px(Vec(23,verticalStart - 9.2 +verticalSpacing*i)); + display->box.pos = mm2px(Vec(23+xStart,verticalStart - 9.2 +verticalSpacing*i)); display->box.size = Vec(50, 20); display->outlineColor = outlineColorMap[i];