Skip to content

Commit

Permalink
Fix many warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mhetrick committed Feb 28, 2023
1 parent 75a7a39 commit 093daf0
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 43 deletions.
8 changes: 4 additions & 4 deletions src/BOOLs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool boolsXOR(bool _in1, bool _in2)

bool boolsXNOR(bool _in1, bool _in2)
{
return !(_in1 != _in2);
return _in1 == _in2;
}

struct BOOLs : Module {
Expand Down Expand Up @@ -121,7 +121,7 @@ struct BOOLs : Module {
}
}

LogicMode getLogicMode()
LogicMode getLogicMode() const
{
return currentMode;
}
Expand Down Expand Up @@ -259,8 +259,8 @@ struct BOOLsWidget : ModuleWidget {
addOutput(createOutput<PJ301MPort>(mm2px(Vec(outJacks, bottomJacksHeight)), module, BOOLs::STEP_OUTPUT));

////////LIGHTS/////////
const float lightX = outJacks + 9.5;
const float lightOffset = -0.10;
const float lightX = outJacks + 9.5f;
const float lightOffset = -0.10f;
addChild(createLight<SmallLight<GreenLight>>(mm2px(Vec(lightX, jack1 + lightOffset)), module, BOOLs::OUT1_LIGHT));
addChild(createLight<SmallLight<GreenLight>>(mm2px(Vec(lightX, jack2 + lightOffset)), module, BOOLs::OUT2_LIGHT));
addChild(createLight<SmallLight<GreenLight>>(mm2px(Vec(lightX, jack3 + lightOffset)), module, BOOLs::OUT3_LIGHT));
Expand Down
6 changes: 3 additions & 3 deletions src/Cipher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct Cipher : Module {
bool bits[8] = {true, false, false, false, false, false, false, false};
bool bitsOut[8] = {true, false, false, false, false, false, false, false};
bool serialBit = false;
float cv1Value, cv2Value, cv3Value, cv4Value;
float cv1Value = 0.0f, cv2Value = 0.0f, cv3Value = 0.0f, cv4Value = 0.0f;

NLCTrigger clockIn;

Expand Down Expand Up @@ -219,11 +219,11 @@ struct CipherWidget : ModuleWidget {
const float inJacksX = 7.0f;
const float outJacksX = 56.75f;
const float bottomJacksY = 106.0f;
int spacing = 10.0f;
float spacing = 10.0f;

for (int i = 0; i < 4; i++)
{
int xOffset = i * spacing;
float xOffset = i * spacing;
addInput(createInput<PJ301MPort>(mm2px(Vec(inJacksX + xOffset, bottomJacksY)), module, Cipher::CLOCK_INPUT + i));
addOutput(createOutput<PJ301MPort>(mm2px(Vec(outJacksX + xOffset, bottomJacksY)), module, Cipher::CV1_OUTPUT + i));
}
Expand Down
38 changes: 19 additions & 19 deletions src/DivideConquer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct DivideConquer : Module {
dsp::BooleanTrigger flipflop7div2, flipflop7, flipflop7helper;

int stepCount1 = 0, stepCount3 = 0, stepCount5 = 0, stepCount7 = 0;
double gateOutValue = 5.0;
float gateOutValue = 5.0f;
bool div2 = false, div4 = false, div8 = false, div16 = false;
bool div32 = false, div64 = false, div128 = false, div256 = false;
bool div3 = false, div3div2 = false;
Expand Down Expand Up @@ -138,10 +138,10 @@ struct DivideConquer : Module {

void process(const ProcessArgs& args) override
{
double mainClock = inputs[CLOCK1_INPUT].getVoltage();
double clock3 = inputs[CLOCK3_INPUT].isConnected() ? inputs[CLOCK3_INPUT].getVoltage() : mainClock;
double clock5 = inputs[CLOCK5_INPUT].isConnected() ? inputs[CLOCK5_INPUT].getVoltage() : mainClock;
double clock7 = inputs[CLOCK7_INPUT].isConnected() ? inputs[CLOCK7_INPUT].getVoltage() : mainClock;
float mainClock = inputs[CLOCK1_INPUT].getVoltage();
float clock3 = inputs[CLOCK3_INPUT].getNormalVoltage(mainClock);
float clock5 = inputs[CLOCK5_INPUT].getNormalVoltage(mainClock);
float clock7 = inputs[CLOCK7_INPUT].getNormalVoltage(mainClock);


//yes, yes, this could be a for loop.
Expand Down Expand Up @@ -182,23 +182,23 @@ struct DivideConquer : Module {
processClock5Row(clock5);
processClock7Row(clock7);

outputs[DIV2_OUTPUT].setVoltage(div2 ? gateOutValue : 0.0);
outputs[DIV4_OUTPUT].setVoltage(div4 ? gateOutValue : 0.0);
outputs[DIV8_OUTPUT].setVoltage(div8 ? gateOutValue : 0.0);
outputs[DIV16_OUTPUT].setVoltage(div16 ? gateOutValue : 0.0);
outputs[DIV32_OUTPUT].setVoltage(div32 ? gateOutValue : 0.0);
outputs[DIV64_OUTPUT].setVoltage(div64 ? gateOutValue : 0.0);
outputs[DIV128_OUTPUT].setVoltage(div128 ? gateOutValue : 0.0);
outputs[DIV256_OUTPUT].setVoltage(div256 ? gateOutValue : 0.0);
outputs[DIV2_OUTPUT].setVoltage(div2 ? gateOutValue : 0.0f);
outputs[DIV4_OUTPUT].setVoltage(div4 ? gateOutValue : 0.0f);
outputs[DIV8_OUTPUT].setVoltage(div8 ? gateOutValue : 0.0f);
outputs[DIV16_OUTPUT].setVoltage(div16 ? gateOutValue : 0.0f);
outputs[DIV32_OUTPUT].setVoltage(div32 ? gateOutValue : 0.0f);
outputs[DIV64_OUTPUT].setVoltage(div64 ? gateOutValue : 0.0f);
outputs[DIV128_OUTPUT].setVoltage(div128 ? gateOutValue : 0.0f);
outputs[DIV256_OUTPUT].setVoltage(div256 ? gateOutValue : 0.0f);

outputs[DIV3_OUTPUT].setVoltage(div3 ? gateOutValue : 0.0);
outputs[DIV3DIV2_OUTPUT].setVoltage(!div3div2 ? gateOutValue : 0.0);
outputs[DIV3_OUTPUT].setVoltage(div3 ? gateOutValue : 0.0f);
outputs[DIV3DIV2_OUTPUT].setVoltage(!div3div2 ? gateOutValue : 0.0f);

outputs[DIV5_OUTPUT].setVoltage(div5 ? gateOutValue : 0.0);
outputs[DIV5DIV2_OUTPUT].setVoltage(div5div2 ? gateOutValue : 0.0);
outputs[DIV5_OUTPUT].setVoltage(div5 ? gateOutValue : 0.0f);
outputs[DIV5DIV2_OUTPUT].setVoltage(div5div2 ? gateOutValue : 0.0f);

outputs[DIV7_OUTPUT].setVoltage(div7 ? gateOutValue : 0.0);
outputs[DIV7DIV2_OUTPUT].setVoltage(!div7div2 ? gateOutValue : 0.0);
outputs[DIV7_OUTPUT].setVoltage(div7 ? gateOutValue : 0.0f);
outputs[DIV7DIV2_OUTPUT].setVoltage(!div7div2 ? gateOutValue : 0.0f);

lights[DIV2_LIGHT].setBrightness(div2 ? 1.0 : 0.0);
lights[DIV4_LIGHT].setBrightness(div4 ? 1.0 : 0.0);
Expand Down
4 changes: 2 additions & 2 deletions src/DivineCMOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ struct DivineCMOSWidget : ModuleWidget {
const float divJacksY = 102.75f;
float lightX = 4.5f;
float lightY = 113.0f;
int spacing = 10.0f;
float spacing = 10.0f;

for (int i = 0; i < 4; i++)
{
int xOffset = i * spacing;
float xOffset = i * spacing;
addOutput(createOutput<PJ301MPort>(mm2px(Vec(divJacksX + xOffset, divJacksY)), module, DivineCMOS::OUT1_OUTPUT + i));
addChild(createLight<SmallLight<BlueLight>>(mm2px(Vec(lightX + xOffset, lightY)), module, DivineCMOS::OUT1_LIGHT + i));
}
Expand Down
8 changes: 4 additions & 4 deletions src/DoubleNeuron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct DoubleNeuronWidget : ModuleWidget {
const float panelWidth = 5.08*12;

const float neuron1x = 9.5f;
const float neuron2x = panelWidth - 21.5;
const float neuron2x = panelWidth - 21.5f;
const float senseHeight = 11.0f;
const float responseHeight = 34.6f;

Expand All @@ -119,9 +119,9 @@ struct DoubleNeuronWidget : ModuleWidget {

const float neuronRow1Height = panelHeight - 72.5f;
const float neuronRow2Height = panelHeight - 60.5f;
const float diffRectInNegHeight = panelHeight - 46.3;
const float diffRectInPosHeight = panelHeight - 33.0;
const float diffRectOutHeight = panelHeight - 21.5;
const float diffRectInNegHeight = panelHeight - 46.3f;
const float diffRectInPosHeight = panelHeight - 33.0f;
const float diffRectOutHeight = panelHeight - 21.5f;

addInput(createInput<PJ301MPort>(mm2px(Vec(jackX1, neuronRow1Height)), module, DoubleNeuron::NEURON1IN1_INPUT));
addInput(createInput<PJ301MPort>(mm2px(Vec(jackX2, neuronRow1Height)), module, DoubleNeuron::NEURON1IN2_INPUT));
Expand Down
4 changes: 2 additions & 2 deletions src/FourSeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ struct FourSeqWidget : ModuleWidget {
const float divJacksY = 96.0f;
float lightX = 4.5f;
float lightY = 108.0f;
int spacing = 10.0f;
float spacing = 10.0f;

for (int i = 0; i < 4; i++)
{
int xOffset = i * spacing;
float xOffset = i * spacing;
addOutput(createOutput<PJ301MPort>(mm2px(Vec(divJacksX + xOffset, divJacksY)), module, FourSeq::OUT1_OUTPUT + i));
addChild(createLight<SmallLight<BlueLight>>(mm2px(Vec(lightX + xOffset, lightY)), module, FourSeq::OUT1_LIGHT + i));
}
Expand Down
6 changes: 3 additions & 3 deletions src/NLCShared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NLCNeuron
lastInput = _in;
}

float process()
float process() const
{
float rectifiedInput = rack::math::clamp(lastInput + sense, 0.0f, 10.0f);

Expand Down Expand Up @@ -97,8 +97,8 @@ class NLCDiffRect
negativeOutput = diff < 0.0f ? diff : 0.0f;
}

float getPositiveOutput(){return positiveOutput;}
float getNegativeOutput(){return negativeOutput;}
float getPositiveOutput() const {return positiveOutput;}
float getNegativeOutput() const {return negativeOutput;}

private:
float lastPositiveInput = 0.0f;
Expand Down
4 changes: 2 additions & 2 deletions src/Numberwang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct Numberwang : Module {
}

NLCTrigger clockIn;
float outs[16];
float outs[16]{};

void numberwangProcess()
{
Expand Down Expand Up @@ -62,7 +62,7 @@ struct Numberwang : Module {
for (int i = 0; i < 16; i++)
{
outputs[i].setVoltage(outs[i]);
lights[i].setSmoothBrightness(outs[i] * 0.2, args.sampleTime);
lights[i].setSmoothBrightness(outs[i] * 0.2f, args.sampleTime);
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/SquidAxon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ struct SquidAxon : Module {
float nonlinearFeedback = 0.0f;
NLCTrigger clockIn;

float squidDiode(const float _input)
static float squidDiode(const float _input)
{
static float diodeScalar = 0.0432477f * 28.0f * 10.0f;
float sign = _input > 0.0f ? 1.0f : -1.0f;

const float diodeIn = std::abs(_input * 0.1f) - 0.667;
const float diodeIn = std::fabs(_input * 0.1f) - 0.667f;
const float diodeStage2 = diodeIn + std::abs(diodeIn);
const float diodeStage3 = diodeStage2 * diodeStage2 * sign;

Expand Down Expand Up @@ -122,7 +122,7 @@ struct SquidAxonWidget : ModuleWidget {
const float jackX4 = jackX3 + jackSpace;

const float inputHeight = 78.7f;
const float outputHeight = inputHeight + 15.8;
const float outputHeight = inputHeight + 15.8f;

addInput(createInput<PJ301MPort>(mm2px(Vec(jackX1, inputHeight)), module, SquidAxon::CLOCK_INPUT));
addInput(createInput<PJ301MPort>(mm2px(Vec(jackX2, inputHeight)), module, SquidAxon::IN1_INPUT));
Expand Down
2 changes: 1 addition & 1 deletion src/Statues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct Statues : Module {
NUM_LIGHTS = NUM_OUTPUTS*2
};

float outs[8];
float outs[8]{};

Statues() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
Expand Down

0 comments on commit 093daf0

Please sign in to comment.