Browse Source

Autoformat code.

tags/v1.2.0
Andrew Belt 5 years ago
parent
commit
4155b0b2d7
19 changed files with 346 additions and 346 deletions
  1. +7
    -7
      src/Blinds.cpp
  2. +24
    -24
      src/Braids.cpp
  3. +17
    -17
      src/Branches.cpp
  4. +29
    -29
      src/Clouds.cpp
  5. +18
    -18
      src/Elements.cpp
  6. +35
    -35
      src/Frames.cpp
  7. +3
    -3
      src/Kinks.cpp
  8. +3
    -3
      src/Links.cpp
  9. +44
    -44
      src/Marbles.cpp
  10. +22
    -22
      src/Plaits.cpp
  11. +26
    -26
      src/Rings.cpp
  12. +5
    -5
      src/Shades.cpp
  13. +21
    -21
      src/Stages.cpp
  14. +22
    -22
      src/Tides.cpp
  15. +31
    -31
      src/Tides2.cpp
  16. +5
    -5
      src/Veils.cpp
  17. +14
    -14
      src/Warps.cpp
  18. +2
    -2
      src/plugin.cpp
  19. +18
    -18
      src/plugin.hpp

+ 7
- 7
src/Blinds.cpp View File

@@ -55,18 +55,18 @@ struct Blinds : Module {
configParam(MOD4_PARAM, -1.0, 1.0, 0.0, "Modulation 4"); configParam(MOD4_PARAM, -1.0, 1.0, 0.0, "Modulation 4");
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float out = 0.0; float out = 0.0;


for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
float g = params[GAIN1_PARAM + i].getValue(); float g = params[GAIN1_PARAM + i].getValue();
g += params[MOD1_PARAM + i].getValue() * inputs[CV1_INPUT + i].getVoltage() / 5.0; g += params[MOD1_PARAM + i].getValue() * inputs[CV1_INPUT + i].getVoltage() / 5.0;
g = clamp(g, -2.0f, 2.0f); g = clamp(g, -2.0f, 2.0f);
lights[CV1_POS_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, g), args.sampleTime);
lights[CV1_NEG_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, -g), args.sampleTime);
lights[CV1_POS_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, g), args.sampleTime);
lights[CV1_NEG_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, -g), args.sampleTime);
out += g * inputs[IN1_INPUT + i].getNormalVoltage(5.0); out += g * inputs[IN1_INPUT + i].getNormalVoltage(5.0);
lights[OUT1_POS_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, out / 5.0), args.sampleTime);
lights[OUT1_NEG_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, -out / 5.0), args.sampleTime);
lights[OUT1_POS_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, out / 5.0), args.sampleTime);
lights[OUT1_NEG_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, -out / 5.0), args.sampleTime);
if (outputs[OUT1_OUTPUT + i].isConnected()) { if (outputs[OUT1_OUTPUT + i].isConnected()) {
outputs[OUT1_OUTPUT + i].setVoltage(out); outputs[OUT1_OUTPUT + i].setVoltage(out);
out = 0.0; out = 0.0;
@@ -77,7 +77,7 @@ struct Blinds : Module {




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


@@ -124,4 +124,4 @@ struct BlindsWidget : ModuleWidget {
}; };




Model *modelBlinds = createModel<Blinds, BlindsWidget>("Blinds");
Model* modelBlinds = createModel<Blinds, BlindsWidget>("Blinds");

+ 24
- 24
src/Braids.cpp View File

@@ -62,7 +62,7 @@ struct Braids : Module {
settings.signature = 0; settings.signature = 0;
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Trigger // Trigger
bool trig = inputs[TRIG_INPUT].getVoltage() >= 1.0; bool trig = inputs[TRIG_INPUT].getVoltage() >= 1.0;
if (!lastTrig && trig) { if (!lastTrig && trig) {
@@ -146,34 +146,34 @@ struct Braids : Module {
} }
} }


json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t *settingsJ = json_array();
uint8_t *settingsArray = &settings.shape;
json_t* dataToJson() override {
json_t* rootJ = json_object();
json_t* settingsJ = json_array();
uint8_t* settingsArray = &settings.shape;
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
json_t *settingJ = json_integer(settingsArray[i]);
json_t* settingJ = json_integer(settingsArray[i]);
json_array_insert_new(settingsJ, i, settingJ); json_array_insert_new(settingsJ, i, settingJ);
} }
json_object_set_new(rootJ, "settings", settingsJ); json_object_set_new(rootJ, "settings", settingsJ);


json_t *lowCpuJ = json_boolean(lowCpu);
json_t* lowCpuJ = json_boolean(lowCpu);
json_object_set_new(rootJ, "lowCpu", lowCpuJ); json_object_set_new(rootJ, "lowCpu", lowCpuJ);


return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *settingsJ = json_object_get(rootJ, "settings");
void dataFromJson(json_t* rootJ) override {
json_t* settingsJ = json_object_get(rootJ, "settings");
if (settingsJ) { if (settingsJ) {
uint8_t *settingsArray = &settings.shape;
uint8_t* settingsArray = &settings.shape;
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
json_t *settingJ = json_array_get(settingsJ, i);
json_t* settingJ = json_array_get(settingsJ, i);
if (settingJ) if (settingJ)
settingsArray[i] = json_integer_value(settingJ); settingsArray[i] = json_integer_value(settingJ);
} }
} }


json_t *lowCpuJ = json_object_get(rootJ, "lowCpu");
json_t* lowCpuJ = json_object_get(rootJ, "lowCpu");
if (lowCpuJ) { if (lowCpuJ) {
lowCpu = json_boolean_value(lowCpuJ); lowCpu = json_boolean_value(lowCpuJ);
} }
@@ -183,7 +183,7 @@ struct Braids : Module {






static const char *algo_values[] = {
static const char* algo_values[] = {
"CSAW", "CSAW",
"/\\-_", "/\\-_",
"//-_", "//-_",
@@ -235,14 +235,14 @@ static const char *algo_values[] = {
}; };


struct BraidsDisplay : TransparentWidget { struct BraidsDisplay : TransparentWidget {
Braids *module;
Braids* module;
std::shared_ptr<Font> font; std::shared_ptr<Font> font;


BraidsDisplay() { BraidsDisplay() {
font = APP->window->loadFont(asset::plugin(pluginInstance, "res/hdad-segment14-1.002/Segment14.ttf")); font = APP->window->loadFont(asset::plugin(pluginInstance, "res/hdad-segment14-1.002/Segment14.ttf"));
} }


void draw(const DrawArgs &args) override {
void draw(const DrawArgs& args) override {
int shape = module ? module->settings.shape : 0; int shape = module ? module->settings.shape : 0;


// Background // Background
@@ -271,10 +271,10 @@ struct BraidsDisplay : TransparentWidget {




struct BraidsSettingItem : MenuItem { struct BraidsSettingItem : MenuItem {
uint8_t *setting = NULL;
uint8_t* setting = NULL;
uint8_t offValue = 0; uint8_t offValue = 0;
uint8_t onValue = 1; uint8_t onValue = 1;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
// Toggle setting // Toggle setting
*setting = (*setting == onValue) ? offValue : onValue; *setting = (*setting == onValue) ? offValue : onValue;
} }
@@ -285,8 +285,8 @@ struct BraidsSettingItem : MenuItem {
}; };


struct BraidsLowCpuItem : MenuItem { struct BraidsLowCpuItem : MenuItem {
Braids *braids;
void onAction(const event::Action &e) override {
Braids* braids;
void onAction(const event::Action& e) override {
braids->lowCpu = !braids->lowCpu; braids->lowCpu = !braids->lowCpu;
} }
void step() override { void step() override {
@@ -297,12 +297,12 @@ struct BraidsLowCpuItem : MenuItem {




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


{ {
BraidsDisplay *display = new BraidsDisplay();
BraidsDisplay* display = new BraidsDisplay();
display->box.pos = Vec(14, 53); display->box.pos = Vec(14, 53);
display->box.size = Vec(148, 56); display->box.size = Vec(148, 56);
display->module = module; display->module = module;
@@ -332,8 +332,8 @@ struct BraidsWidget : ModuleWidget {
addOutput(createOutput<PJ301MPort>(Vec(205, 316), module, Braids::OUT_OUTPUT)); addOutput(createOutput<PJ301MPort>(Vec(205, 316), module, Braids::OUT_OUTPUT));
} }


void appendContextMenu(Menu *menu) override {
Braids *braids = dynamic_cast<Braids*>(module);
void appendContextMenu(Menu* menu) override {
Braids* braids = dynamic_cast<Braids*>(module);
assert(braids); assert(braids);


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
@@ -346,4 +346,4 @@ struct BraidsWidget : ModuleWidget {
}; };




Model *modelBraids = createModel<Braids, BraidsWidget>("Braids");
Model* modelBraids = createModel<Braids, BraidsWidget>("Braids");

+ 17
- 17
src/Branches.cpp View File

@@ -44,9 +44,9 @@ struct Branches : Module {
configParam(MODE2_PARAM, 0.0, 1.0, 0.0, "Mode 2"); configParam(MODE2_PARAM, 0.0, 1.0, 0.0, "Mode 2");
} }


json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t *modesJ = json_array();
json_t* dataToJson() override {
json_t* rootJ = json_object();
json_t* modesJ = json_array();
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
json_array_insert_new(modesJ, i, json_boolean(modes[i])); json_array_insert_new(modesJ, i, json_boolean(modes[i]));
} }
@@ -54,18 +54,18 @@ struct Branches : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *modesJ = json_object_get(rootJ, "modes");
void dataFromJson(json_t* rootJ) override {
json_t* modesJ = json_object_get(rootJ, "modes");
if (modesJ) { if (modesJ) {
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
json_t *modeJ = json_array_get(modesJ, i);
json_t* modeJ = json_array_get(modesJ, i);
if (modeJ) if (modeJ)
modes[i] = json_boolean_value(modeJ); modes[i] = json_boolean_value(modeJ);
} }
} }
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float gate = 0.0; float gate = 0.0;
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
// mode button // mode button
@@ -90,13 +90,13 @@ struct Branches : Module {
} }


if (!outcomes[i]) if (!outcomes[i])
lights[STATE1_POS_LIGHT + 2*i].value = 1.0;
lights[STATE1_POS_LIGHT + 2 * i].value = 1.0;
else else
lights[STATE1_NEG_LIGHT + 2*i].value = 1.0;
lights[STATE1_NEG_LIGHT + 2 * i].value = 1.0;
} }


lights[STATE1_POS_LIGHT + 2*i].value *= 1.0 - args.sampleTime * 15.0;
lights[STATE1_NEG_LIGHT + 2*i].value *= 1.0 - args.sampleTime * 15.0;
lights[STATE1_POS_LIGHT + 2 * i].value *= 1.0 - args.sampleTime * 15.0;
lights[STATE1_NEG_LIGHT + 2 * i].value *= 1.0 - args.sampleTime * 15.0;
lights[MODE1_LIGHT + i].value = modes[i] ? 1.0 : 0.0; lights[MODE1_LIGHT + i].value = modes[i] ? 1.0 : 0.0;


outputs[OUT1A_OUTPUT + i].setVoltage(outcomes[i] ? 0.0 : gate); outputs[OUT1A_OUTPUT + i].setVoltage(outcomes[i] ? 0.0 : gate);
@@ -114,7 +114,7 @@ struct Branches : Module {




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


@@ -139,14 +139,14 @@ struct BranchesWidget : ModuleWidget {
addChild(createLight<SmallLight<GreenRedLight>>(Vec(40, 325), module, Branches::STATE2_POS_LIGHT)); addChild(createLight<SmallLight<GreenRedLight>>(Vec(40, 325), module, Branches::STATE2_POS_LIGHT));
} }


void appendContextMenu(Menu *menu) override {
Branches *branches = dynamic_cast<Branches*>(module);
void appendContextMenu(Menu* menu) override {
Branches* branches = dynamic_cast<Branches*>(module);
assert(branches); assert(branches);


struct BranchesModeItem : MenuItem { struct BranchesModeItem : MenuItem {
Branches *branches;
Branches* branches;
int channel; int channel;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
branches->modes[channel] ^= 1; branches->modes[channel] ^= 1;
} }
void step() override { void step() override {
@@ -164,4 +164,4 @@ struct BranchesWidget : ModuleWidget {
}; };




Model *modelBranches = createModel<Branches, BranchesWidget>("Branches");
Model* modelBranches = createModel<Branches, BranchesWidget>("Branches");

+ 29
- 29
src/Clouds.cpp View File

@@ -51,9 +51,9 @@ struct Clouds : Module {
dsp::DoubleRingBuffer<dsp::Frame<2>, 256> inputBuffer; dsp::DoubleRingBuffer<dsp::Frame<2>, 256> inputBuffer;
dsp::DoubleRingBuffer<dsp::Frame<2>, 256> outputBuffer; dsp::DoubleRingBuffer<dsp::Frame<2>, 256> outputBuffer;


uint8_t *block_mem;
uint8_t *block_ccm;
clouds::GranularProcessor *processor;
uint8_t* block_mem;
uint8_t* block_ccm;
clouds::GranularProcessor* processor;


bool triggered = false; bool triggered = false;


@@ -98,7 +98,7 @@ struct Clouds : Module {
delete[] block_ccm; delete[] block_ccm;
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Get input // Get input
dsp::Frame<2> inputFrame = {}; dsp::Frame<2> inputFrame = {};
if (!inputBuffer.full()) { if (!inputBuffer.full()) {
@@ -143,7 +143,7 @@ struct Clouds : Module {
processor->set_quality(quality); processor->set_quality(quality);
processor->Prepare(); processor->Prepare();


clouds::Parameters *p = processor->mutable_parameters();
clouds::Parameters* p = processor->mutable_parameters();
p->trigger = triggered; p->trigger = triggered;
p->gate = triggered; p->gate = triggered;
p->freeze = freeze || (inputs[FREEZE_INPUT].getVoltage() >= 1.0); p->freeze = freeze || (inputs[FREEZE_INPUT].getVoltage() >= 1.0);
@@ -208,7 +208,7 @@ struct Clouds : Module {
} }


// Lights // Lights
clouds::Parameters *p = processor->mutable_parameters();
clouds::Parameters* p = processor->mutable_parameters();
dsp::VuMeter vuMeter; dsp::VuMeter vuMeter;
vuMeter.dBInterval = 6.0; vuMeter.dBInterval = 6.0;
dsp::Frame<2> lightFrame = p->freeze ? outputFrame : inputFrame; dsp::Frame<2> lightFrame = p->freeze ? outputFrame : inputFrame;
@@ -231,8 +231,8 @@ struct Clouds : Module {
quality = 0; quality = 0;
} }


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


json_object_set_new(rootJ, "playback", json_integer((int) playback)); json_object_set_new(rootJ, "playback", json_integer((int) playback));
json_object_set_new(rootJ, "quality", json_integer(quality)); json_object_set_new(rootJ, "quality", json_integer(quality));
@@ -241,18 +241,18 @@ struct Clouds : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *playbackJ = json_object_get(rootJ, "playback");
void dataFromJson(json_t* rootJ) override {
json_t* playbackJ = json_object_get(rootJ, "playback");
if (playbackJ) { if (playbackJ) {
playback = (clouds::PlaybackMode) json_integer_value(playbackJ); playback = (clouds::PlaybackMode) json_integer_value(playbackJ);
} }


json_t *qualityJ = json_object_get(rootJ, "quality");
json_t* qualityJ = json_object_get(rootJ, "quality");
if (qualityJ) { if (qualityJ) {
quality = json_integer_value(qualityJ); quality = json_integer_value(qualityJ);
} }


json_t *blendModeJ = json_object_get(rootJ, "blendMode");
json_t* blendModeJ = json_object_get(rootJ, "blendMode");
if (blendModeJ) { if (blendModeJ) {
blendMode = json_integer_value(blendModeJ); blendMode = json_integer_value(blendModeJ);
} }
@@ -262,16 +262,16 @@ struct Clouds : Module {


struct FreezeLight : YellowLight { struct FreezeLight : YellowLight {
FreezeLight() { FreezeLight() {
box.size = Vec(28-6, 28-6);
box.size = Vec(28 - 6, 28 - 6);
bgColor = color::BLACK_TRANSPARENT; bgColor = color::BLACK_TRANSPARENT;
} }
}; };




struct CloudsBlendItem : MenuItem { struct CloudsBlendItem : MenuItem {
Clouds *module;
Clouds* module;
int blendMode; int blendMode;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->blendMode = blendMode; module->blendMode = blendMode;
} }
void step() override { void step() override {
@@ -282,9 +282,9 @@ struct CloudsBlendItem : MenuItem {




struct CloudsPlaybackItem : MenuItem { struct CloudsPlaybackItem : MenuItem {
Clouds *module;
Clouds* module;
clouds::PlaybackMode playback; clouds::PlaybackMode playback;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->playback = playback; module->playback = playback;
} }
void step() override { void step() override {
@@ -295,9 +295,9 @@ struct CloudsPlaybackItem : MenuItem {




struct CloudsQualityItem : MenuItem { struct CloudsQualityItem : MenuItem {
Clouds *module;
Clouds* module;
int quality; int quality;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->quality = quality; module->quality = quality;
} }
void step() override { void step() override {
@@ -308,12 +308,12 @@ struct CloudsQualityItem : MenuItem {




struct CloudsWidget : ModuleWidget { struct CloudsWidget : ModuleWidget {
ParamWidget *blendParam;
ParamWidget *spreadParam;
ParamWidget *feedbackParam;
ParamWidget *reverbParam;
ParamWidget* blendParam;
ParamWidget* spreadParam;
ParamWidget* feedbackParam;
ParamWidget* reverbParam;


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


@@ -356,7 +356,7 @@ struct CloudsWidget : ModuleWidget {
addOutput(createOutput<PJ301MPort>(Vec(188, 317), module, Clouds::OUT_L_OUTPUT)); addOutput(createOutput<PJ301MPort>(Vec(188, 317), module, Clouds::OUT_L_OUTPUT));
addOutput(createOutput<PJ301MPort>(Vec(230, 317), module, Clouds::OUT_R_OUTPUT)); addOutput(createOutput<PJ301MPort>(Vec(230, 317), module, Clouds::OUT_R_OUTPUT));


addChild(createLight<FreezeLight>(Vec(12+3, 43+3), module, Clouds::FREEZE_LIGHT));
addChild(createLight<FreezeLight>(Vec(12 + 3, 43 + 3), module, Clouds::FREEZE_LIGHT));
addChild(createLight<MediumLight<GreenRedLight>>(Vec(82.5, 53), module, Clouds::MIX_GREEN_LIGHT)); addChild(createLight<MediumLight<GreenRedLight>>(Vec(82.5, 53), module, Clouds::MIX_GREEN_LIGHT));
addChild(createLight<MediumLight<GreenRedLight>>(Vec(114.5, 53), module, Clouds::PAN_GREEN_LIGHT)); addChild(createLight<MediumLight<GreenRedLight>>(Vec(114.5, 53), module, Clouds::PAN_GREEN_LIGHT));
addChild(createLight<MediumLight<GreenRedLight>>(Vec(145.5, 53), module, Clouds::FEEDBACK_GREEN_LIGHT)); addChild(createLight<MediumLight<GreenRedLight>>(Vec(145.5, 53), module, Clouds::FEEDBACK_GREEN_LIGHT));
@@ -364,7 +364,7 @@ struct CloudsWidget : ModuleWidget {
} }


void step() override { void step() override {
Clouds *module = dynamic_cast<Clouds*>(this->module);
Clouds* module = dynamic_cast<Clouds*>(this->module);


if (module) { if (module) {
blendParam->visible = (module->blendMode == 0); blendParam->visible = (module->blendMode == 0);
@@ -376,8 +376,8 @@ struct CloudsWidget : ModuleWidget {
ModuleWidget::step(); ModuleWidget::step();
} }


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


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
@@ -404,4 +404,4 @@ struct CloudsWidget : ModuleWidget {
}; };




Model *modelClouds = createModel<Clouds, CloudsWidget>("Clouds");
Model* modelClouds = createModel<Clouds, CloudsWidget>("Clouds");

+ 18
- 18
src/Elements.cpp View File

@@ -76,7 +76,7 @@ struct Elements : Module {
dsp::DoubleRingBuffer<dsp::Frame<2>, 256> outputBuffer; dsp::DoubleRingBuffer<dsp::Frame<2>, 256> outputBuffer;


uint16_t reverb_buffer[32768] = {}; uint16_t reverb_buffer[32768] = {};
elements::Part *part;
elements::Part* part;


Elements() { Elements() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
@@ -122,7 +122,7 @@ struct Elements : Module {
delete part; delete part;
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Get input // Get input
if (!inputBuffer.full()) { if (!inputBuffer.full()) {
dsp::Frame<2> inputFrame; dsp::Frame<2> inputFrame;
@@ -171,14 +171,14 @@ struct Elements : Module {
p->resonator_brightness = BIND(BRIGHTNESS_PARAM, BRIGHTNESS_MOD_PARAM, BRIGHTNESS_MOD_INPUT); p->resonator_brightness = BIND(BRIGHTNESS_PARAM, BRIGHTNESS_MOD_PARAM, BRIGHTNESS_MOD_INPUT);
p->resonator_damping = BIND(DAMPING_PARAM, DAMPING_MOD_PARAM, DAMPING_MOD_INPUT); p->resonator_damping = BIND(DAMPING_PARAM, DAMPING_MOD_PARAM, DAMPING_MOD_INPUT);
p->resonator_position = BIND(POSITION_PARAM, POSITION_MOD_PARAM, POSITION_MOD_INPUT); p->resonator_position = BIND(POSITION_PARAM, POSITION_MOD_PARAM, POSITION_MOD_INPUT);
p->space = clamp(params[SPACE_PARAM].getValue() + params[SPACE_MOD_PARAM].getValue()*inputs[SPACE_MOD_INPUT].getVoltage()/5.0f, 0.0f, 2.0f);
p->space = clamp(params[SPACE_PARAM].getValue() + params[SPACE_MOD_PARAM].getValue() * inputs[SPACE_MOD_INPUT].getVoltage() / 5.0f, 0.0f, 2.0f);


// Get performance inputs // Get performance inputs
elements::PerformanceState performance; elements::PerformanceState performance;
performance.note = 12.0*inputs[NOTE_INPUT].getVoltage() + roundf(params[COARSE_PARAM].getValue()) + params[FINE_PARAM].getValue() + 69.0;
performance.modulation = 3.3*dsp::quarticBipolar(params[FM_PARAM].getValue()) * 49.5 * inputs[FM_INPUT].getVoltage()/5.0;
performance.note = 12.0 * inputs[NOTE_INPUT].getVoltage() + roundf(params[COARSE_PARAM].getValue()) + params[FINE_PARAM].getValue() + 69.0;
performance.modulation = 3.3 * dsp::quarticBipolar(params[FM_PARAM].getValue()) * 49.5 * inputs[FM_INPUT].getVoltage() / 5.0;
performance.gate = params[PLAY_PARAM].getValue() >= 1.0 || inputs[GATE_INPUT].getVoltage() >= 1.0; performance.gate = params[PLAY_PARAM].getValue() >= 1.0 || inputs[GATE_INPUT].getVoltage() >= 1.0;
performance.strength = clamp(1.0 - inputs[STRENGTH_INPUT].getVoltage()/5.0f, 0.0f, 1.0f);
performance.strength = clamp(1.0 - inputs[STRENGTH_INPUT].getVoltage() / 5.0f, 0.0f, 1.0f);


// Generate audio // Generate audio
part->Process(performance, blow, strike, main, aux, 16); part->Process(performance, blow, strike, main, aux, 16);
@@ -212,14 +212,14 @@ struct Elements : Module {
} }
} }


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


void dataFromJson(json_t *rootJ) override {
json_t *modelJ = json_object_get(rootJ, "model");
void dataFromJson(json_t* rootJ) override {
json_t* modelJ = json_object_get(rootJ, "model");
if (modelJ) { if (modelJ) {
setModel(json_integer_value(modelJ)); setModel(json_integer_value(modelJ));
} }
@@ -236,9 +236,9 @@ struct Elements : Module {




struct ElementsModalItem : MenuItem { struct ElementsModalItem : MenuItem {
Elements *elements;
Elements* elements;
int model; int model;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
elements->setModel(model); elements->setModel(model);
} }
void step() override { void step() override {
@@ -249,7 +249,7 @@ struct ElementsModalItem : MenuItem {




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


@@ -316,18 +316,18 @@ struct ElementsWidget : ModuleWidget {


struct GateLight : YellowLight { struct GateLight : YellowLight {
GateLight() { GateLight() {
box.size = Vec(28-6, 28-6);
box.size = Vec(28 - 6, 28 - 6);
bgColor = color::BLACK_TRANSPARENT; bgColor = color::BLACK_TRANSPARENT;
} }
}; };


addChild(createLight<GateLight>(Vec(36+3, 116+3), module, Elements::GATE_LIGHT));
addChild(createLight<GateLight>(Vec(36 + 3, 116 + 3), module, Elements::GATE_LIGHT));
addChild(createLight<MediumLight<GreenLight>>(Vec(184, 165), module, Elements::EXCITER_LIGHT)); addChild(createLight<MediumLight<GreenLight>>(Vec(184, 165), module, Elements::EXCITER_LIGHT));
addChild(createLight<MediumLight<RedLight>>(Vec(395, 165), module, Elements::RESONATOR_LIGHT)); addChild(createLight<MediumLight<RedLight>>(Vec(395, 165), module, Elements::RESONATOR_LIGHT));
} }


void appendContextMenu(Menu *menu) override {
Elements *elements = dynamic_cast<Elements*>(module);
void appendContextMenu(Menu* menu) override {
Elements* elements = dynamic_cast<Elements*>(module);
assert(elements); assert(elements);


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
@@ -339,4 +339,4 @@ struct ElementsWidget : ModuleWidget {
}; };




Model *modelElements = createModel<Elements, ElementsWidget>("Elements");
Model* modelElements = createModel<Elements, ElementsWidget>("Elements");

+ 35
- 35
src/Frames.cpp View File

@@ -69,7 +69,7 @@ struct Frames : Module {
onReset(); onReset();
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Set gain and timestamp knobs // Set gain and timestamp knobs
uint16_t controls[4]; uint16_t controls[4];
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -105,7 +105,7 @@ struct Frames : Module {
keyframer.set_immediate(i, controls[i]); keyframer.set_immediate(i, controls[i]);
} }
if (nearestIndex >= 0) { if (nearestIndex >= 0) {
frames::Keyframe *nearestKeyframe = keyframer.mutable_keyframe(nearestIndex);
frames::Keyframe* nearestKeyframe = keyframer.mutable_keyframe(nearestIndex);
nearestKeyframe->values[i] = controls[i]; nearestKeyframe->values[i] = controls[i];
} }
} }
@@ -187,7 +187,7 @@ struct Frames : Module {
} }


// Set frame light colors // Set frame light colors
const uint8_t *colors;
const uint8_t* colors;
if (poly_lfo_mode) { if (poly_lfo_mode) {
colors = poly_lfo.color(); colors = poly_lfo.color();
} }
@@ -201,14 +201,14 @@ struct Frames : Module {
} }
} }


json_t *dataToJson() override {
json_t *rootJ = json_object();
json_t* dataToJson() override {
json_t* rootJ = json_object();
json_object_set_new(rootJ, "polyLfo", json_boolean(poly_lfo_mode)); json_object_set_new(rootJ, "polyLfo", json_boolean(poly_lfo_mode));


json_t *keyframesJ = json_array();
json_t* keyframesJ = json_array();
for (int i = 0; i < keyframer.num_keyframes(); i++) { for (int i = 0; i < keyframer.num_keyframes(); i++) {
json_t *keyframeJ = json_array();
frames::Keyframe *keyframe = keyframer.mutable_keyframe(i);
json_t* keyframeJ = json_array();
frames::Keyframe* keyframe = keyframer.mutable_keyframe(i);
json_array_append_new(keyframeJ, json_integer(keyframe->timestamp)); json_array_append_new(keyframeJ, json_integer(keyframe->timestamp));
for (int k = 0; k < 4; k++) { for (int k = 0; k < 4; k++) {
json_array_append_new(keyframeJ, json_integer(keyframe->values[k])); json_array_append_new(keyframeJ, json_integer(keyframe->values[k]));
@@ -217,9 +217,9 @@ struct Frames : Module {
} }
json_object_set_new(rootJ, "keyframes", keyframesJ); json_object_set_new(rootJ, "keyframes", keyframesJ);


json_t *channelsJ = json_array();
json_t* channelsJ = json_array();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
json_t *channelJ = json_object();
json_t* channelJ = json_object();
json_object_set_new(channelJ, "curve", json_integer((int) keyframer.mutable_settings(i)->easing_curve)); json_object_set_new(channelJ, "curve", json_integer((int) keyframer.mutable_settings(i)->easing_curve));
json_object_set_new(channelJ, "response", json_integer(keyframer.mutable_settings(i)->response)); json_object_set_new(channelJ, "response", json_integer(keyframer.mutable_settings(i)->response));
json_array_append_new(channelsJ, channelJ); json_array_append_new(channelsJ, channelJ);
@@ -229,14 +229,14 @@ struct Frames : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *polyLfoJ = json_object_get(rootJ, "polyLfo");
void dataFromJson(json_t* rootJ) override {
json_t* polyLfoJ = json_object_get(rootJ, "polyLfo");
if (polyLfoJ) if (polyLfoJ)
poly_lfo_mode = json_boolean_value(polyLfoJ); poly_lfo_mode = json_boolean_value(polyLfoJ);


json_t *keyframesJ = json_object_get(rootJ, "keyframes");
json_t* keyframesJ = json_object_get(rootJ, "keyframes");
if (keyframesJ) { if (keyframesJ) {
json_t *keyframeJ;
json_t* keyframeJ;
size_t i; size_t i;
json_array_foreach(keyframesJ, i, keyframeJ) { json_array_foreach(keyframesJ, i, keyframeJ) {
uint16_t timestamp = json_integer_value(json_array_get(keyframeJ, 0)); uint16_t timestamp = json_integer_value(json_array_get(keyframeJ, 0));
@@ -248,15 +248,15 @@ struct Frames : Module {
} }
} }


json_t *channelsJ = json_object_get(rootJ, "channels");
json_t* channelsJ = json_object_get(rootJ, "channels");
if (channelsJ) { if (channelsJ) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
json_t *channelJ = json_array_get(channelsJ, i);
json_t* channelJ = json_array_get(channelsJ, i);
if (channelJ) { if (channelJ) {
json_t *curveJ = json_object_get(channelJ, "curve");
json_t* curveJ = json_object_get(channelJ, "curve");
if (curveJ) if (curveJ)
keyframer.mutable_settings(i)->easing_curve = (frames::EasingCurve) json_integer_value(curveJ); keyframer.mutable_settings(i)->easing_curve = (frames::EasingCurve) json_integer_value(curveJ);
json_t *responseJ = json_object_get(channelJ, "response");
json_t* responseJ = json_object_get(channelJ, "response");
if (responseJ) if (responseJ)
keyframer.mutable_settings(i)->response = json_integer_value(responseJ); keyframer.mutable_settings(i)->response = json_integer_value(responseJ);
} }
@@ -288,14 +288,14 @@ struct CKSSRot : SVGSwitch {




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


addChild(createWidget<ScrewSilver>(Vec(15, 0))); 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(15, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x-30, 365)));
addChild(createWidget<ScrewSilver>(Vec(box.size.x - 30, 365)));


addParam(createParam<Rogan1PSWhite>(Vec(14, 52), module, Frames::GAIN1_PARAM)); addParam(createParam<Rogan1PSWhite>(Vec(14, 52), module, Frames::GAIN1_PARAM));
addParam(createParam<Rogan1PSWhite>(Vec(81, 52), module, Frames::GAIN2_PARAM)); addParam(createParam<Rogan1PSWhite>(Vec(81, 52), module, Frames::GAIN2_PARAM));
@@ -335,15 +335,15 @@ struct FramesWidget : ModuleWidget {
addChild(createLight<FrameLight>(Vec(100, 126), module, Frames::FRAME_LIGHT)); addChild(createLight<FrameLight>(Vec(100, 126), module, Frames::FRAME_LIGHT));
} }


void appendContextMenu(Menu *menu) override {
Frames *frames = dynamic_cast<Frames*>(module);
void appendContextMenu(Menu* menu) override {
Frames* frames = dynamic_cast<Frames*>(module);
assert(frames); assert(frames);


struct FramesCurveItem : MenuItem { struct FramesCurveItem : MenuItem {
Frames *frames;
Frames* frames;
uint8_t channel; uint8_t channel;
frames::EasingCurve curve; frames::EasingCurve curve;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
frames->keyframer.mutable_settings(channel)->easing_curve = curve; frames->keyframer.mutable_settings(channel)->easing_curve = curve;
} }
void step() override { void step() override {
@@ -353,10 +353,10 @@ struct FramesWidget : ModuleWidget {
}; };


struct FramesResponseItem : MenuItem { struct FramesResponseItem : MenuItem {
Frames *frames;
Frames* frames;
uint8_t channel; uint8_t channel;
uint8_t response; uint8_t response;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
frames->keyframer.mutable_settings(channel)->response = response; frames->keyframer.mutable_settings(channel)->response = response;
} }
void step() override { void step() override {
@@ -366,10 +366,10 @@ struct FramesWidget : ModuleWidget {
}; };


struct FramesChannelSettingsItem : MenuItem { struct FramesChannelSettingsItem : MenuItem {
Frames *frames;
Frames* frames;
uint8_t channel; uint8_t channel;
Menu *createChildMenu() override {
Menu *menu = new Menu();
Menu* createChildMenu() override {
Menu* menu = new Menu();


menu->addChild(construct<MenuLabel>(&MenuLabel::text, string::f("Channel %d", channel + 1))); menu->addChild(construct<MenuLabel>(&MenuLabel::text, string::f("Channel %d", channel + 1)));
menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
@@ -391,16 +391,16 @@ struct FramesWidget : ModuleWidget {
}; };


struct FramesClearItem : MenuItem { struct FramesClearItem : MenuItem {
Frames *frames;
void onAction(const event::Action &e) override {
Frames* frames;
void onAction(const event::Action& e) override {
frames->keyframer.Clear(); frames->keyframer.Clear();
} }
}; };


struct FramesModeItem : MenuItem { struct FramesModeItem : MenuItem {
Frames *frames;
Frames* frames;
bool poly_lfo_mode; bool poly_lfo_mode;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
frames->poly_lfo_mode = poly_lfo_mode; frames->poly_lfo_mode = poly_lfo_mode;
} }
void step() override { void step() override {
@@ -424,4 +424,4 @@ struct FramesWidget : ModuleWidget {
}; };




Model *modelFrames = createModel<Frames, FramesWidget>("Frames");
Model* modelFrames = createModel<Frames, FramesWidget>("Frames");

+ 3
- 3
src/Kinks.cpp View File

@@ -37,7 +37,7 @@ struct Kinks : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Gaussian noise generator // Gaussian noise generator
float noise = 2.0 * random::normal(); float noise = 2.0 * random::normal();


@@ -68,7 +68,7 @@ struct Kinks : Module {




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


@@ -97,4 +97,4 @@ struct KinksWidget : ModuleWidget {
}; };




Model *modelKinks = createModel<Kinks, KinksWidget>("Kinks");
Model* modelKinks = createModel<Kinks, KinksWidget>("Kinks");

+ 3
- 3
src/Links.cpp View File

@@ -34,7 +34,7 @@ struct Links : Module {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float inA = inputs[A1_INPUT].getVoltage(); float inA = inputs[A1_INPUT].getVoltage();
float inB = inputs[B1_INPUT].getVoltage() + inputs[B2_INPUT].getVoltage(); float inB = inputs[B1_INPUT].getVoltage() + inputs[B2_INPUT].getVoltage();
float inC = inputs[C1_INPUT].getVoltage() + inputs[C2_INPUT].getVoltage() + inputs[C3_INPUT].getVoltage(); float inC = inputs[C1_INPUT].getVoltage() + inputs[C2_INPUT].getVoltage() + inputs[C3_INPUT].getVoltage();
@@ -57,7 +57,7 @@ struct Links : Module {




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


@@ -86,4 +86,4 @@ struct LinksWidget : ModuleWidget {
}; };




Model *modelLinks = createModel<Links, LinksWidget>("Links");
Model* modelLinks = createModel<Links, LinksWidget>("Links");

+ 44
- 44
src/Marbles.cpp View File

@@ -279,8 +279,8 @@ struct Marbles : Module {
} }
} }


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


json_object_set_new(rootJ, "t_deja_vu", json_boolean(t_deja_vu)); json_object_set_new(rootJ, "t_deja_vu", json_boolean(t_deja_vu));
json_object_set_new(rootJ, "x_deja_vu", json_boolean(x_deja_vu)); json_object_set_new(rootJ, "x_deja_vu", json_boolean(x_deja_vu));
@@ -296,49 +296,49 @@ struct Marbles : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *t_deja_vuJ = json_object_get(rootJ, "t_deja_vu");
void dataFromJson(json_t* rootJ) override {
json_t* t_deja_vuJ = json_object_get(rootJ, "t_deja_vu");
if (t_deja_vuJ) if (t_deja_vuJ)
t_deja_vu = json_boolean_value(t_deja_vuJ); t_deja_vu = json_boolean_value(t_deja_vuJ);


json_t *x_deja_vuJ = json_object_get(rootJ, "x_deja_vu");
json_t* x_deja_vuJ = json_object_get(rootJ, "x_deja_vu");
if (x_deja_vuJ) if (x_deja_vuJ)
x_deja_vu = json_boolean_value(x_deja_vuJ); x_deja_vu = json_boolean_value(x_deja_vuJ);


json_t *t_modeJ = json_object_get(rootJ, "t_mode");
json_t* t_modeJ = json_object_get(rootJ, "t_mode");
if (t_modeJ) if (t_modeJ)
t_mode = json_integer_value(t_modeJ); t_mode = json_integer_value(t_modeJ);


json_t *x_modeJ = json_object_get(rootJ, "x_mode");
json_t* x_modeJ = json_object_get(rootJ, "x_mode");
if (x_modeJ) if (x_modeJ)
x_mode = json_integer_value(x_modeJ); x_mode = json_integer_value(x_modeJ);


json_t *t_rangeJ = json_object_get(rootJ, "t_range");
json_t* t_rangeJ = json_object_get(rootJ, "t_range");
if (t_rangeJ) if (t_rangeJ)
t_range = json_integer_value(t_rangeJ); t_range = json_integer_value(t_rangeJ);


json_t *x_rangeJ = json_object_get(rootJ, "x_range");
json_t* x_rangeJ = json_object_get(rootJ, "x_range");
if (x_rangeJ) if (x_rangeJ)
x_range = json_integer_value(x_rangeJ); x_range = json_integer_value(x_rangeJ);


json_t *externalJ = json_object_get(rootJ, "external");
json_t* externalJ = json_object_get(rootJ, "external");
if (externalJ) if (externalJ)
external = json_boolean_value(externalJ); external = json_boolean_value(externalJ);


json_t *x_scaleJ = json_object_get(rootJ, "x_scale");
json_t* x_scaleJ = json_object_get(rootJ, "x_scale");
if (x_scaleJ) if (x_scaleJ)
x_scale = json_integer_value(x_scaleJ); x_scale = json_integer_value(x_scaleJ);


json_t *y_divider_indexJ = json_object_get(rootJ, "y_divider_index");
json_t* y_divider_indexJ = json_object_get(rootJ, "y_divider_index");
if (y_divider_indexJ) if (y_divider_indexJ)
y_divider_index = json_integer_value(y_divider_indexJ); y_divider_index = json_integer_value(y_divider_indexJ);


json_t *x_clock_source_internalJ = json_object_get(rootJ, "x_clock_source_internal");
json_t* x_clock_source_internalJ = json_object_get(rootJ, "x_clock_source_internal");
if (x_clock_source_internalJ) if (x_clock_source_internalJ)
x_clock_source_internal = json_integer_value(x_clock_source_internalJ); x_clock_source_internal = json_integer_value(x_clock_source_internalJ);
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Buttons // Buttons
if (tDejaVuTrigger.process(params[T_DEJA_VU_PARAM].getValue() <= 0.f)) { if (tDejaVuTrigger.process(params[T_DEJA_VU_PARAM].getValue() <= 0.f)) {
t_deja_vu = !t_deja_vu; t_deja_vu = !t_deja_vu;
@@ -396,21 +396,21 @@ struct Marbles : Module {


lights[EXTERNAL_LIGHT].setBrightness(external); lights[EXTERNAL_LIGHT].setBrightness(external);


outputs[T1_OUTPUT].setVoltage(gates[blockIndex*2 + 0] ? 10.f : 0.f);
lights[T1_LIGHT].setSmoothBrightness(gates[blockIndex*2 + 0], args.sampleTime);
outputs[T1_OUTPUT].setVoltage(gates[blockIndex * 2 + 0] ? 10.f : 0.f);
lights[T1_LIGHT].setSmoothBrightness(gates[blockIndex * 2 + 0], args.sampleTime);
outputs[T2_OUTPUT].setVoltage((ramp_master[blockIndex] < 0.5f) ? 10.f : 0.f); outputs[T2_OUTPUT].setVoltage((ramp_master[blockIndex] < 0.5f) ? 10.f : 0.f);
lights[T2_LIGHT].setSmoothBrightness(ramp_master[blockIndex] < 0.5f, args.sampleTime); lights[T2_LIGHT].setSmoothBrightness(ramp_master[blockIndex] < 0.5f, args.sampleTime);
outputs[T3_OUTPUT].setVoltage(gates[blockIndex*2 + 1] ? 10.f : 0.f);
lights[T3_LIGHT].setSmoothBrightness(gates[blockIndex*2 + 1], args.sampleTime);
outputs[X1_OUTPUT].setVoltage(voltages[blockIndex*4 + 0]);
lights[X1_LIGHT].setSmoothBrightness(voltages[blockIndex*4 + 0], args.sampleTime);
outputs[X2_OUTPUT].setVoltage(voltages[blockIndex*4 + 1]);
lights[X2_LIGHT].setSmoothBrightness(voltages[blockIndex*4 + 1], args.sampleTime);
outputs[X3_OUTPUT].setVoltage(voltages[blockIndex*4 + 2]);
lights[X3_LIGHT].setSmoothBrightness(voltages[blockIndex*4 + 2], args.sampleTime);
outputs[Y_OUTPUT].setVoltage(voltages[blockIndex*4 + 3]);
lights[Y_LIGHT].setSmoothBrightness(voltages[blockIndex*4 + 3], args.sampleTime);
outputs[T3_OUTPUT].setVoltage(gates[blockIndex * 2 + 1] ? 10.f : 0.f);
lights[T3_LIGHT].setSmoothBrightness(gates[blockIndex * 2 + 1], args.sampleTime);
outputs[X1_OUTPUT].setVoltage(voltages[blockIndex * 4 + 0]);
lights[X1_LIGHT].setSmoothBrightness(voltages[blockIndex * 4 + 0], args.sampleTime);
outputs[X2_OUTPUT].setVoltage(voltages[blockIndex * 4 + 1]);
lights[X2_LIGHT].setSmoothBrightness(voltages[blockIndex * 4 + 1], args.sampleTime);
outputs[X3_OUTPUT].setVoltage(voltages[blockIndex * 4 + 2]);
lights[X3_LIGHT].setSmoothBrightness(voltages[blockIndex * 4 + 2], args.sampleTime);
outputs[Y_OUTPUT].setVoltage(voltages[blockIndex * 4 + 3]);
lights[Y_LIGHT].setSmoothBrightness(voltages[blockIndex * 4 + 3], args.sampleTime);
} }


void stepBlock() { void stepBlock() {
@@ -526,7 +526,7 @@ struct CKD6Light : BASE {




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


@@ -585,13 +585,13 @@ struct MarblesWidget : ModuleWidget {
addChild(createLightCentered<MediumLight<GreenLight>>(mm2px(Vec(78.344, 104.794)), module, Marbles::X3_LIGHT)); addChild(createLightCentered<MediumLight<GreenLight>>(mm2px(Vec(78.344, 104.794)), module, Marbles::X3_LIGHT));
} }


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


struct ScaleItem : MenuItem { struct ScaleItem : MenuItem {
Marbles *module;
Marbles* module;
int scale; int scale;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->x_scale = scale; module->x_scale = scale;
} }
}; };
@@ -607,16 +607,16 @@ struct MarblesWidget : ModuleWidget {
"Raag Shri", "Raag Shri",
}; };
for (int i = 0; i < (int) LENGTHOF(scaleLabels); i++) { for (int i = 0; i < (int) LENGTHOF(scaleLabels); i++) {
ScaleItem *item = createMenuItem<ScaleItem>(scaleLabels[i], CHECKMARK(module->x_scale == i));
ScaleItem* item = createMenuItem<ScaleItem>(scaleLabels[i], CHECKMARK(module->x_scale == i));
item->module = module; item->module = module;
item->scale = i; item->scale = i;
menu->addChild(item); menu->addChild(item);
} }


struct XClockSourceInternal : MenuItem { struct XClockSourceInternal : MenuItem {
Marbles *module;
Marbles* module;
int source; int source;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->x_clock_source_internal = source; module->x_clock_source_internal = source;
} }
}; };
@@ -630,24 +630,24 @@ struct MarblesWidget : ModuleWidget {
"T₃ → X₁, X₂, X₃", "T₃ → X₁, X₂, X₃",
}; };
for (int i = 0; i < (int) LENGTHOF(sourceLabels); i++) { for (int i = 0; i < (int) LENGTHOF(sourceLabels); i++) {
XClockSourceInternal *item = createMenuItem<XClockSourceInternal>(sourceLabels[i], CHECKMARK(module->x_clock_source_internal == i));
XClockSourceInternal* item = createMenuItem<XClockSourceInternal>(sourceLabels[i], CHECKMARK(module->x_clock_source_internal == i));
item->module = module; item->module = module;
item->source = i; item->source = i;
menu->addChild(item); menu->addChild(item);
} }


struct YDividerIndexItem : MenuItem { struct YDividerIndexItem : MenuItem {
Marbles *module;
Marbles* module;
int index; int index;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->y_divider_index = index; module->y_divider_index = index;
} }
}; };


struct YDividerItem : MenuItem { struct YDividerItem : MenuItem {
Marbles *module;
Menu *createChildMenu() override {
Menu *menu = new Menu();
Marbles* module;
Menu* createChildMenu() override {
Menu* menu = new Menu();
const std::string yDividerRatioLabels[] = { const std::string yDividerRatioLabels[] = {
"1/64", "1/64",
"1/48", "1/48",
@@ -663,7 +663,7 @@ struct MarblesWidget : ModuleWidget {
"1", "1",
}; };
for (int i = 0; i < (int) LENGTHOF(yDividerRatioLabels); i++) { for (int i = 0; i < (int) LENGTHOF(yDividerRatioLabels); i++) {
YDividerIndexItem *item = createMenuItem<YDividerIndexItem>(yDividerRatioLabels[i], CHECKMARK(module->y_divider_index == i));
YDividerIndexItem* item = createMenuItem<YDividerIndexItem>(yDividerRatioLabels[i], CHECKMARK(module->y_divider_index == i));
item->module = module; item->module = module;
item->index = i; item->index = i;
menu->addChild(item); menu->addChild(item);
@@ -673,11 +673,11 @@ struct MarblesWidget : ModuleWidget {
}; };


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
YDividerItem *yDividerItem = createMenuItem<YDividerItem>("Y divider ratio");
YDividerItem* yDividerItem = createMenuItem<YDividerItem>("Y divider ratio");
yDividerItem->module = module; yDividerItem->module = module;
menu->addChild(yDividerItem); menu->addChild(yDividerItem);
} }
}; };




Model *modelMarbles = createModel<Marbles, MarblesWidget>("Marbles");
Model* modelMarbles = createModel<Marbles, MarblesWidget>("Marbles");

+ 22
- 22
src/Plaits.cpp View File

@@ -2,7 +2,7 @@


#pragma GCC diagnostic push #pragma GCC diagnostic push
#ifndef __clang__ #ifndef __clang__
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wsuggest-override"
#endif #endif
#include "plaits/dsp/voice.h" #include "plaits/dsp/voice.h"
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@@ -88,8 +88,8 @@ struct Plaits : Module {
patch.engine = random::u32() % 16; patch.engine = random::u32() % 16;
} }


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


json_object_set_new(rootJ, "lowCpu", json_boolean(lowCpu)); json_object_set_new(rootJ, "lowCpu", json_boolean(lowCpu));
json_object_set_new(rootJ, "model", json_integer(patch.engine)); json_object_set_new(rootJ, "model", json_integer(patch.engine));
@@ -97,27 +97,27 @@ struct Plaits : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *lowCpuJ = json_object_get(rootJ, "lowCpu");
void dataFromJson(json_t* rootJ) override {
json_t* lowCpuJ = json_object_get(rootJ, "lowCpu");
if (lowCpuJ) if (lowCpuJ)
lowCpu = json_boolean_value(lowCpuJ); lowCpu = json_boolean_value(lowCpuJ);


json_t *modelJ = json_object_get(rootJ, "model");
json_t* modelJ = json_object_get(rootJ, "model");
if (modelJ) if (modelJ)
patch.engine = json_integer_value(modelJ); patch.engine = json_integer_value(modelJ);


// Legacy <=1.0.2 // Legacy <=1.0.2
json_t *lpgColorJ = json_object_get(rootJ, "lpgColor");
json_t* lpgColorJ = json_object_get(rootJ, "lpgColor");
if (lpgColorJ) if (lpgColorJ)
params[LPG_COLOR_PARAM].setValue(json_number_value(lpgColorJ)); params[LPG_COLOR_PARAM].setValue(json_number_value(lpgColorJ));


// Legacy <=1.0.2 // Legacy <=1.0.2
json_t *decayJ = json_object_get(rootJ, "decay");
json_t* decayJ = json_object_get(rootJ, "decay");
if (decayJ) if (decayJ)
params[LPG_DECAY_PARAM].setValue(json_number_value(decayJ)); params[LPG_DECAY_PARAM].setValue(json_number_value(decayJ));
} }


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


if (outputBuffer.empty()) { if (outputBuffer.empty()) {
@@ -270,7 +270,7 @@ static const std::string modelLabels[16] = {
struct PlaitsWidget : ModuleWidget { struct PlaitsWidget : ModuleWidget {
bool lpgMode = false; bool lpgMode = false;


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


@@ -318,43 +318,43 @@ struct PlaitsWidget : ModuleWidget {
addChild(createLight<MediumLight<GreenRedLight>>(mm2px(Vec(28.79498, 61.11827)), module, Plaits::MODEL_LIGHT + 7 * 2)); addChild(createLight<MediumLight<GreenRedLight>>(mm2px(Vec(28.79498, 61.11827)), module, Plaits::MODEL_LIGHT + 7 * 2));
} }


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


struct PlaitsLowCpuItem : MenuItem { struct PlaitsLowCpuItem : MenuItem {
Plaits *module;
void onAction(const event::Action &e) override {
Plaits* module;
void onAction(const event::Action& e) override {
module->lowCpu ^= true; module->lowCpu ^= true;
} }
}; };


struct PlaitsLpgModeItem : MenuItem { struct PlaitsLpgModeItem : MenuItem {
PlaitsWidget *moduleWidget;
void onAction(const event::Action &e) override {
PlaitsWidget* moduleWidget;
void onAction(const event::Action& e) override {
moduleWidget->setLpgMode(!moduleWidget->getLpgMode()); moduleWidget->setLpgMode(!moduleWidget->getLpgMode());
} }
}; };


struct PlaitsModelItem : MenuItem { struct PlaitsModelItem : MenuItem {
Plaits *module;
Plaits* module;
int model; int model;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
module->patch.engine = model; module->patch.engine = model;
} }
}; };


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
PlaitsLowCpuItem *lowCpuItem = createMenuItem<PlaitsLowCpuItem>("Low CPU", CHECKMARK(module->lowCpu));
PlaitsLowCpuItem* lowCpuItem = createMenuItem<PlaitsLowCpuItem>("Low CPU", CHECKMARK(module->lowCpu));
lowCpuItem->module = module; lowCpuItem->module = module;
menu->addChild(lowCpuItem); menu->addChild(lowCpuItem);
PlaitsLpgModeItem *lpgItem = createMenuItem<PlaitsLpgModeItem>("Edit LPG response/decay", CHECKMARK(getLpgMode()));
PlaitsLpgModeItem* lpgItem = createMenuItem<PlaitsLpgModeItem>("Edit LPG response/decay", CHECKMARK(getLpgMode()));
lpgItem->moduleWidget = this; lpgItem->moduleWidget = this;
menu->addChild(lpgItem); menu->addChild(lpgItem);


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
menu->addChild(createMenuLabel("Models")); menu->addChild(createMenuLabel("Models"));
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
PlaitsModelItem *modelItem = createMenuItem<PlaitsModelItem>(modelLabels[i], CHECKMARK(module->patch.engine == i));
PlaitsModelItem* modelItem = createMenuItem<PlaitsModelItem>(modelLabels[i], CHECKMARK(module->patch.engine == i));
modelItem->module = module; modelItem->module = module;
modelItem->model = i; modelItem->model = i;
menu->addChild(modelItem); menu->addChild(modelItem);
@@ -386,4 +386,4 @@ struct PlaitsWidget : ModuleWidget {
}; };




Model *modelPlaits = createModel<Plaits, PlaitsWidget>("Plaits");
Model* modelPlaits = createModel<Plaits, PlaitsWidget>("Plaits");

+ 26
- 26
src/Rings.cpp View File

@@ -83,7 +83,7 @@ struct Rings : Module {
string_synth.Init(reverb_buffer); string_synth.Init(reverb_buffer);
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// TODO // TODO
// "Normalized to a pulse/burst generator that reacts to note changes on the V/OCT input." // "Normalized to a pulse/burst generator that reacts to note changes on the V/OCT input."
// Get input // Get input
@@ -105,7 +105,7 @@ struct Rings : Module {
lights[POLYPHONY_RED_LIGHT].value = (polyphonyMode == 1 || polyphonyMode == 2) ? 1.0 : 0.0; lights[POLYPHONY_RED_LIGHT].value = (polyphonyMode == 1 || polyphonyMode == 2) ? 1.0 : 0.0;


if (modelTrigger.process(params[RESONATOR_PARAM].getValue())) { if (modelTrigger.process(params[RESONATOR_PARAM].getValue())) {
resonatorModel = (rings::ResonatorModel) ((resonatorModel + 1) % 3);
resonatorModel = (rings::ResonatorModel)((resonatorModel + 1) % 3);
} }
int modelColor = resonatorModel % 3; int modelColor = resonatorModel % 3;
lights[RESONATOR_GREEN_LIGHT].value = (modelColor == 0 || modelColor == 1) ? 1.0 : 0.0; lights[RESONATOR_GREEN_LIGHT].value = (modelColor == 0 || modelColor == 1) ? 1.0 : 0.0;
@@ -135,22 +135,22 @@ struct Rings : Module {


// Patch // Patch
rings::Patch patch; rings::Patch patch;
float structure = params[STRUCTURE_PARAM].getValue() + 3.3*dsp::quadraticBipolar(params[STRUCTURE_MOD_PARAM].getValue())*inputs[STRUCTURE_MOD_INPUT].getVoltage()/5.0;
float structure = params[STRUCTURE_PARAM].getValue() + 3.3 * dsp::quadraticBipolar(params[STRUCTURE_MOD_PARAM].getValue()) * inputs[STRUCTURE_MOD_INPUT].getVoltage() / 5.0;
patch.structure = clamp(structure, 0.0f, 0.9995f); patch.structure = clamp(structure, 0.0f, 0.9995f);
patch.brightness = clamp(params[BRIGHTNESS_PARAM].getValue() + 3.3*dsp::quadraticBipolar(params[BRIGHTNESS_MOD_PARAM].getValue())*inputs[BRIGHTNESS_MOD_INPUT].getVoltage()/5.0, 0.0f, 1.0f);
patch.damping = clamp(params[DAMPING_PARAM].getValue() + 3.3*dsp::quadraticBipolar(params[DAMPING_MOD_PARAM].getValue())*inputs[DAMPING_MOD_INPUT].getVoltage()/5.0, 0.0f, 0.9995f);
patch.position = clamp(params[POSITION_PARAM].getValue() + 3.3*dsp::quadraticBipolar(params[POSITION_MOD_PARAM].getValue())*inputs[POSITION_MOD_INPUT].getVoltage()/5.0, 0.0f, 0.9995f);
patch.brightness = clamp(params[BRIGHTNESS_PARAM].getValue() + 3.3 * dsp::quadraticBipolar(params[BRIGHTNESS_MOD_PARAM].getValue()) * inputs[BRIGHTNESS_MOD_INPUT].getVoltage() / 5.0, 0.0f, 1.0f);
patch.damping = clamp(params[DAMPING_PARAM].getValue() + 3.3 * dsp::quadraticBipolar(params[DAMPING_MOD_PARAM].getValue()) * inputs[DAMPING_MOD_INPUT].getVoltage() / 5.0, 0.0f, 0.9995f);
patch.position = clamp(params[POSITION_PARAM].getValue() + 3.3 * dsp::quadraticBipolar(params[POSITION_MOD_PARAM].getValue()) * inputs[POSITION_MOD_INPUT].getVoltage() / 5.0, 0.0f, 0.9995f);


// Performance // Performance
rings::PerformanceState performance_state; rings::PerformanceState performance_state;
performance_state.note = 12.0*inputs[PITCH_INPUT].getNormalVoltage(1/12.0);
performance_state.note = 12.0 * inputs[PITCH_INPUT].getNormalVoltage(1 / 12.0);
float transpose = params[FREQUENCY_PARAM].getValue(); float transpose = params[FREQUENCY_PARAM].getValue();
// Quantize transpose if pitch input is connected // Quantize transpose if pitch input is connected
if (inputs[PITCH_INPUT].isConnected()) { if (inputs[PITCH_INPUT].isConnected()) {
transpose = roundf(transpose); transpose = roundf(transpose);
} }
performance_state.tonic = 12.0 + clamp(transpose, 0.0f, 60.0f); performance_state.tonic = 12.0 + clamp(transpose, 0.0f, 60.0f);
performance_state.fm = clamp(48.0 * 3.3*dsp::quarticBipolar(params[FREQUENCY_MOD_PARAM].getValue()) * inputs[FREQUENCY_MOD_INPUT].getNormalVoltage(1.0)/5.0, -48.0f, 48.0f);
performance_state.fm = clamp(48.0 * 3.3 * dsp::quarticBipolar(params[FREQUENCY_MOD_PARAM].getValue()) * inputs[FREQUENCY_MOD_INPUT].getNormalVoltage(1.0) / 5.0, -48.0f, 48.0f);


performance_state.internal_exciter = !inputs[IN_INPUT].isConnected(); performance_state.internal_exciter = !inputs[IN_INPUT].isConnected();
performance_state.internal_strum = !inputs[STRUM_INPUT].isConnected(); performance_state.internal_strum = !inputs[STRUM_INPUT].isConnected();
@@ -197,19 +197,19 @@ struct Rings : Module {
dsp::Frame<2> outputFrame = outputBuffer.shift(); dsp::Frame<2> outputFrame = outputBuffer.shift();
// "Note that you need to insert a jack into each output to split the signals: when only one jack is inserted, both signals are mixed together." // "Note that you need to insert a jack into each output to split the signals: when only one jack is inserted, both signals are mixed together."
if (outputs[ODD_OUTPUT].isConnected() && outputs[EVEN_OUTPUT].isConnected()) { if (outputs[ODD_OUTPUT].isConnected() && outputs[EVEN_OUTPUT].isConnected()) {
outputs[ODD_OUTPUT].setVoltage(clamp(outputFrame.samples[0], -1.0, 1.0)*5.0);
outputs[EVEN_OUTPUT].setVoltage(clamp(outputFrame.samples[1], -1.0, 1.0)*5.0);
outputs[ODD_OUTPUT].setVoltage(clamp(outputFrame.samples[0], -1.0, 1.0) * 5.0);
outputs[EVEN_OUTPUT].setVoltage(clamp(outputFrame.samples[1], -1.0, 1.0) * 5.0);
} }
else { else {
float v = clamp(outputFrame.samples[0] + outputFrame.samples[1], -1.0, 1.0)*5.0;
float v = clamp(outputFrame.samples[0] + outputFrame.samples[1], -1.0, 1.0) * 5.0;
outputs[ODD_OUTPUT].setVoltage(v); outputs[ODD_OUTPUT].setVoltage(v);
outputs[EVEN_OUTPUT].setVoltage(v); outputs[EVEN_OUTPUT].setVoltage(v);
} }
} }
} }


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


json_object_set_new(rootJ, "polyphony", json_integer(polyphonyMode)); json_object_set_new(rootJ, "polyphony", json_integer(polyphonyMode));
json_object_set_new(rootJ, "model", json_integer((int) resonatorModel)); json_object_set_new(rootJ, "model", json_integer((int) resonatorModel));
@@ -218,18 +218,18 @@ struct Rings : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *polyphonyJ = json_object_get(rootJ, "polyphony");
void dataFromJson(json_t* rootJ) override {
json_t* polyphonyJ = json_object_get(rootJ, "polyphony");
if (polyphonyJ) { if (polyphonyJ) {
polyphonyMode = json_integer_value(polyphonyJ); polyphonyMode = json_integer_value(polyphonyJ);
} }


json_t *modelJ = json_object_get(rootJ, "model");
json_t* modelJ = json_object_get(rootJ, "model");
if (modelJ) { if (modelJ) {
resonatorModel = (rings::ResonatorModel) json_integer_value(modelJ); resonatorModel = (rings::ResonatorModel) json_integer_value(modelJ);
} }


json_t *easterEggJ = json_object_get(rootJ, "easterEgg");
json_t* easterEggJ = json_object_get(rootJ, "easterEgg");
if (easterEggJ) { if (easterEggJ) {
easterEgg = json_boolean_value(easterEggJ); easterEgg = json_boolean_value(easterEggJ);
} }
@@ -242,13 +242,13 @@ struct Rings : Module {


void onRandomize() override { void onRandomize() override {
polyphonyMode = random::u32() % 3; polyphonyMode = random::u32() % 3;
resonatorModel = (rings::ResonatorModel) (random::u32() % 3);
resonatorModel = (rings::ResonatorModel)(random::u32() % 3);
} }
}; };




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


@@ -289,14 +289,14 @@ struct RingsWidget : ModuleWidget {
addChild(createLight<MediumLight<GreenRedLight>>(Vec(162, 43), module, Rings::RESONATOR_GREEN_LIGHT)); addChild(createLight<MediumLight<GreenRedLight>>(Vec(162, 43), module, Rings::RESONATOR_GREEN_LIGHT));
} }


void appendContextMenu(Menu *menu) override {
Rings *rings = dynamic_cast<Rings*>(module);
void appendContextMenu(Menu* menu) override {
Rings* rings = dynamic_cast<Rings*>(module);
assert(rings); assert(rings);


struct RingsModelItem : MenuItem { struct RingsModelItem : MenuItem {
Rings *rings;
Rings* rings;
rings::ResonatorModel model; rings::ResonatorModel model;
void onAction(const event::Action &e) override {
void onAction(const event::Action& e) override {
rings->resonatorModel = model; rings->resonatorModel = model;
} }
void step() override { void step() override {
@@ -306,8 +306,8 @@ struct RingsWidget : ModuleWidget {
}; };


struct RingsEasterEggItem : MenuItem { struct RingsEasterEggItem : MenuItem {
Rings *rings;
void onAction(const event::Action &e) override {
Rings* rings;
void onAction(const event::Action& e) override {
rings->easterEgg = !rings->easterEgg; rings->easterEgg = !rings->easterEgg;
} }
void step() override { void step() override {
@@ -331,4 +331,4 @@ struct RingsWidget : ModuleWidget {
}; };




Model *modelRings = createModel<Rings, RingsWidget>("Rings");
Model* modelRings = createModel<Rings, RingsWidget>("Rings");

+ 5
- 5
src/Shades.cpp View File

@@ -40,7 +40,7 @@ struct Shades : Module {
configParam(MODE3_PARAM, 0.0, 1.0, 1.0, "Attenuverter/Attenuator mode 3"); configParam(MODE3_PARAM, 0.0, 1.0, 1.0, "Attenuverter/Attenuator mode 3");
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float out = 0.0; float out = 0.0;


for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
@@ -54,8 +54,8 @@ struct Shades : Module {
in *= params[GAIN1_PARAM + i].getValue(); in *= params[GAIN1_PARAM + i].getValue();
} }
out += in; out += in;
lights[OUT1_POS_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, out / 5.0), args.sampleTime);
lights[OUT1_NEG_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, -out / 5.0), args.sampleTime);
lights[OUT1_POS_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, out / 5.0), args.sampleTime);
lights[OUT1_NEG_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, -out / 5.0), args.sampleTime);
if (outputs[OUT1_OUTPUT + i].isConnected()) { if (outputs[OUT1_OUTPUT + i].isConnected()) {
outputs[OUT1_OUTPUT + i].setVoltage(out); outputs[OUT1_OUTPUT + i].setVoltage(out);
out = 0.0; out = 0.0;
@@ -66,7 +66,7 @@ struct Shades : Module {




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


@@ -96,4 +96,4 @@ struct ShadesWidget : ModuleWidget {
}; };




Model *modelShades = createModel<Shades, ShadesWidget>("Shades");
Model* modelShades = createModel<Shades, ShadesWidget>("Shades");

+ 21
- 21
src/Stages.cpp View File

@@ -17,7 +17,7 @@ struct LongPressButton {
float pressedTime = 0.f; float pressedTime = 0.f;
dsp::BooleanTrigger trigger; dsp::BooleanTrigger trigger;


Events step(Param &param) {
Events step(Param& param) {
Events result = NO_PRESS; Events result = NO_PRESS;


bool pressed = param.value > 0.f; bool pressed = param.value > 0.f;
@@ -52,7 +52,7 @@ struct GroupBuilder {
GroupInfo groups[NUM_CHANNELS]; GroupInfo groups[NUM_CHANNELS];
int groupCount = 0; int groupCount = 0;


bool buildGroups(std::vector<Input> *gateInputs, size_t first, size_t count) {
bool buildGroups(std::vector<Input>* gateInputs, size_t first, size_t count) {
bool any_gates = false; bool any_gates = false;


GroupInfo nextGroups[NUM_CHANNELS]; GroupInfo nextGroups[NUM_CHANNELS];
@@ -81,7 +81,7 @@ struct GroupBuilder {
else { else {
if (!gated) { if (!gated) {
// We've had a gate, this ungated segment is part of the previous group // We've had a gate, this ungated segment is part of the previous group
nextGroups[currentGroup-1].segment_count++;
nextGroups[currentGroup - 1].segment_count++;
} }
else { else {
// This gated input indicates the start of the next group // This gated input indicates the start of the next group
@@ -102,8 +102,8 @@ struct GroupBuilder {


for (int i = 0; i < groupCount; i++) { for (int i = 0; i < groupCount; i++) {
if (nextGroups[i].segment_count != groups[i].segment_count || if (nextGroups[i].segment_count != groups[i].segment_count ||
nextGroups[i].gated != groups[i].gated ||
nextGroups[i].first_segment != groups[i].first_segment) {
nextGroups[i].gated != groups[i].gated ||
nextGroups[i].first_segment != groups[i].first_segment) {
changed = true; changed = true;
} }


@@ -190,12 +190,12 @@ struct Stages : Module {
onSampleRateChange(); onSampleRateChange();
} }


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


json_t *configurationsJ = json_array();
json_t* configurationsJ = json_array();
for (int i = 0; i < NUM_CHANNELS; i++) { for (int i = 0; i < NUM_CHANNELS; i++) {
json_t *configurationJ = json_object();
json_t* configurationJ = json_object();
json_object_set_new(configurationJ, "type", json_integer(configurations[i].type)); json_object_set_new(configurationJ, "type", json_integer(configurations[i].type));
json_object_set_new(configurationJ, "loop", json_boolean(configurations[i].loop)); json_object_set_new(configurationJ, "loop", json_boolean(configurations[i].loop));
json_array_insert_new(configurationsJ, i, configurationJ); json_array_insert_new(configurationsJ, i, configurationJ);
@@ -205,16 +205,16 @@ struct Stages : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *configurationsJ = json_object_get(rootJ, "configurations");
void dataFromJson(json_t* rootJ) override {
json_t* configurationsJ = json_object_get(rootJ, "configurations");
for (int i = 0; i < NUM_CHANNELS; i++) { for (int i = 0; i < NUM_CHANNELS; i++) {
json_t *configurationJ = json_array_get(configurationsJ, i);
json_t* configurationJ = json_array_get(configurationsJ, i);
if (configurationJ) { if (configurationJ) {
json_t *typeJ = json_object_get(configurationJ, "type");
json_t* typeJ = json_object_get(configurationJ, "type");
if (typeJ) if (typeJ)
configurations[i].type = (stages::segment::Type) json_integer_value(typeJ); configurations[i].type = (stages::segment::Type) json_integer_value(typeJ);


json_t *loopJ = json_object_get(configurationJ, "loop");
json_t* loopJ = json_object_get(configurationJ, "loop");
if (loopJ) if (loopJ)
configurations[i].loop = json_boolean_value(loopJ); configurations[i].loop = json_boolean_value(loopJ);
} }
@@ -242,7 +242,7 @@ struct Stages : Module {
// Process block // Process block
stages::SegmentGenerator::Output out[BLOCK_SIZE] = {}; stages::SegmentGenerator::Output out[BLOCK_SIZE] = {};
for (int i = 0; i < groupBuilder.groupCount; i++) { for (int i = 0; i < groupBuilder.groupCount; i++) {
GroupInfo &group = groupBuilder.groups[i];
GroupInfo& group = groupBuilder.groups[i];


// Check if the config needs applying to the segment generator for this group // Check if the config needs applying to the segment generator for this group
bool apply_config = groups_changed; bool apply_config = groups_changed;
@@ -292,7 +292,7 @@ struct Stages : Module {
} }


void toggleMode(int i) { void toggleMode(int i) {
configurations[i].type = (stages::segment::Type) ((configurations[i].type + 1) % 3);
configurations[i].type = (stages::segment::Type)((configurations[i].type + 1) % 3);
configuration_changed[i] = true; configuration_changed[i] = true;
} }


@@ -307,7 +307,7 @@ struct Stages : Module {
segment_count += groupBuilder.groups[i].segment_count; segment_count += groupBuilder.groups[i].segment_count;


if (segment_count > segment) { if (segment_count > segment) {
GroupInfo &group = groupBuilder.groups[i];
GroupInfo& group = groupBuilder.groups[i];


// See how many loop items we have // See how many loop items we have
int numberOfLoopsInGroup = 0; int numberOfLoopsInGroup = 0;
@@ -329,7 +329,7 @@ struct Stages : Module {
} }
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Oscillate flashing the type lights // Oscillate flashing the type lights
lightOscillatorPhase += 0.5f * args.sampleTime; lightOscillatorPhase += 0.5f * args.sampleTime;
if (lightOscillatorPhase >= 1.0f) if (lightOscillatorPhase >= 1.0f)
@@ -360,7 +360,7 @@ struct Stages : Module {


// Output // Output
for (int i = 0; i < groupBuilder.groupCount; i++) { for (int i = 0; i < groupBuilder.groupCount; i++) {
GroupInfo &group = groupBuilder.groups[i];
GroupInfo& group = groupBuilder.groups[i];


int numberOfLoopsInGroup = 0; int numberOfLoopsInGroup = 0;
for (int j = 0; j < group.segment_count; j++) { for (int j = 0; j < group.segment_count; j++) {
@@ -393,7 +393,7 @@ struct Stages : Module {




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


@@ -457,4 +457,4 @@ struct StagesWidget : ModuleWidget {
}; };




Model *modelStages = createModel<Stages, StagesWidget>("Stages");
Model* modelStages = createModel<Stages, StagesWidget>("Stages");

+ 22
- 22
src/Tides.cpp View File

@@ -66,10 +66,10 @@ struct Tides : Module {
onReset(); onReset();
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
tides::GeneratorMode mode = generator.mode(); tides::GeneratorMode mode = generator.mode();
if (modeTrigger.process(params[MODE_PARAM].getValue())) { if (modeTrigger.process(params[MODE_PARAM].getValue())) {
mode = (tides::GeneratorMode) (((int)mode - 1 + 3) % 3);
mode = (tides::GeneratorMode)(((int)mode - 1 + 3) % 3);
generator.set_mode(mode); generator.set_mode(mode);
} }
lights[MODE_GREEN_LIGHT].value = (mode == 2) ? 1.0 : 0.0; lights[MODE_GREEN_LIGHT].value = (mode == 2) ? 1.0 : 0.0;
@@ -77,7 +77,7 @@ struct Tides : Module {


tides::GeneratorRange range = generator.range(); tides::GeneratorRange range = generator.range();
if (rangeTrigger.process(params[RANGE_PARAM].getValue())) { if (rangeTrigger.process(params[RANGE_PARAM].getValue())) {
range = (tides::GeneratorRange) (((int)range - 1 + 3) % 3);
range = (tides::GeneratorRange)(((int)range - 1 + 3) % 3);
generator.set_range(range); generator.set_range(range);
} }
lights[RANGE_GREEN_LIGHT].value = (range == 2) ? 1.0 : 0.0; lights[RANGE_GREEN_LIGHT].value = (range == 2) ? 1.0 : 0.0;
@@ -160,12 +160,12 @@ struct Tides : Module {
} }


void onRandomize() override { void onRandomize() override {
generator.set_range((tides::GeneratorRange) (random::u32() % 3));
generator.set_mode((tides::GeneratorMode) (random::u32() % 3));
generator.set_range((tides::GeneratorRange)(random::u32() % 3));
generator.set_mode((tides::GeneratorMode)(random::u32() % 3));
} }


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


json_object_set_new(rootJ, "mode", json_integer((int) generator.mode())); json_object_set_new(rootJ, "mode", json_integer((int) generator.mode()));
json_object_set_new(rootJ, "range", json_integer((int) generator.range())); json_object_set_new(rootJ, "range", json_integer((int) generator.range()));
@@ -174,18 +174,18 @@ struct Tides : Module {
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *modeJ = json_object_get(rootJ, "mode");
void dataFromJson(json_t* rootJ) override {
json_t* modeJ = json_object_get(rootJ, "mode");
if (modeJ) { if (modeJ) {
generator.set_mode((tides::GeneratorMode) json_integer_value(modeJ)); generator.set_mode((tides::GeneratorMode) json_integer_value(modeJ));
} }


json_t *rangeJ = json_object_get(rootJ, "range");
json_t* rangeJ = json_object_get(rootJ, "range");
if (rangeJ) { if (rangeJ) {
generator.set_range((tides::GeneratorRange) json_integer_value(rangeJ)); generator.set_range((tides::GeneratorRange) json_integer_value(rangeJ));
} }


json_t *sheepJ = json_object_get(rootJ, "sheep");
json_t* sheepJ = json_object_get(rootJ, "sheep");
if (sheepJ) { if (sheepJ) {
sheep = json_boolean_value(sheepJ); sheep = json_boolean_value(sheepJ);
} }
@@ -194,12 +194,12 @@ struct Tides : Module {




struct TidesWidget : ModuleWidget { struct TidesWidget : ModuleWidget {
SvgPanel *tidesPanel;
SvgPanel *sheepPanel;
SvgPanel* tidesPanel;
SvgPanel* sheepPanel;


TidesWidget(Tides *module) {
TidesWidget(Tides* module) {
setModule(module); setModule(module);
box.size = Vec(15*14, 380);
box.size = Vec(15 * 14, 380);
{ {
tidesPanel = new SvgPanel(); tidesPanel = new SvgPanel();
tidesPanel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Tides.svg"))); tidesPanel->setBackground(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Tides.svg")));
@@ -250,7 +250,7 @@ struct TidesWidget : ModuleWidget {
} }


void step() override { void step() override {
Tides *tides = dynamic_cast<Tides*>(module);
Tides* tides = dynamic_cast<Tides*>(module);


if (tides) { if (tides) {
tidesPanel->visible = !tides->sheep; tidesPanel->visible = !tides->sheep;
@@ -261,22 +261,22 @@ struct TidesWidget : ModuleWidget {
} }




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


struct SheepItem : MenuItem { struct SheepItem : MenuItem {
Tides *module;
void onAction(const event::Action &e) override {
Tides* module;
void onAction(const event::Action& e) override {
module->sheep ^= true; module->sheep ^= true;
} }
}; };


menu->addChild(new MenuSeparator); menu->addChild(new MenuSeparator);
SheepItem *sheepItem = createMenuItem<SheepItem>("Sheep", CHECKMARK(module->sheep));
SheepItem* sheepItem = createMenuItem<SheepItem>("Sheep", CHECKMARK(module->sheep));
sheepItem->module = module; sheepItem->module = module;
menu->addChild(sheepItem); menu->addChild(sheepItem);
} }
}; };




Model *modelTides = createModel<Tides, TidesWidget>("Tides");
Model* modelTides = createModel<Tides, TidesWidget>("Tides");

+ 31
- 31
src/Tides2.cpp View File

@@ -129,16 +129,16 @@ struct Tides2 : Module {


void onRandomize() override { void onRandomize() override {
range = random::u32() % 3; range = random::u32() % 3;
output_mode = (tides2::OutputMode) (random::u32() % 4);
ramp_mode = (tides2::RampMode) (random::u32() % 3);
output_mode = (tides2::OutputMode)(random::u32() % 4);
ramp_mode = (tides2::RampMode)(random::u32() % 3);
} }


void onSampleRateChange() override { void onSampleRateChange() override {
ramp_extractor.Init(APP->engine->getSampleRate(), 40.f / APP->engine->getSampleRate()); ramp_extractor.Init(APP->engine->getSampleRate(), 40.f / APP->engine->getSampleRate());
} }


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


json_object_set_new(rootJ, "range", json_integer(range)); json_object_set_new(rootJ, "range", json_integer(range));
json_object_set_new(rootJ, "output", json_integer(output_mode)); json_object_set_new(rootJ, "output", json_integer(output_mode));
@@ -147,30 +147,30 @@ struct Tides2 : Module {
return rootJ; return rootJ;
} }


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


json_t *outputJ = json_object_get(rootJ, "output");
json_t* outputJ = json_object_get(rootJ, "output");
if (outputJ) if (outputJ)
output_mode = (tides2::OutputMode) json_integer_value(outputJ); output_mode = (tides2::OutputMode) json_integer_value(outputJ);


json_t *rampJ = json_object_get(rootJ, "ramp");
json_t* rampJ = json_object_get(rootJ, "ramp");
if (rampJ) if (rampJ)
ramp_mode = (tides2::RampMode) json_integer_value(rampJ); ramp_mode = (tides2::RampMode) json_integer_value(rampJ);
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// Switches // Switches
if (rangeTrigger.process(params[RANGE_PARAM].getValue() > 0.f)) { if (rangeTrigger.process(params[RANGE_PARAM].getValue() > 0.f)) {
range = (range + 1) % 3; range = (range + 1) % 3;
} }
if (modeTrigger.process(params[MODE_PARAM].getValue() > 0.f)) { if (modeTrigger.process(params[MODE_PARAM].getValue() > 0.f)) {
output_mode = (tides2::OutputMode) ((output_mode + 1) % 4);
output_mode = (tides2::OutputMode)((output_mode + 1) % 4);
} }
if (rampTrigger.process(params[RAMP_PARAM].getValue() > 0.f)) { if (rampTrigger.process(params[RAMP_PARAM].getValue() > 0.f)) {
ramp_mode = (tides2::RampMode) ((ramp_mode + 1) % 3);
ramp_mode = (tides2::RampMode)((ramp_mode + 1) % 3);
} }


// Input gates // Input gates
@@ -199,12 +199,12 @@ struct Tides2 : Module {


tides2::Ratio r = ratio_index_quantizer.Lookup(kRatios, 0.5f + transposition * 0.0105f, 20); tides2::Ratio r = ratio_index_quantizer.Lookup(kRatios, 0.5f + transposition * 0.0105f, 20);
frequency = ramp_extractor.Process( frequency = ramp_extractor.Process(
range_mode == tides2::RANGE_AUDIO,
range_mode == tides2::RANGE_AUDIO && ramp_mode == tides2::RAMP_MODE_AR,
r,
clock_flags,
ramp,
tides2::kBlockSize);
range_mode == tides2::RANGE_AUDIO,
range_mode == tides2::RANGE_AUDIO && ramp_mode == tides2::RAMP_MODE_AR,
r,
clock_flags,
ramp,
tides2::kBlockSize);
must_reset_ramp_extractor = false; must_reset_ramp_extractor = false;
} }
else { else {
@@ -225,18 +225,18 @@ struct Tides2 : Module {


// Render generator // Render generator
poly_slope_generator.Render( poly_slope_generator.Render(
ramp_mode,
output_mode,
range_mode,
frequency,
slope,
shape,
smoothness,
shift,
trig_flags,
!inputs[TRIG_INPUT].isConnected() && inputs[CLOCK_INPUT].isConnected() ? ramp : NULL,
out,
tides2::kBlockSize);
ramp_mode,
output_mode,
range_mode,
frequency,
slope,
shape,
smoothness,
shift,
trig_flags,
!inputs[TRIG_INPUT].isConnected() && inputs[CLOCK_INPUT].isConnected() ? ramp : NULL,
out,
tides2::kBlockSize);


// Set lights // Set lights
lights[RANGE_LIGHT + 0].value = (range == 0 || range == 1); lights[RANGE_LIGHT + 0].value = (range == 0 || range == 1);
@@ -258,7 +258,7 @@ struct Tides2 : Module {




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


@@ -306,4 +306,4 @@ struct Tides2Widget : ModuleWidget {
}; };




Model *modelTides2 = createModel<Tides2, Tides2Widget>("Tides2");
Model* modelTides2 = createModel<Tides2, Tides2Widget>("Tides2");

+ 5
- 5
src/Veils.cpp View File

@@ -51,7 +51,7 @@ struct Veils : Module {
configParam(RESPONSE4_PARAM, 0.0, 1.0, 1.0, "Response curve 4"); configParam(RESPONSE4_PARAM, 0.0, 1.0, 1.0, "Response curve 4");
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
float out = 0.0; float out = 0.0;


for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
@@ -64,8 +64,8 @@ struct Veils : Module {
in *= crossfade(exponential, linear, params[RESPONSE1_PARAM + i].getValue()); in *= crossfade(exponential, linear, params[RESPONSE1_PARAM + i].getValue());
} }
out += in; out += in;
lights[OUT1_POS_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, out / 5.0), args.sampleTime);
lights[OUT1_NEG_LIGHT + 2*i].setSmoothBrightness(fmaxf(0.0, -out / 5.0), args.sampleTime);
lights[OUT1_POS_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, out / 5.0), args.sampleTime);
lights[OUT1_NEG_LIGHT + 2 * i].setSmoothBrightness(fmaxf(0.0, -out / 5.0), args.sampleTime);
if (outputs[OUT1_OUTPUT + i].isConnected()) { if (outputs[OUT1_OUTPUT + i].isConnected()) {
outputs[OUT1_OUTPUT + i].setVoltage(out); outputs[OUT1_OUTPUT + i].setVoltage(out);
out = 0.0; out = 0.0;
@@ -76,7 +76,7 @@ struct Veils : Module {




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


@@ -118,4 +118,4 @@ struct VeilsWidget : ModuleWidget {
}; };




Model *modelVeils = createModel<Veils, VeilsWidget>("Veils");
Model* modelVeils = createModel<Veils, VeilsWidget>("Veils");

+ 14
- 14
src/Warps.cpp View File

@@ -50,9 +50,9 @@ struct Warps : Module {
modulator.Init(96000.0f); modulator.Init(96000.0f);
} }


void process(const ProcessArgs &args) override {
void process(const ProcessArgs& args) override {
// State trigger // State trigger
warps::Parameters *p = modulator.mutable_parameters();
warps::Parameters* p = modulator.mutable_parameters();
if (stateTrigger.process(params[STATE_PARAM].getValue())) { if (stateTrigger.process(params[STATE_PARAM].getValue())) {
p->carrier_shape = (p->carrier_shape + 1) % 4; p->carrier_shape = (p->carrier_shape + 1) % 4;
} }
@@ -87,34 +87,34 @@ struct Warps : Module {
modulator.Process(inputFrames, outputFrames, 60); modulator.Process(inputFrames, outputFrames, 60);
} }


inputFrames[frame].l = clamp((int) (inputs[CARRIER_INPUT].getVoltage() / 16.0 * 0x8000), -0x8000, 0x7fff);
inputFrames[frame].r = clamp((int) (inputs[MODULATOR_INPUT].getVoltage() / 16.0 * 0x8000), -0x8000, 0x7fff);
inputFrames[frame].l = clamp((int)(inputs[CARRIER_INPUT].getVoltage() / 16.0 * 0x8000), -0x8000, 0x7fff);
inputFrames[frame].r = clamp((int)(inputs[MODULATOR_INPUT].getVoltage() / 16.0 * 0x8000), -0x8000, 0x7fff);
outputs[MODULATOR_OUTPUT].setVoltage((float)outputFrames[frame].l / 0x8000 * 5.0); outputs[MODULATOR_OUTPUT].setVoltage((float)outputFrames[frame].l / 0x8000 * 5.0);
outputs[AUX_OUTPUT].setVoltage((float)outputFrames[frame].r / 0x8000 * 5.0); outputs[AUX_OUTPUT].setVoltage((float)outputFrames[frame].r / 0x8000 * 5.0);
} }


json_t *dataToJson() override {
json_t *rootJ = json_object();
warps::Parameters *p = modulator.mutable_parameters();
json_t* dataToJson() override {
json_t* rootJ = json_object();
warps::Parameters* p = modulator.mutable_parameters();
json_object_set_new(rootJ, "shape", json_integer(p->carrier_shape)); json_object_set_new(rootJ, "shape", json_integer(p->carrier_shape));
return rootJ; return rootJ;
} }


void dataFromJson(json_t *rootJ) override {
json_t *shapeJ = json_object_get(rootJ, "shape");
warps::Parameters *p = modulator.mutable_parameters();
void dataFromJson(json_t* rootJ) override {
json_t* shapeJ = json_object_get(rootJ, "shape");
warps::Parameters* p = modulator.mutable_parameters();
if (shapeJ) { if (shapeJ) {
p->carrier_shape = json_integer_value(shapeJ); p->carrier_shape = json_integer_value(shapeJ);
} }
} }


void onReset() override { void onReset() override {
warps::Parameters *p = modulator.mutable_parameters();
warps::Parameters* p = modulator.mutable_parameters();
p->carrier_shape = 0; p->carrier_shape = 0;
} }


void onRandomize() override { void onRandomize() override {
warps::Parameters *p = modulator.mutable_parameters();
warps::Parameters* p = modulator.mutable_parameters();
p->carrier_shape = random::u32() % 4; p->carrier_shape = random::u32() % 4;
} }
}; };
@@ -128,7 +128,7 @@ struct AlgorithmLight : RedGreenBlueLight {




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


@@ -161,4 +161,4 @@ struct WarpsWidget : ModuleWidget {
}; };




Model *modelWarps = createModel<Warps, WarpsWidget>("Warps");
Model* modelWarps = createModel<Warps, WarpsWidget>("Warps");

+ 2
- 2
src/plugin.cpp View File

@@ -1,9 +1,9 @@
#include "plugin.hpp" #include "plugin.hpp"




Plugin *pluginInstance;
Plugin* pluginInstance;


void init(rack::Plugin *p) {
void init(rack::Plugin* p) {
pluginInstance = p; pluginInstance = p;


p->addModel(modelBraids); p->addModel(modelBraids);


+ 18
- 18
src/plugin.hpp View File

@@ -4,23 +4,23 @@
using namespace rack; using namespace rack;




extern Plugin *pluginInstance;
extern Plugin* pluginInstance;


extern Model *modelBraids;
extern Model *modelPlaits;
extern Model *modelElements;
extern Model *modelTides;
extern Model *modelTides2;
extern Model *modelClouds;
extern Model *modelWarps;
extern Model *modelRings;
extern Model *modelLinks;
extern Model *modelKinks;
extern Model *modelShades;
extern Model *modelBranches;
extern Model *modelBlinds;
extern Model *modelVeils;
extern Model *modelFrames;
extern Model *modelStages;
extern Model *modelMarbles;
extern Model* modelBraids;
extern Model* modelPlaits;
extern Model* modelElements;
extern Model* modelTides;
extern Model* modelTides2;
extern Model* modelClouds;
extern Model* modelWarps;
extern Model* modelRings;
extern Model* modelLinks;
extern Model* modelKinks;
extern Model* modelShades;
extern Model* modelBranches;
extern Model* modelBlinds;
extern Model* modelVeils;
extern Model* modelFrames;
extern Model* modelStages;
extern Model* modelMarbles;
extern Model* modelRipples; extern Model* modelRipples;

Loading…
Cancel
Save