Browse Source

Apply astyle code formatting.

tags/v1.3.0
Andrew Belt 2 years ago
parent
commit
7a4d7dac43
20 changed files with 236 additions and 225 deletions
  1. +3
    -3
      src/8vert.cpp
  2. +3
    -3
      src/ADSR.cpp
  3. +6
    -6
      src/Delay.cpp
  4. +35
    -24
      src/LFO.cpp
  5. +16
    -16
      src/Merge.cpp
  6. +3
    -3
      src/MidSide.cpp
  7. +11
    -11
      src/Mutes.cpp
  8. +19
    -19
      src/Octave.cpp
  9. +18
    -18
      src/Quantizer.cpp
  10. +28
    -28
      src/SEQ3.cpp
  11. +25
    -25
      src/Scope.cpp
  12. +5
    -5
      src/SequentialSwitch.cpp
  13. +3
    -3
      src/Split.cpp
  14. +3
    -3
      src/Sum.cpp
  15. +12
    -12
      src/Unity.cpp
  16. +22
    -22
      src/VCA.cpp
  17. +5
    -5
      src/VCF.cpp
  18. +3
    -3
      src/VCMixer.cpp
  19. +10
    -10
      src/VCO.cpp
  20. +6
    -6
      src/Viz.cpp

+ 3
- 3
src/8vert.cpp View File

@@ -25,7 +25,7 @@ struct _8vert : Module {
}
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float in[16] = {10.f};
int channels = 1;

@@ -54,7 +54,7 @@ struct _8vert : Module {


struct _8vertWidget : ModuleWidget {
_8vertWidget(_8vert *module) {
_8vertWidget(_8vert* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/8vert.svg")));

@@ -93,4 +93,4 @@ struct _8vertWidget : ModuleWidget {
};


Model *model_8vert = createModel<_8vert, _8vertWidget>("8vert");
Model* model_8vert = createModel<_8vert, _8vertWidget>("8vert");

+ 3
- 3
src/ADSR.cpp View File

@@ -59,7 +59,7 @@ struct ADSR : Module {
lightDivider.setDivision(128);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// 0.16-0.19 us serial
// 0.23 us serial with all lambdas computed
// 0.15-0.18 us serial with all lambdas computed with SSE
@@ -149,7 +149,7 @@ struct ADSR : Module {


struct ADSRWidget : ModuleWidget {
ADSRWidget(ADSR *module) {
ADSRWidget(ADSR* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/ADSR.svg")));

@@ -180,4 +180,4 @@ struct ADSRWidget : ModuleWidget {
};


Model *modelADSR = createModel<ADSR, ADSRWidget>("ADSR");
Model* modelADSR = createModel<ADSR, ADSRWidget>("ADSR");

+ 6
- 6
src/Delay.cpp View File

@@ -27,7 +27,7 @@ struct Delay : Module {

dsp::DoubleRingBuffer<float, HISTORY_SIZE> historyBuffer;
dsp::DoubleRingBuffer<float, 16> outBuffer;
SRC_STATE *src;
SRC_STATE* src;
float lastWet = 0.f;
dsp::RCFilter lowpassFilter;
dsp::RCFilter highpassFilter;
@@ -47,7 +47,7 @@ struct Delay : Module {
src_delete(src);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Get input to delay block
float in = inputs[IN_INPUT].getVoltage();
float feedback = params[FEEDBACK_PARAM].getValue() + inputs[FEEDBACK_INPUT].getVoltage() / 10.f;
@@ -119,14 +119,14 @@ struct Delay : Module {


struct DelayWidget : ModuleWidget {
DelayWidget(Delay *module) {
DelayWidget(Delay* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Delay.svg")));

addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(createWidget<ScrewSilver>(Vec(15, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));

addParam(createParam<RoundLargeBlackKnob>(Vec(67, 57), module, Delay::TIME_PARAM));
addParam(createParam<RoundLargeBlackKnob>(Vec(67, 123), module, Delay::FEEDBACK_PARAM));
@@ -143,4 +143,4 @@ struct DelayWidget : ModuleWidget {
};


Model *modelDelay = createModel<Delay, DelayWidget>("Delay");
Model* modelDelay = createModel<Delay, DelayWidget>("Delay");

+ 35
- 24
src/LFO.cpp View File

@@ -37,32 +37,43 @@ struct LowFrequencyOscillator {
}
T sin() {
T p = phase;
if (!bipolar) p -= 0.25f;
T v = simd::sin(2*M_PI * p);
if (invert) v *= -1.f;
if (!bipolar) v += 1.f;
if (!bipolar)
p -= 0.25f;
T v = simd::sin(2 * M_PI * p);
if (invert)
v *= -1.f;
if (!bipolar)
v += 1.f;
return v;
}
T tri() {
T p = phase;
if (bipolar) p += 0.25f;
if (bipolar)
p += 0.25f;
T v = 4.f * simd::fabs(p - simd::round(p)) - 1.f;
if (invert) v *= -1.f;
if (!bipolar) v += 1.f;
if (invert)
v *= -1.f;
if (!bipolar)
v += 1.f;
return v;
}
T saw() {
T p = phase;
if (!bipolar) p -= 0.5f;
if (!bipolar)
p -= 0.5f;
T v = 2.f * (p - simd::round(p));
if (invert) v *= -1.f;
if (!bipolar) v += 1.f;
if (invert)
v *= -1.f;
if (!bipolar)
v += 1.f;
return v;
}
T sqr() {
T v = simd::ifelse(phase < pw, 1.f, -1.f);
if (invert) v *= -1.f;
if (!bipolar) v += 1.f;
if (invert)
v *= -1.f;
if (!bipolar)
v += 1.f;
return v;
}
T light() {
@@ -116,7 +127,7 @@ struct LFO : Module {
lightDivider.setDivision(16);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float freqParam = params[FREQ_PARAM].getValue();
float fm1Param = params[FM1_PARAM].getValue();
float fm2Param = params[FM2_PARAM].getValue();
@@ -126,7 +137,7 @@ struct LFO : Module {
int channels = std::max(1, inputs[FM1_INPUT].getChannels());

for (int c = 0; c < channels; c += 4) {
auto *oscillator = &oscillators[c / 4];
auto* oscillator = &oscillators[c / 4];
oscillator->invert = (params[INVERT_PARAM].getValue() == 0.f);
oscillator->bipolar = (params[OFFSET_PARAM].getValue() == 0.f);

@@ -180,14 +191,14 @@ struct LFO : Module {


struct LFOWidget : ModuleWidget {
LFOWidget(LFO *module) {
LFOWidget(LFO* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/LFO-1.svg")));

addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(createWidget<ScrewSilver>(Vec(15, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));

addParam(createParam<CKSS>(Vec(15, 77), module, LFO::OFFSET_PARAM));
addParam(createParam<CKSS>(Vec(119, 77), module, LFO::INVERT_PARAM));
@@ -213,7 +224,7 @@ struct LFOWidget : ModuleWidget {
};


Model *modelLFO = createModel<LFO, LFOWidget>("LFO");
Model* modelLFO = createModel<LFO, LFOWidget>("LFO");


struct LFO2 : Module {
@@ -253,7 +264,7 @@ struct LFO2 : Module {
lightDivider.setDivision(16);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float freqParam = params[FREQ_PARAM].getValue();
float fmParam = params[FM_PARAM].getValue();
float waveParam = params[WAVE_PARAM].getValue();
@@ -261,7 +272,7 @@ struct LFO2 : Module {
int channels = std::max(1, inputs[FM_INPUT].getChannels());

for (int c = 0; c < channels; c += 4) {
auto *oscillator = &oscillators[c / 4];
auto* oscillator = &oscillators[c / 4];
oscillator->invert = (params[INVERT_PARAM].getValue() == 0.f);
oscillator->bipolar = (params[OFFSET_PARAM].getValue() == 0.f);

@@ -304,14 +315,14 @@ struct LFO2 : Module {


struct LFO2Widget : ModuleWidget {
LFO2Widget(LFO2 *module) {
LFO2Widget(LFO2* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/LFO-2.svg")));

addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(createWidget<ScrewSilver>(Vec(15, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));

addParam(createParam<CKSS>(Vec(62, 150), module, LFO2::OFFSET_PARAM));
addParam(createParam<CKSS>(Vec(62, 215), module, LFO2::INVERT_PARAM));
@@ -331,4 +342,4 @@ struct LFO2Widget : ModuleWidget {
};


Model *modelLFO2 = createModel<LFO2, LFO2Widget>("LFO2");
Model* modelLFO2 = createModel<LFO2, LFO2Widget>("LFO2");

+ 16
- 16
src/Merge.cpp View File

@@ -31,7 +31,7 @@ struct Merge : Module {
channels = -1;
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
int lastChannel = -1;
for (int c = 0; c < 16; c++) {
float v = 0.f;
@@ -54,14 +54,14 @@ struct Merge : Module {
}
}

json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();
json_object_set_new(rootJ, "channels", json_integer(channels));
return rootJ;
}

void dataFromJson(json_t *rootJ) override {
json_t *channelsJ = json_object_get(rootJ, "channels");
void dataFromJson(json_t* rootJ) override {
json_t* channelsJ = json_object_get(rootJ, "channels");
if (channelsJ)
channels = json_integer_value(channelsJ);
}
@@ -69,20 +69,20 @@ struct Merge : Module {


struct MergeChannelItem : MenuItem {
Merge *module;
Merge* module;
int channels;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->channels = channels;
}
};


struct MergeChannelsItem : MenuItem {
Merge *module;
Menu *createChildMenu() override {
Menu *menu = new Menu;
Merge* module;
Menu* createChildMenu() override {
Menu* menu = new Menu;
for (int channels = -1; channels <= 16; channels++) {
MergeChannelItem *item = new MergeChannelItem;
MergeChannelItem* item = new MergeChannelItem;
if (channels < 0)
item->text = "Automatic";
else
@@ -98,7 +98,7 @@ struct MergeChannelsItem : MenuItem {


struct MergeWidget : ModuleWidget {
MergeWidget(Merge *module) {
MergeWidget(Merge* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Merge.svg")));

@@ -144,12 +144,12 @@ struct MergeWidget : ModuleWidget {
addChild(createLightCentered<TinyLight<BlueLight>>(mm2px(Vec(21.276, 23.775)), module, Merge::CHANNEL_LIGHTS + 15));
}

void appendContextMenu(Menu *menu) override {
Merge *module = dynamic_cast<Merge*>(this->module);
void appendContextMenu(Menu* menu) override {
Merge* module = dynamic_cast<Merge*>(this->module);

menu->addChild(new MenuEntry);

MergeChannelsItem *channelsItem = new MergeChannelsItem;
MergeChannelsItem* channelsItem = new MergeChannelsItem;
channelsItem->text = "Channels";
channelsItem->rightText = RIGHT_ARROW;
channelsItem->module = module;
@@ -158,4 +158,4 @@ struct MergeWidget : ModuleWidget {
};


Model *modelMerge = createModel<Merge, MergeWidget>("Merge");
Model* modelMerge = createModel<Merge, MergeWidget>("Merge");

+ 3
- 3
src/MidSide.cpp View File

@@ -33,7 +33,7 @@ struct MidSide : Module {
configParam(DEC_WIDTH_PARAM, 0.f, 2.f, 1.f, "Decoder width", "%", 0, 100);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
using simd::float_4;

// Encoder
@@ -78,7 +78,7 @@ struct MidSide : Module {


struct MidSideWidget : ModuleWidget {
MidSideWidget(MidSide *module) {
MidSideWidget(MidSide* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/MidSide.svg")));

@@ -105,4 +105,4 @@ struct MidSideWidget : ModuleWidget {
};


Model *modelMidSide = createModel<MidSide, MidSideWidget>("MidSide");
Model* modelMidSide = createModel<MidSide, MidSideWidget>("MidSide");

+ 11
- 11
src/Mutes.cpp View File

@@ -25,13 +25,13 @@ struct Mutes : Module {
Mutes() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
for (int i = 0; i < 10; i++) {
configParam(MUTE_PARAM + i, 0.0, 1.0, 0.0, string::f("Ch %d mute", i+1));
configParam(MUTE_PARAM + i, 0.0, 1.0, 0.0, string::f("Ch %d mute", i + 1));
}

onReset();
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
const float zero[16] = {};
float out[16] = {};
int channels = 1;
@@ -71,13 +71,13 @@ struct Mutes : Module {
}
}

json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();

// states
json_t *statesJ = json_array();
json_t* statesJ = json_array();
for (int i = 0; i < 10; i++) {
json_t *stateJ = json_boolean(state[i]);
json_t* stateJ = json_boolean(state[i]);
json_array_append_new(statesJ, stateJ);
}
json_object_set_new(rootJ, "states", statesJ);
@@ -85,12 +85,12 @@ struct Mutes : Module {
return rootJ;
}

void dataFromJson(json_t *rootJ) override {
void dataFromJson(json_t* rootJ) override {
// states
json_t *statesJ = json_object_get(rootJ, "states");
json_t* statesJ = json_object_get(rootJ, "states");
if (statesJ) {
for (int i = 0; i < 10; i++) {
json_t *stateJ = json_array_get(statesJ, i);
json_t* stateJ = json_array_get(statesJ, i);
if (stateJ)
state[i] = json_boolean_value(stateJ);
}
@@ -108,7 +108,7 @@ struct MuteLight : BASE {


struct MutesWidget : ModuleWidget {
MutesWidget(Mutes *module) {
MutesWidget(Mutes* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Mutes.svg")));

@@ -164,4 +164,4 @@ struct MutesWidget : ModuleWidget {
};


Model *modelMutes = createModel<Mutes, MutesWidget>("Mutes");
Model* modelMutes = createModel<Mutes, MutesWidget>("Mutes");

+ 19
- 19
src/Octave.cpp View File

@@ -24,7 +24,7 @@ struct Octave : Module {
configParam(OCTAVE_PARAM, -4.f, 4.f, 0.f, "Octave shift");
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
int channels = std::max(inputs[PITCH_INPUT].getChannels(), 1);
float octaveParam = params[OCTAVE_PARAM].getValue();

@@ -38,9 +38,9 @@ struct Octave : Module {
outputs[PITCH_OUTPUT].setChannels(channels);
}

void dataFromJson(json_t *rootJ) override {
void dataFromJson(json_t* rootJ) override {
// In Fundamental 1.1.1 and earlier, the octave param was internal data.
json_t *octaveJ = json_object_get(rootJ, "octave");
json_t* octaveJ = json_object_get(rootJ, "octave");
if (octaveJ) {
params[OCTAVE_PARAM].setValue(json_integer_value(octaveJ));
}
@@ -51,11 +51,11 @@ struct Octave : Module {
struct OctaveButton : Widget {
int octave;

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
Vec c = box.size.div(2);

int activeOctave = 0;
ParamWidget *paramWidget = getAncestorOfType<ParamWidget>();
ParamWidget* paramWidget = getAncestorOfType<ParamWidget>();
if (paramWidget && paramWidget->paramQuantity) {
activeOctave = std::round(paramWidget->paramQuantity->getValue());
}
@@ -63,7 +63,7 @@ struct OctaveButton : Widget {
if (activeOctave == octave) {
// Enabled
nvgBeginPath(args.vg);
nvgCircle(args.vg, c.x, c.y, mm2px(4.0/2));
nvgCircle(args.vg, c.x, c.y, mm2px(4.0 / 2));
if (octave < 0)
nvgFillColor(args.vg, color::RED);
else if (octave > 0)
@@ -75,32 +75,32 @@ struct OctaveButton : Widget {
else {
// Disabled
nvgBeginPath(args.vg);
nvgCircle(args.vg, c.x, c.y, mm2px(4.0/2));
nvgCircle(args.vg, c.x, c.y, mm2px(4.0 / 2));
nvgFillColor(args.vg, color::alpha(color::WHITE, 0.33));
nvgFill(args.vg);

nvgBeginPath(args.vg);
nvgCircle(args.vg, c.x, c.y, mm2px(3.0/2));
nvgCircle(args.vg, c.x, c.y, mm2px(3.0 / 2));
nvgFillColor(args.vg, color::BLACK);
nvgFill(args.vg);

if (octave == 0) {
nvgBeginPath(args.vg);
nvgCircle(args.vg, c.x, c.y, mm2px(1.0/2));
nvgCircle(args.vg, c.x, c.y, mm2px(1.0 / 2));
nvgFillColor(args.vg, color::alpha(color::WHITE, 0.33));
nvgFill(args.vg);
}
}
}

void onDragHover(const event::DragHover &e) override {
void onDragHover(const event::DragHover& e) override {
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
e.consume(this);
}
Widget::onDragHover(e);
}

void onDragEnter(const event::DragEnter &e) override;
void onDragEnter(const event::DragEnter& e) override;
};


@@ -109,9 +109,9 @@ struct OctaveParam : ParamWidget {
box.size = mm2px(Vec(15.24, 63.0));
const int octaves = 9;
const float margin = mm2px(2.0);
float height = box.size.y - 2*margin;
float height = box.size.y - 2 * margin;
for (int i = 0; i < octaves; i++) {
OctaveButton *octaveButton = new OctaveButton();
OctaveButton* octaveButton = new OctaveButton();
octaveButton->box.pos = Vec(0, height / octaves * i + margin);
octaveButton->box.size = Vec(box.size.x, height / octaves);
octaveButton->octave = 4 - i;
@@ -119,7 +119,7 @@ struct OctaveParam : ParamWidget {
}
}

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
// Background
nvgBeginPath(args.vg);
nvgRect(args.vg, 0, 0, box.size.x, box.size.y);
@@ -131,11 +131,11 @@ struct OctaveParam : ParamWidget {
};


inline void OctaveButton::onDragEnter(const event::DragEnter &e) {
inline void OctaveButton::onDragEnter(const event::DragEnter& e) {
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
OctaveParam *origin = dynamic_cast<OctaveParam*>(e.origin);
OctaveParam* origin = dynamic_cast<OctaveParam*>(e.origin);
if (origin) {
ParamWidget *paramWidget = getAncestorOfType<ParamWidget>();
ParamWidget* paramWidget = getAncestorOfType<ParamWidget>();
if (paramWidget && paramWidget->paramQuantity) {
paramWidget->paramQuantity->setValue(octave);
}
@@ -147,7 +147,7 @@ inline void OctaveButton::onDragEnter(const event::DragEnter &e) {


struct OctaveWidget : ModuleWidget {
OctaveWidget(Octave *module) {
OctaveWidget(Octave* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Octave.svg")));

@@ -164,4 +164,4 @@ struct OctaveWidget : ModuleWidget {
};


Model *modelOctave = createModel<Octave, OctaveWidget>("Octave");
Model* modelOctave = createModel<Octave, OctaveWidget>("Octave");

+ 18
- 18
src/Quantizer.cpp View File

@@ -41,7 +41,7 @@ struct Quantizer : Module {
updateRanges();
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
bool playingNotes[12] = {};
int channels = std::max(inputs[PITCH_INPUT].getChannels(), 1);

@@ -91,10 +91,10 @@ struct Quantizer : Module {
}
}

json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();

json_t *enabledNotesJ = json_array();
json_t* enabledNotesJ = json_array();
for (int i = 0; i < 12; i++) {
json_array_insert_new(enabledNotesJ, i, json_boolean(enabledNotes[i]));
}
@@ -103,11 +103,11 @@ struct Quantizer : Module {
return rootJ;
}

void dataFromJson(json_t *rootJ) override {
json_t *enabledNotesJ = json_object_get(rootJ, "enabledNotes");
void dataFromJson(json_t* rootJ) override {
json_t* enabledNotesJ = json_object_get(rootJ, "enabledNotes");
if (enabledNotesJ) {
for (int i = 0; i < 12; i++) {
json_t *enabledNoteJ = json_array_get(enabledNotesJ, i);
json_t* enabledNoteJ = json_array_get(enabledNotesJ, i);
if (enabledNoteJ)
enabledNotes[i] = json_boolean_value(enabledNoteJ);
}
@@ -119,9 +119,9 @@ struct Quantizer : Module {

struct QuantizerButton : OpaqueWidget {
int note;
Quantizer *module;
Quantizer* module;

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
const float margin = mm2px(1.5);
Rect r = box.zeroPos().grow(Vec(margin, margin / 2).neg());
nvgBeginPath(args.vg);
@@ -138,7 +138,7 @@ struct QuantizerButton : OpaqueWidget {
nvgFill(args.vg);
}

void onDragStart(const event::DragStart &e) override {
void onDragStart(const event::DragStart& e) override {
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
module->enabledNotes[note] ^= true;
module->updateRanges();
@@ -146,9 +146,9 @@ struct QuantizerButton : OpaqueWidget {
OpaqueWidget::onDragStart(e);
}

void onDragEnter(const event::DragEnter &e) override {
void onDragEnter(const event::DragEnter& e) override {
if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
QuantizerButton *origin = dynamic_cast<QuantizerButton*>(e.origin);
QuantizerButton* origin = dynamic_cast<QuantizerButton*>(e.origin);
if (origin) {
module->enabledNotes[note] = module->enabledNotes[origin->note];;
module->updateRanges();
@@ -160,13 +160,13 @@ struct QuantizerButton : OpaqueWidget {


struct QuantizerDisplay : OpaqueWidget {
void setModule(Quantizer *module) {
void setModule(Quantizer* module) {
const float margin = mm2px(1.5) / 2;
box.size = mm2px(Vec(15.24, 72.0));
const int notes = 12;
const float height = box.size.y - 2 * margin;
for (int note = 0; note < notes; note++) {
QuantizerButton *quantizerButton = new QuantizerButton();
QuantizerButton* quantizerButton = new QuantizerButton();
quantizerButton->box.pos = Vec(0, margin + height / notes * note);
quantizerButton->box.size = Vec(box.size.x, height / notes);
quantizerButton->module = module;
@@ -175,7 +175,7 @@ struct QuantizerDisplay : OpaqueWidget {
}
}

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
// Background
nvgBeginPath(args.vg);
nvgRect(args.vg, 0, 0, box.size.x, box.size.y);
@@ -188,7 +188,7 @@ struct QuantizerDisplay : OpaqueWidget {


struct QuantizerWidget : ModuleWidget {
QuantizerWidget(Quantizer *module) {
QuantizerWidget(Quantizer* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Quantizer.svg")));

@@ -199,11 +199,11 @@ struct QuantizerWidget : ModuleWidget {

addOutput(createOutputCentered<PJ301MPort>(mm2px(Vec(7.62, 112.253)), module, Quantizer::PITCH_OUTPUT));

QuantizerDisplay *quantizerDisplay = createWidget<QuantizerDisplay>(mm2px(Vec(0.0, 14.585)));
QuantizerDisplay* quantizerDisplay = createWidget<QuantizerDisplay>(mm2px(Vec(0.0, 14.585)));
quantizerDisplay->setModule(module);
addChild(quantizerDisplay);
}
};


Model *modelQuantizer = createModel<Quantizer, QuantizerWidget>("Quantizer");
Model* modelQuantizer = createModel<Quantizer, QuantizerWidget>("Quantizer");

+ 28
- 28
src/SEQ3.cpp View File

@@ -76,14 +76,14 @@ struct SEQ3 : Module {
}
}

json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();

// running
json_object_set_new(rootJ, "running", json_boolean(running));

// gates
json_t *gatesJ = json_array();
json_t* gatesJ = json_array();
for (int i = 0; i < 8; i++) {
json_array_insert_new(gatesJ, i, json_integer((int) gates[i]));
}
@@ -92,17 +92,17 @@ struct SEQ3 : Module {
return rootJ;
}

void dataFromJson(json_t *rootJ) override {
void dataFromJson(json_t* rootJ) override {
// running
json_t *runningJ = json_object_get(rootJ, "running");
json_t* runningJ = json_object_get(rootJ, "running");
if (runningJ)
running = json_is_true(runningJ);

// gates
json_t *gatesJ = json_object_get(rootJ, "gates");
json_t* gatesJ = json_object_get(rootJ, "gates");
if (gatesJ) {
for (int i = 0; i < 8; i++) {
json_t *gateJ = json_array_get(gatesJ, i);
json_t* gateJ = json_array_get(gatesJ, i);
if (gateJ)
gates[i] = !!json_integer_value(gateJ);
}
@@ -117,7 +117,7 @@ struct SEQ3 : Module {
this->index = 0;
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Run
if (runningTrigger.process(params[RUN_PARAM].getValue())) {
running = !running;
@@ -173,19 +173,19 @@ struct SEQ3 : Module {


struct SEQ3Widget : ModuleWidget {
SEQ3Widget(SEQ3 *module) {
SEQ3Widget(SEQ3* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SEQ3.svg")));

addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(createWidget<ScrewSilver>(Vec(15, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));

addParam(createParam<RoundBlackKnob>(Vec(18, 56), module, SEQ3::CLOCK_PARAM));
addParam(createParam<LEDButton>(Vec(60, 61-1), module, SEQ3::RUN_PARAM));
addParam(createParam<LEDButton>(Vec(60, 61 - 1), module, SEQ3::RUN_PARAM));
addChild(createLight<MediumLight<GreenLight>>(Vec(64.4f, 64.4f), module, SEQ3::RUNNING_LIGHT));
addParam(createParam<LEDButton>(Vec(99, 61-1), module, SEQ3::RESET_PARAM));
addParam(createParam<LEDButton>(Vec(99, 61 - 1), module, SEQ3::RESET_PARAM));
addChild(createLight<MediumLight<GreenLight>>(Vec(103.4f, 64.4f), module, SEQ3::RESET_LIGHT));
addParam(createParam<RoundBlackSnapKnob>(Vec(132, 56), module, SEQ3::STEPS_PARAM));
addChild(createLight<MediumLight<GreenLight>>(Vec(179.4f, 64.4f), module, SEQ3::GATES_LIGHT));
@@ -194,26 +194,26 @@ struct SEQ3Widget : ModuleWidget {
addChild(createLight<MediumLight<GreenLight>>(Vec(295.4f, 64.4f), module, SEQ3::ROW_LIGHTS + 2));

static const float portX[8] = {20, 58, 96, 135, 173, 212, 250, 289};
addInput(createInput<PJ301MPort>(Vec(portX[0]-1, 98), module, SEQ3::CLOCK_INPUT));
addInput(createInput<PJ301MPort>(Vec(portX[1]-1, 98), module, SEQ3::EXT_CLOCK_INPUT));
addInput(createInput<PJ301MPort>(Vec(portX[2]-1, 98), module, SEQ3::RESET_INPUT));
addInput(createInput<PJ301MPort>(Vec(portX[3]-1, 98), module, SEQ3::STEPS_INPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[4]-1, 98), module, SEQ3::GATES_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[5]-1, 98), module, SEQ3::ROW1_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[6]-1, 98), module, SEQ3::ROW2_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[7]-1, 98), module, SEQ3::ROW3_OUTPUT));
addInput(createInput<PJ301MPort>(Vec(portX[0] - 1, 98), module, SEQ3::CLOCK_INPUT));
addInput(createInput<PJ301MPort>(Vec(portX[1] - 1, 98), module, SEQ3::EXT_CLOCK_INPUT));
addInput(createInput<PJ301MPort>(Vec(portX[2] - 1, 98), module, SEQ3::RESET_INPUT));
addInput(createInput<PJ301MPort>(Vec(portX[3] - 1, 98), module, SEQ3::STEPS_INPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[4] - 1, 98), module, SEQ3::GATES_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[5] - 1, 98), module, SEQ3::ROW1_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[6] - 1, 98), module, SEQ3::ROW2_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(portX[7] - 1, 98), module, SEQ3::ROW3_OUTPUT));

for (int i = 0; i < 8; i++) {
addParam(createParam<RoundBlackKnob>(Vec(portX[i]-2, 157), module, SEQ3::ROW1_PARAM + i));
addParam(createParam<RoundBlackKnob>(Vec(portX[i]-2, 198), module, SEQ3::ROW2_PARAM + i));
addParam(createParam<RoundBlackKnob>(Vec(portX[i]-2, 240), module, SEQ3::ROW3_PARAM + i));
addParam(createParam<LEDButton>(Vec(portX[i]+2, 278-1), module, SEQ3::GATE_PARAM + i));
addChild(createLight<MediumLight<GreenLight>>(Vec(portX[i]+6.4f, 281.4f), module, SEQ3::GATE_LIGHTS + i));
addOutput(createOutput<PJ301MPort>(Vec(portX[i]-1, 307), module, SEQ3::GATE_OUTPUT + i));
addParam(createParam<RoundBlackKnob>(Vec(portX[i] - 2, 157), module, SEQ3::ROW1_PARAM + i));
addParam(createParam<RoundBlackKnob>(Vec(portX[i] - 2, 198), module, SEQ3::ROW2_PARAM + i));
addParam(createParam<RoundBlackKnob>(Vec(portX[i] - 2, 240), module, SEQ3::ROW3_PARAM + i));
addParam(createParam<LEDButton>(Vec(portX[i] + 2, 278 - 1), module, SEQ3::GATE_PARAM + i));
addChild(createLight<MediumLight<GreenLight>>(Vec(portX[i] + 6.4f, 281.4f), module, SEQ3::GATE_LIGHTS + i));
addOutput(createOutput<PJ301MPort>(Vec(portX[i] - 1, 307), module, SEQ3::GATE_OUTPUT + i));
}
}
};



Model *modelSEQ3 = createModel<SEQ3, SEQ3Widget>("SEQ3");
Model* modelSEQ3 = createModel<SEQ3, SEQ3Widget>("SEQ3");

+ 25
- 25
src/Scope.cpp View File

@@ -49,12 +49,12 @@ struct Scope : Module {

Scope() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(X_SCALE_PARAM, -2.f, 8.f, 0.f, "X scale", " V/div", 1/2.f, 5);
configParam(X_SCALE_PARAM, -2.f, 8.f, 0.f, "X scale", " V/div", 1 / 2.f, 5);
configParam(X_POS_PARAM, -10.f, 10.f, 0.f, "X position", " V");
configParam(Y_SCALE_PARAM, -2.f, 8.f, 0.f, "Y scale", " V/div", 1/2.f, 5);
configParam(Y_SCALE_PARAM, -2.f, 8.f, 0.f, "Y scale", " V/div", 1 / 2.f, 5);
configParam(Y_POS_PARAM, -10.f, 10.f, 0.f, "Y position", " V");
const float timeBase = (float) BUFFER_SIZE / 6;
configParam(TIME_PARAM, 6.f, 16.f, 14.f, "Time", " ms/div", 1/2.f, 1000 * timeBase);
configParam(TIME_PARAM, 6.f, 16.f, 14.f, "Time", " ms/div", 1 / 2.f, 1000 * timeBase);
configParam(LISSAJOUS_PARAM, 0.f, 1.f, 0.f);
configParam(TRIG_PARAM, -10.f, 10.f, 0.f, "Trigger position", " V");
configParam(EXTERNAL_PARAM, 0.f, 1.f, 0.f);
@@ -67,7 +67,7 @@ struct Scope : Module {
std::memset(bufferY, 0, sizeof(bufferY));
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Modes
if (sumTrigger.process(params[LISSAJOUS_PARAM].getValue() > 0.f)) {
lissajous = !lissajous;
@@ -127,7 +127,7 @@ struct Scope : Module {

// Reset if triggered
float trigThreshold = params[TRIG_PARAM].getValue();
Input &trigInput = external ? inputs[TRIG_INPUT] : inputs[X_INPUT];
Input& trigInput = external ? inputs[TRIG_INPUT] : inputs[X_INPUT];

// This may be 0
int trigChannels = trigInput.getChannels();
@@ -155,19 +155,19 @@ struct Scope : Module {
frameIndex = 0;
}

json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();
json_object_set_new(rootJ, "lissajous", json_integer((int) lissajous));
json_object_set_new(rootJ, "external", json_integer((int) external));
return rootJ;
}

void dataFromJson(json_t *rootJ) override {
json_t *sumJ = json_object_get(rootJ, "lissajous");
void dataFromJson(json_t* rootJ) override {
json_t* sumJ = json_object_get(rootJ, "lissajous");
if (sumJ)
lissajous = json_integer_value(sumJ);

json_t *extJ = json_object_get(rootJ, "external");
json_t* extJ = json_object_get(rootJ, "external");
if (extJ)
external = json_integer_value(extJ);
}
@@ -175,7 +175,7 @@ struct Scope : Module {


struct ScopeDisplay : TransparentWidget {
Scope *module;
Scope* module;
int statsFrame = 0;
std::shared_ptr<Font> font;

@@ -184,7 +184,7 @@ struct ScopeDisplay : TransparentWidget {
float vmin = 0.f;
float vmax = 0.f;

void calculate(float *buffer, int channels) {
void calculate(float* buffer, int channels) {
vmax = -INFINITY;
vmin = INFINITY;
for (int i = 0; i < BUFFER_SIZE * channels; i++) {
@@ -202,10 +202,10 @@ struct ScopeDisplay : TransparentWidget {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/sudo/Sudo.ttf"));
}

void drawWaveform(const DrawArgs &args, float *bufferX, float offsetX, float gainX, float *bufferY, float offsetY, float gainY) {
void drawWaveform(const DrawArgs& args, float* bufferX, float offsetX, float gainX, float* bufferY, float offsetY, float gainY) {
assert(bufferY);
nvgSave(args.vg);
Rect b = Rect(Vec(0, 15), box.size.minus(Vec(0, 15*2)));
Rect b = Rect(Vec(0, 15), box.size.minus(Vec(0, 15 * 2)));
nvgScissor(args.vg, b.pos.x, b.pos.y, b.size.x, b.size.y);
nvgBeginPath(args.vg);
for (int i = 0; i < BUFFER_SIZE; i++) {
@@ -232,8 +232,8 @@ struct ScopeDisplay : TransparentWidget {
nvgRestore(args.vg);
}

void drawTrig(const DrawArgs &args, float value) {
Rect b = Rect(Vec(0, 15), box.size.minus(Vec(0, 15*2)));
void drawTrig(const DrawArgs& args, float value) {
Rect b = Rect(Vec(0, 15), box.size.minus(Vec(0, 15 * 2)));
nvgScissor(args.vg, b.pos.x, b.pos.y, b.size.x, b.size.y);

value = value / 2.f + 0.5f;
@@ -269,7 +269,7 @@ struct ScopeDisplay : TransparentWidget {
nvgResetScissor(args.vg);
}

void drawStats(const DrawArgs &args, Vec pos, const char *title, Stats *stats) {
void drawStats(const DrawArgs& args, Vec pos, const char* title, Stats* stats) {
nvgFontSize(args.vg, 13);
nvgFontFaceId(args.vg, font->handle);
nvgTextLetterSpacing(args.vg, -2);
@@ -286,13 +286,13 @@ struct ScopeDisplay : TransparentWidget {
nvgText(args.vg, pos.x, pos.y, text.c_str(), NULL);
text = "max ";
text += isNear(stats->vmax, 0.f, 100.f) ? string::f("% 6.2f", stats->vmax) : " ---";
nvgText(args.vg, pos.x + 58*1, pos.y, text.c_str(), NULL);
nvgText(args.vg, pos.x + 58 * 1, pos.y, text.c_str(), NULL);
text = "min ";
text += isNear(stats->vmin, 0.f, 100.f) ? string::f("% 6.2f", stats->vmin) : " ---";
nvgText(args.vg, pos.x + 58*2, pos.y, text.c_str(), NULL);
nvgText(args.vg, pos.x + 58 * 2, pos.y, text.c_str(), NULL);
}

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
if (!module)
return;

@@ -341,17 +341,17 @@ struct ScopeDisplay : TransparentWidget {


struct ScopeWidget : ModuleWidget {
ScopeWidget(Scope *module) {
ScopeWidget(Scope* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Scope.svg")));

addChild(createWidget<ScrewSilver>(Vec(15, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 0)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 0)));
addChild(createWidget<ScrewSilver>(Vec(15, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));

{
ScopeDisplay *display = new ScopeDisplay();
ScopeDisplay* display = new ScopeDisplay();
display->module = module;
display->box.pos = Vec(0, 44);
display->box.size = Vec(box.size.x, 140);
@@ -379,4 +379,4 @@ struct ScopeWidget : ModuleWidget {
};


Model *modelScope = createModel<Scope, ScopeWidget>("Scope");
Model* modelScope = createModel<Scope, ScopeWidget>("Scope");

+ 5
- 5
src/SequentialSwitch.cpp View File

@@ -40,7 +40,7 @@ struct SequentialSwitch : Module {
lightDivider.setDivision(512);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Determine current index
if (clockTrigger.process(rescale(inputs[CLOCK_INPUT].getVoltage(), 0.1f, 2.f, 0.f, 1.f))) {
index++;
@@ -107,7 +107,7 @@ struct SequentialSwitch : Module {
struct SequentialSwitch1Widget : ModuleWidget {
typedef SequentialSwitch<1, 4> TSequentialSwitch;

SequentialSwitch1Widget(TSequentialSwitch *module) {
SequentialSwitch1Widget(TSequentialSwitch* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SequentialSwitch1.svg")));

@@ -133,13 +133,13 @@ struct SequentialSwitch1Widget : ModuleWidget {
};


Model *modelSequentialSwitch1 = createModel<SequentialSwitch<1, 4>, SequentialSwitch1Widget>("SequentialSwitch1");
Model* modelSequentialSwitch1 = createModel<SequentialSwitch<1, 4>, SequentialSwitch1Widget>("SequentialSwitch1");


struct SequentialSwitch2Widget : ModuleWidget {
typedef SequentialSwitch<4, 1> TSequentialSwitch;

SequentialSwitch2Widget(TSequentialSwitch *module) {
SequentialSwitch2Widget(TSequentialSwitch* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/SequentialSwitch2.svg")));

@@ -165,4 +165,4 @@ struct SequentialSwitch2Widget : ModuleWidget {
};


Model *modelSequentialSwitch2 = createModel<SequentialSwitch<4, 1>, SequentialSwitch2Widget>("SequentialSwitch2");
Model* modelSequentialSwitch2 = createModel<SequentialSwitch<4, 1>, SequentialSwitch2Widget>("SequentialSwitch2");

+ 3
- 3
src/Split.cpp View File

@@ -25,7 +25,7 @@ struct Split : Module {
lightDivider.setDivision(512);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
for (int c = 0; c < 16; c++) {
float v = inputs[POLY_INPUT].getVoltage(c);
// To allow users to debug buggy modules, don't assume that undefined channel voltages are 0V.
@@ -44,7 +44,7 @@ struct Split : Module {


struct SplitWidget : ModuleWidget {
SplitWidget(Split *module) {
SplitWidget(Split* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Split.svg")));

@@ -92,4 +92,4 @@ struct SplitWidget : ModuleWidget {
};


Model *modelSplit = createModel<Split, SplitWidget>("Split");
Model* modelSplit = createModel<Split, SplitWidget>("Split");

+ 3
- 3
src/Sum.cpp View File

@@ -33,7 +33,7 @@ struct Sum : Module {
lightDivider.setDivision(256);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float sum = inputs[POLY_INPUT].getVoltageSum();
sum *= params[LEVEL_PARAM].getValue();
outputs[MONO_OUTPUT].setVoltage(sum);
@@ -59,7 +59,7 @@ struct Sum : Module {


struct SumWidget : ModuleWidget {
SumWidget(Sum *module) {
SumWidget(Sum* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Sum.svg")));

@@ -101,4 +101,4 @@ struct SumWidget : ModuleWidget {
};


Model *modelSum = createModel<Sum, SumWidget>("Sum");
Model* modelSum = createModel<Sum, SumWidget>("Sum");

+ 12
- 12
src/Unity.cpp View File

@@ -35,7 +35,7 @@ struct Unity : Module {
lightDivider.setDivision(256);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float mix[2] = {};
int count[2] = {};

@@ -82,16 +82,16 @@ struct Unity : Module {
merge = false;
}

json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();
// merge
json_object_set_new(rootJ, "merge", json_boolean(merge));
return rootJ;
}

void dataFromJson(json_t *rootJ) override {
void dataFromJson(json_t* rootJ) override {
// merge
json_t *mergeJ = json_object_get(rootJ, "merge");
json_t* mergeJ = json_object_get(rootJ, "merge");
if (mergeJ)
merge = json_boolean_value(mergeJ);
}
@@ -99,8 +99,8 @@ struct Unity : Module {


struct UnityMergeItem : MenuItem {
Unity *unity;
void onAction(const event::Action &e) override {
Unity* unity;
void onAction(const event::Action& e) override {
unity->merge ^= true;
}
void step() override {
@@ -110,7 +110,7 @@ struct UnityMergeItem : MenuItem {


struct UnityWidget : ModuleWidget {
UnityWidget(Unity *module) {
UnityWidget(Unity* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Unity.svg")));

@@ -152,17 +152,17 @@ struct UnityWidget : ModuleWidget {
addChild(createLight<MediumLight<GreenLight>>(mm2px(Vec(13.652, 95.662)), module, Unity::VU_LIGHTS + 1 * 5 + 4));
}

void appendContextMenu(Menu *menu) override {
void appendContextMenu(Menu* menu) override {
menu->addChild(new MenuEntry);

Unity *unity = dynamic_cast<Unity*>(module);
Unity* unity = dynamic_cast<Unity*>(module);
assert(unity);

UnityMergeItem *mergeItem = createMenuItem<UnityMergeItem>("Merge channels 1 & 2");
UnityMergeItem* mergeItem = createMenuItem<UnityMergeItem>("Merge channels 1 & 2");
mergeItem->unity = unity;
menu->addChild(mergeItem);
}
};


Model *modelUnity = createModel<Unity, UnityWidget>("Unity");
Model* modelUnity = createModel<Unity, UnityWidget>("Unity");

+ 22
- 22
src/VCA.cpp View File

@@ -28,7 +28,7 @@ struct VCA : Module {
configParam(LEVEL2_PARAM, 0.0, 1.0, 1.0, "Ch 2 level", "%", 0, 100);
}

void processChannel(Input &in, Param &level, Input &lin, Input &exp, Output &out) {
void processChannel(Input& in, Param& level, Input& lin, Input& exp, Output& out) {
// Get input
int channels = std::max(in.getChannels(), 1);
simd::float_4 v[4];
@@ -88,7 +88,7 @@ struct VCA : Module {
}
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
processChannel(inputs[IN1_INPUT], params[LEVEL1_PARAM], inputs[LIN1_INPUT], inputs[EXP1_INPUT], outputs[OUT1_OUTPUT]);
processChannel(inputs[IN2_INPUT], params[LEVEL2_PARAM], inputs[LIN2_INPUT], inputs[EXP2_INPUT], outputs[OUT2_OUTPUT]);
}
@@ -97,7 +97,7 @@ struct VCA : Module {


struct VCAWidget : ModuleWidget {
VCAWidget(VCA *module) {
VCAWidget(VCA* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCA.svg")));

@@ -122,7 +122,7 @@ struct VCAWidget : ModuleWidget {
};


Model *modelVCA = createModel<VCA, VCAWidget>("VCA");
Model* modelVCA = createModel<VCA, VCAWidget>("VCA");


struct VCA_1 : Module {
@@ -153,7 +153,7 @@ struct VCA_1 : Module {
configParam(EXP_PARAM, 0.0, 1.0, 1.0, "Response mode");
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
int channels = std::max(inputs[IN_INPUT].getChannels(), 1);
float level = params[LEVEL_PARAM].getValue();

@@ -185,13 +185,13 @@ struct VCA_1 : Module {


struct VCA_1VUKnob : SliderKnob {
VCA_1 *module = NULL;
VCA_1* module = NULL;

VCA_1VUKnob() {
box.size = mm2px(Vec(10, 46));
}

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 2.0);
nvgFillColor(args.vg, nvgRGB(0, 0, 0));
@@ -206,10 +206,10 @@ struct VCA_1VUKnob : SliderKnob {
// Segment value
nvgBeginPath(args.vg);
nvgRect(args.vg,
r.pos.x,
r.pos.y + r.size.y * (1 - value),
r.size.x,
r.size.y * value);
r.pos.x,
r.pos.y + r.size.y * (1 - value),
r.size.x,
r.size.y * value);
nvgFillColor(args.vg, color::mult(color::WHITE, 0.33));
nvgFill(args.vg);

@@ -219,10 +219,10 @@ struct VCA_1VUKnob : SliderKnob {
float gain = module ? module->lastGains[c] : 1.f;
if (gain >= 0.005f) {
nvgRect(args.vg,
r.pos.x + r.size.x * c / channels,
r.pos.y + r.size.y * (1 - gain),
r.size.x / channels,
r.size.y * gain);
r.pos.x + r.size.x * c / channels,
r.pos.y + r.size.y * (1 - gain),
r.size.x / channels,
r.size.y * gain);
}
}
nvgFillColor(args.vg, SCHEME_GREEN);
@@ -233,10 +233,10 @@ struct VCA_1VUKnob : SliderKnob {
nvgBeginPath(args.vg);
for (int i = 1; i <= segs; i++) {
nvgRect(args.vg,
r.pos.x - 1.0,
r.pos.y + r.size.y * i / segs,
r.size.x + 2.0,
1.0);
r.pos.x - 1.0,
r.pos.y + r.size.y * i / segs,
r.size.x + 2.0,
1.0);
}
nvgFillColor(args.vg, color::BLACK);
nvgFill(args.vg);
@@ -245,7 +245,7 @@ struct VCA_1VUKnob : SliderKnob {


struct VCA_1Widget : ModuleWidget {
VCA_1Widget(VCA_1 *module) {
VCA_1Widget(VCA_1* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCA-1.svg")));

@@ -254,7 +254,7 @@ struct VCA_1Widget : ModuleWidget {
addChild(createWidget<ScrewSilver>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));

VCA_1VUKnob *levelParam = createParam<VCA_1VUKnob>(mm2px(Vec(2.62103, 12.31692)), module, VCA_1::LEVEL_PARAM);
VCA_1VUKnob* levelParam = createParam<VCA_1VUKnob>(mm2px(Vec(2.62103, 12.31692)), module, VCA_1::LEVEL_PARAM);
levelParam->module = module;
addParam(levelParam);
addParam(createParam<CKSS>(mm2px(Vec(5.24619, 79.9593)), module, VCA_1::EXP_PARAM));
@@ -267,4 +267,4 @@ struct VCA_1Widget : ModuleWidget {
};


Model *modelVCA_1 = createModel<VCA_1, VCA_1Widget>("VCA-1");
Model* modelVCA_1 = createModel<VCA_1, VCA_1Widget>("VCA-1");

+ 5
- 5
src/VCF.cpp View File

@@ -57,7 +57,7 @@ struct LadderFilter {
}
T highpass() {
// TODO This is incorrect when `resonance > 0`. Is the math wrong?
return clip((input - resonance*state[3]) - 4 * state[0] + 6*state[1] - 4*state[2] + state[3]);
return clip((input - resonance * state[3]) - 4 * state[0] + 6 * state[1] - 4 * state[2] + state[3]);
}
};

@@ -106,7 +106,7 @@ struct VCF : Module {
filters[i].reset();
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
if (!outputs[LPF_OUTPUT].isConnected() && !outputs[HPF_OUTPUT].isConnected()) {
return;
}
@@ -123,7 +123,7 @@ struct VCF : Module {
int channels = std::max(1, inputs[IN_INPUT].getChannels());

for (int c = 0; c < channels; c += 4) {
auto *filter = &filters[c / 4];
auto* filter = &filters[c / 4];

float_4 input = float_4::load(inputs[IN_INPUT].getVoltages(c)) / 5.f;

@@ -186,7 +186,7 @@ struct VCF : Module {


struct VCFWidget : ModuleWidget {
VCFWidget(VCF *module) {
VCFWidget(VCF* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCF.svg")));

@@ -212,4 +212,4 @@ struct VCFWidget : ModuleWidget {
};


Model *modelVCF = createModel<VCF, VCFWidget>("VCF");
Model* modelVCF = createModel<VCF, VCFWidget>("VCF");

+ 3
- 3
src/VCMixer.cpp View File

@@ -39,7 +39,7 @@ struct VCMixer : Module {
lightDivider.setDivision(512);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float mix[16] = {};
int maxChannels = 1;

@@ -123,7 +123,7 @@ struct VCMixer : Module {


struct VCMixerWidget : ModuleWidget {
VCMixerWidget(VCMixer *module) {
VCMixerWidget(VCMixer* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCMixer.svg")));

@@ -158,4 +158,4 @@ struct VCMixerWidget : ModuleWidget {
};


Model *modelVCMixer = createModel<VCMixer, VCMixerWidget>("VCMixer");
Model* modelVCMixer = createModel<VCMixer, VCMixerWidget>("VCMixer");

+ 10
- 10
src/VCO.cpp View File

@@ -9,14 +9,14 @@ template <typename T>
T sin2pi_pade_05_7_6(T x) {
x -= 0.5f;
return (T(-6.28319) * x + T(35.353) * simd::pow(x, 3) - T(44.9043) * simd::pow(x, 5) + T(16.0951) * simd::pow(x, 7))
/ (1 + T(0.953136) * simd::pow(x, 2) + T(0.430238) * simd::pow(x, 4) + T(0.0981408) * simd::pow(x, 6));
/ (1 + T(0.953136) * simd::pow(x, 2) + T(0.430238) * simd::pow(x, 4) + T(0.0981408) * simd::pow(x, 6));
}

template <typename T>
T sin2pi_pade_05_5_4(T x) {
x -= 0.5f;
return (T(-6.283185307) * x + T(33.19863968) * simd::pow(x, 3) - T(32.44191367) * simd::pow(x, 5))
/ (1 + T(1.296008659) * simd::pow(x, 2) + T(0.7028072946) * simd::pow(x, 4));
/ (1 + T(1.296008659) * simd::pow(x, 2) + T(0.7028072946) * simd::pow(x, 4));
}

template <typename T>
@@ -290,7 +290,7 @@ struct VCO : Module {
lightDivider.setDivision(16);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float freqParam = params[FREQ_PARAM].getValue() / 12.f;
freqParam += dsp::quadraticBipolar(params[FINE_PARAM].getValue()) * 3.f / 12.f;
float fmParam = dsp::quadraticBipolar(params[FM_PARAM].getValue());
@@ -298,7 +298,7 @@ struct VCO : Module {
int channels = std::max(inputs[PITCH_INPUT].getChannels(), 1);

for (int c = 0; c < channels; c += 4) {
auto *oscillator = &oscillators[c / 4];
auto* oscillator = &oscillators[c / 4];
oscillator->channels = std::min(channels - c, 4);
oscillator->analog = params[MODE_PARAM].getValue() > 0.f;
oscillator->soft = params[SYNC_PARAM].getValue() <= 0.f;
@@ -349,7 +349,7 @@ struct VCO : Module {


struct VCOWidget : ModuleWidget {
VCOWidget(VCO *module) {
VCOWidget(VCO* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCO-1.svg")));

@@ -382,7 +382,7 @@ struct VCOWidget : ModuleWidget {
};


Model *modelVCO = createModel<VCO, VCOWidget>("VCO");
Model* modelVCO = createModel<VCO, VCOWidget>("VCO");


struct VCO2 : Module {
@@ -422,7 +422,7 @@ struct VCO2 : Module {
lightDivider.setDivision(16);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float freqParam = params[FREQ_PARAM].getValue() / 12.f;
float fmParam = dsp::quadraticBipolar(params[FM_PARAM].getValue());
float waveParam = params[WAVE_PARAM].getValue();
@@ -430,7 +430,7 @@ struct VCO2 : Module {
int channels = std::max(inputs[FM_INPUT].getChannels(), 1);

for (int c = 0; c < channels; c += 4) {
auto *oscillator = &oscillators[c / 4];
auto* oscillator = &oscillators[c / 4];
oscillator->channels = std::min(channels - c, 4);
oscillator->analog = (params[MODE_PARAM].getValue() > 0.f);
oscillator->soft = (params[SYNC_PARAM].getValue() <= 0.f);
@@ -477,7 +477,7 @@ struct VCO2 : Module {


struct VCO2Widget : ModuleWidget {
VCO2Widget(VCO2 *module) {
VCO2Widget(VCO2* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/VCO-2.svg")));

@@ -504,4 +504,4 @@ struct VCO2Widget : ModuleWidget {
};


Model *modelVCO2 = createModel<VCO2, VCO2Widget>("VCO2");
Model* modelVCO2 = createModel<VCO2, VCO2Widget>("VCO2");

+ 6
- 6
src/Viz.cpp View File

@@ -25,7 +25,7 @@ struct Viz : Module {
lightDivider.setDivision(16);
}

void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
if (lightDivider.process()) {
lastChannel = inputs[POLY_INPUT].getChannels();
float deltaTime = args.sampleTime * lightDivider.getDivision();
@@ -41,7 +41,7 @@ struct Viz : Module {


struct VizDisplay : Widget {
Viz *module;
Viz* module;
std::shared_ptr<Font> font;

VizDisplay() {
@@ -49,7 +49,7 @@ struct VizDisplay : Widget {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/nunito/Nunito-Bold.ttf"));
}

void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
for (int c = 0; c < 16; c++) {
Vec p = Vec(15, 16 + (float) c / 16 * (box.size.y - 10));
std::string text = string::f("%d", c + 1);
@@ -69,7 +69,7 @@ struct VizDisplay : Widget {


struct VizWidget : ModuleWidget {
VizWidget(Viz *module) {
VizWidget(Viz* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Viz.svg")));

@@ -97,11 +97,11 @@ struct VizWidget : ModuleWidget {
addChild(createLightCentered<SmallLight<GreenRedLight>>(mm2px(Vec(10.854, 107.681)), module, Viz::VU_LIGHTS + 14 * 2));
addChild(createLightCentered<SmallLight<GreenRedLight>>(mm2px(Vec(10.854, 112.971)), module, Viz::VU_LIGHTS + 15 * 2));

VizDisplay *vizDisplay = createWidget<VizDisplay>(mm2px(Vec(0.0, 29.235)));
VizDisplay* vizDisplay = createWidget<VizDisplay>(mm2px(Vec(0.0, 29.235)));
vizDisplay->module = module;
addChild(vizDisplay);
}
};


Model *modelViz = createModel<Viz, VizWidget>("Viz");
Model* modelViz = createModel<Viz, VizWidget>("Viz");

Loading…
Cancel
Save