commit 6bc08d55894a225870fb896dd96eff192d7c682a
parent 95cf3bb0ec8976ad2198644e07578bb41fce89ea
Author: Adam M <aemalone@gmail.com>
Date: Sun, 21 Oct 2018 10:30:44 -0500
ah ya know pre-cid
Diffstat:
2 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/src/ComputerscareLaundrySoup.cpp b/src/ComputerscareLaundrySoup.cpp
@@ -162,7 +162,7 @@ ComputerscareLaundrySoup() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIG
int mappedIndex = 0;
int currentVal = 0;
int hashnum = 1;
- int thisoffset = 0;
+ int thisoffset = 0;
std::stringstream test(expr);
@@ -188,12 +188,8 @@ ComputerscareLaundrySoup() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIG
{
hashlist.push_back(segment);
}
- if(hashlist.size() > 1) {
- hashnum = std::stoi( hashlist[1] );
- }
- else {
- hashnum = 1;
- }
+ hashnum = hashlist.size() > 1 ? std::stoi(hashlist[1]) : 1;
+
for(int i = 0; i < hashnum; i++ ) {
seglist.resize(0);
std::stringstream leftofhash(hashlist[0]);
@@ -202,12 +198,7 @@ ComputerscareLaundrySoup() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIG
seglist.push_back(segment);
}
if(i==0) {
- if(seglist.size() > 1) {
- thisoffset = std::stoi( seglist[1] );
- }
- else {
- thisoffset = 0;
- }
+ thisoffset = seglist.size() > 1 ? std::stoi(seglist[1]) : 0;
offsets.push_back(thisoffset);
}
@@ -237,7 +228,7 @@ void onCreate () override
{
for(int i = 0; i < numFields; i++) {
if(textFields[i]->text.size() > 0) {
- parseFormula(textFields[i]->text,i);
+ absoluteFormulas[i] = parseFormula(textFields[i]->text,i);
}
resetOneOfThem(i);
}
diff --git a/src/ComputerscarePatchSequencer.cpp b/src/ComputerscarePatchSequencer.cpp
@@ -208,11 +208,7 @@ json_t *randomizationOutputBoundsEnumJ = json_object_get(rootJ, "randomizationOu
switch_states[k][j][i] = (j==randomIndex && randomUniform() < 0.7) ? 1 : 0;
}
else {
-
- if(j==randomIndex)
- switch_states[k][j][i] = 1;
- else
- switch_states[k][j][i] = 0;
+ switch_states[k][j][i] = j==randomIndex ? 1 : 0;
}
}
}
@@ -371,14 +367,7 @@ struct ComputerscarePatchSequencerWidget : ModuleWidget {
for (int i = 0 ; i < 10 ; i++)
{
- addInput(Port::create<InPort>(Vec(3, i * row_spacing + top_row), Port::INPUT, module, ComputerscarePatchSequencer::INPUT_JACKS + i));
-
- if(i%2) {
- addOutput(Port::create<PointingUpPentagonPort>(Vec(33 + i * column_spacing , top_row + 10 * row_spacing), Port::OUTPUT, module, ComputerscarePatchSequencer::OUTPUTS + i));
- }
- else {
- addOutput(Port::create<InPort>(Vec(33 + i * column_spacing , top_row + 10 * row_spacing), Port::OUTPUT, module, ComputerscarePatchSequencer::OUTPUTS + i));
- }
+
for(int j = 0 ; j < 10 ; j++ )
{
@@ -386,15 +375,25 @@ struct ComputerscarePatchSequencerWidget : ModuleWidget {
addParam(ParamWidget::create<LEDButton>(Vec(35 + column_spacing * j+2, top_row + row_spacing * i+4), module, ComputerscarePatchSequencer::SWITCHES + i + j * 10, 0.0, 1.0, 0.0));
// green light indicates the state of the matrix that is being edited
- addChild(ModuleLightWidget::create<ComputerscareHugeLight<ComputerscareGreenLight>>(Vec(35 + column_spacing * j +0.4, top_row + row_spacing * i +2.4 ), module, ComputerscarePatchSequencer::SWITCH_LIGHTS + i + j * 10));
+ ModuleLightWidget *bigOne = ModuleLightWidget::create<ComputerscareHugeLight<ComputerscareGreenLight>>(Vec(35 + column_spacing * j +0.4, top_row + row_spacing * i +2.4 ), module, ComputerscarePatchSequencer::SWITCH_LIGHTS + i + j * 10);
+
+ addChild(bigOne);
- double xpos = 35 + column_spacing * j + 6.3 + rand()%4;
- double ypos = top_row + row_spacing * i + 8.3 + rand()%4;
+ double xpos = 35 + column_spacing * j + 6.3 + rand()%8-4;
+ double ypos = top_row + row_spacing * i + 8.3 + rand()%8-4;
// red light indicates the state of the matrix that is the active step
addChild(ModuleLightWidget::create<MediumLight<RedLight>>(Vec(xpos, ypos), module, ComputerscarePatchSequencer::SWITCH_LIGHTS + i + j * 10+100));
addChild(ModuleLightWidget::create<MediumLight<RedLight>>(Vec(xpos+rdx, ypos+rdy), module, ComputerscarePatchSequencer::SWITCH_LIGHTS + i + j * 10+100));
}
+ addInput(Port::create<InPort>(Vec(3, i * row_spacing + top_row), Port::INPUT, module, ComputerscarePatchSequencer::INPUT_JACKS + i));
+
+ if(i%2) {
+ addOutput(Port::create<PointingUpPentagonPort>(Vec(33 + i * column_spacing , top_row + 10 * row_spacing), Port::OUTPUT, module, ComputerscarePatchSequencer::OUTPUTS + i));
+ }
+ else {
+ addOutput(Port::create<InPort>(Vec(33 + i * column_spacing , top_row + 10 * row_spacing), Port::OUTPUT, module, ComputerscarePatchSequencer::OUTPUTS + i));
+ }
}
//clock input