Skip to content

Commit

Permalink
Shells of new modules (#892)
Browse files Browse the repository at this point in the history
- Digital Ring Mod
- Bonsai
- Nimbus (Addresses #844)

All stubbed out with screens, and Bonsai and Nimbus actually run effects.
  • Loading branch information
baconpaul committed Jul 1, 2023
1 parent a5a6c58 commit 931e930
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ target_sources(${RACK_PLUGIN_LIB} PRIVATE
src/Delay.cpp
src/DelayLineByFreq.cpp
src/DelayLineByFreqExpanded.cpp
src/DigitalRingMod.cpp
src/EGxVCA.cpp
src/FX.cpp
src/LFO.cpp
Expand Down
28 changes: 28 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,25 @@
"Ring modulator"
]
},
{
"slug": "SurgeXTFXBonsai",
"name": "Bonsai",
"description": "A Tape Distortion Model",
"tags": [
"Effect",
"Polyphonic",
"Distortion"
]
},
{
"slug": "SurgeXTFXNimbus",
"name": "Nimbus",
"description": "A popular granular eurorack module",
"tags": [
"Effect",
"Polyphonic"
]
},
{
"slug": "SurgeXTLFO",
"name": "LFO",
Expand Down Expand Up @@ -381,6 +400,15 @@
"Polyphonic"
]
},
{
"slug": "SurgeXTDigitalRingMod",
"name": "Digital RingMods",
"description": "The Surge XT Digital Ring Modulation Models",
"tags": [
"Ring modulator",
"Polyphonic"
]
},
{
"slug": "SurgeXTModMatrix",
"name": "ModMatrix",
Expand Down
140 changes: 140 additions & 0 deletions src/DigitalRingMod.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/*
* SurgeXT for VCV Rack - a Surge Synth Team product
*
* Copyright 2019 - 2022, Various authors, as described in the github
* transaction log.
*
* SurgeXT for VCV Rack is released under the Gnu General Public Licence
* V3 or later (GPL-3.0-or-later). The license is found in the file
* "LICENSE" in the root of this repository or at
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* All source for Surge XT for VCV Rack is available at
* https://github.com/surge-synthesizer/surge-rack/
*/

#include "DigitalRingMod.h"
#include "SurgeXT.h"
#include "XTModuleWidget.h"
#include "XTWidgets.h"
#include "LayoutEngine.h"

namespace sst::surgext_rack::digitalrm::ui
{
struct DigitalRingModWidget : widgets::XTModuleWidget
{
typedef digitalrm::DigitalRingMod M;
DigitalRingModWidget(M *module);
};

DigitalRingModWidget::DigitalRingModWidget(DigitalRingModWidget::M *module) : XTModuleWidget()
{
setModule(module);

box.size = rack::Vec(rack::app::RACK_GRID_WIDTH * 6, rack::app::RACK_GRID_HEIGHT);
auto bg = new widgets::Background(box.size, "", "other", "blank6hp");
addChild(bg);

auto titleLabel = widgets::Label::createWithBaselineBox(
rack::Vec(0, 0),
rack::Vec(box.size.x, rack::mm2px(layout::LayoutConstants::mainLabelBaseline_MM)),
"DIGITAL", layout::LayoutConstants::mainLabelSize_PT);
titleLabel->tracking = 0.7;
addChild(titleLabel);

auto titleLabelLower = widgets::Label::createWithBaselineBox(
rack::Vec(0, 0),
rack::Vec(box.size.x, rack::mm2px(layout::LayoutConstants::mainLabelBaseline_MM + 5.2)),
"RINGMODS", layout::LayoutConstants::mainLabelSize_PT);
titleLabelLower->tracking = 0.7;
addChild(titleLabelLower);

float cols[2]{box.size.x * 0.5f - rack::mm2px(7), box.size.x * 0.5f + rack::mm2px(7)};

int col = 0;
for (auto p : {M::INPUT_A_L, M::INPUT_A_R})
{
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[0]);
auto xp = cols[col];
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
col++;
}
col = 0;
for (auto p : {M::INPUT_B_L, M::INPUT_B_R})
{
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[1]);
auto xp = cols[col];
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
col++;
}

auto wb2 = rack::mm2px(layout::LayoutConstants::columnWidth_MM) * 0.5;
col = 0;
for (const std::string &s : {std::string("B: LEFT"), std::string("B: RIGHT")})
{
auto bl = layout::LayoutConstants::inputLabelBaseline_MM - 15;
auto lab = widgets::Label::createWithBaselineBox(
rack::Vec(cols[col] - wb2, rack::mm2px(bl - 5)), rack::Vec(2 * wb2, rack::mm2px(5)), s);
addChild(lab);
col++;
}

col = 0;
for (const std::string &s : {std::string("A: LEFT"), std::string("A: RIGHT")})
{
auto bl = layout::LayoutConstants::modulationRowCenters_MM[0] - 6;
auto lab = widgets::Label::createWithBaselineBox(
rack::Vec(cols[col] - wb2, rack::mm2px(bl - 5)), rack::Vec(2 * wb2, rack::mm2px(5)), s);
addChild(lab);
col++;
}

auto bglcd = widgets::LCDBackground::createWithHeight(60, 6, 39);

addChild(bglcd);

{
auto od = new widgets::OutputDecoration;
auto bl = layout::LayoutConstants::inputLabelBaseline_MM;

auto pd_MM = 0.5;

auto c0 = 0, nc = 2;
od->box.size = rack::Vec(
rack::mm2px((nc - 0.2) * layout::LayoutConstants::columnWidth_MM + 2 * pd_MM), 42);
od->box.pos = rack::Vec(
cols[0] + rack::mm2px((c0 - 0.4) * layout::LayoutConstants::columnWidth_MM - pd_MM),
rack::mm2px(bl - pd_MM) - 7.2 * 96 / 72);
od->setup();
addChild(od);
}
col = 0;
for (auto p : {M::OUTPUT_L, M::OUTPUT_R})
{
auto yp = rack::mm2px(layout::LayoutConstants::inputRowCenter_MM);
auto xp = cols[col];
addOutput(rack::createOutputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
col++;
}

col = 0;
for (const std::string &s : {std::string("LEFT"), std::string("RIGHT")})
{
auto bl = layout::LayoutConstants::inputLabelBaseline_MM;
auto lab = widgets::Label::createWithBaselineBox(
rack::Vec(cols[col] - wb2, rack::mm2px(bl - 5)), rack::Vec(2 * wb2, rack::mm2px(5)), s,
layout::LayoutConstants::labelSize_pt, style::XTStyle::TEXT_LABEL_OUTPUT);
addChild(lab);
col++;
}

resetStyleCouplingToModule();
}
} // namespace sst::surgext_rack::digitalrm::ui

// namespace sst::surgext_rack::vcf::ui

rack::Model *modelSurgeDigitalRingMods =
rack::createModel<sst::surgext_rack::digitalrm::ui::DigitalRingModWidget::M,
sst::surgext_rack::digitalrm::ui::DigitalRingModWidget>(
"SurgeXTDigitalRingMod");
73 changes: 73 additions & 0 deletions src/DigitalRingMod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* SurgeXT for VCV Rack - a Surge Synth Team product
*
* Copyright 2019 - 2022, Various authors, as described in the github
* transaction log.
*
* SurgeXT for VCV Rack is released under the Gnu General Public Licence
* V3 or later (GPL-3.0-or-later). The license is found in the file
* "LICENSE" in the root of this repository or at
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* All source for Surge XT for VCV Rack is available at
* https://github.com/surge-synthesizer/surge-rack/
*/

#ifndef XTRACK_digitalrm_HPP
#define XTRACK_digitalrm_HPP

#include "SurgeXT.h"
#include "XTModule.h"
#include "rack.hpp"
#include <cstring>
#include "DebugHelpers.h"
#include "globals.h"
#include "DSPUtils.h"

#include "sst/basic-blocks/dsp/CorrelatedNoise.h"
#include "CXOR.h"

namespace sst::surgext_rack::digitalrm
{
struct DigitalRingMod : modules::XTModule
{
enum ParamIds
{
NUM_PARAMS
};
enum InputIds
{
INPUT_A_L,
INPUT_A_R,

INPUT_B_L,
INPUT_B_R,

NUM_INPUTS

};
enum OutputIds
{
OUTPUT_L,
OUTPUT_R,
NUM_OUTPUTS
};
enum LightIds
{
NUM_LIGHTS
};

DigitalRingMod() : XTModule()
{
std::lock_guard<std::mutex> ltg(xtSurgeCreateMutex);

setupSurgeCommon(NUM_PARAMS, false, false);
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
}

std::string getName() override { return "Mixer"; }

void process(const ProcessArgs &args) override {}
};
} // namespace sst::surgext_rack::digitalrm
#endif
2 changes: 2 additions & 0 deletions src/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,11 @@ FXMODEL(fxt_chow, Chow);
FXMODEL(fxt_exciter, Exciter);
FXMODEL(fxt_ensemble, Ensemble);
FXMODEL(fxt_combulator, Combulator);
FXMODEL(fxt_nimbus, Nimbus);
// skip Nimbus - there's loads of clouds out there
// ski Tape - chow has that covered
// skip Waveshaper - write a poly version instead
// skip MSTool - covered by vcv core
FXMODEL(fxt_spring_reverb, SpringReverb);
FXMODEL(fxt_treemonster, TreeMonster);
FXMODEL(fxt_bonsai, Bonsai);
3 changes: 3 additions & 0 deletions src/SurgeXT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ __attribute__((__visibility__("default"))) void init(rack::Plugin *p)
p->addModel(modelSurgeLFO);
p->addModel(modelSurgeMixer);
p->addModel(modelSurgeModMatrix);
p->addModel(modelSurgeDigitalRingMods);

p->addModel(modelFXReverb);
p->addModel(modelFXPhaser);
Expand All @@ -64,6 +65,8 @@ __attribute__((__visibility__("default"))) void init(rack::Plugin *p)
p->addModel(modelFXCombulator);
p->addModel(modelFXSpringReverb);
p->addModel(modelFXTreeMonster);
p->addModel(modelFXBonsai);
p->addModel(modelFXNimbus);

p->addModel(modelEGxVCA);
p->addModel(modelQuadAD);
Expand Down
4 changes: 4 additions & 0 deletions src/SurgeXT.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ extern rack::Model *modelSurgeWaveshaper;
extern rack::Model *modelSurgeLFO;
extern rack::Model *modelSurgeMixer;
extern rack::Model *modelSurgeModMatrix;
extern rack::Model *modelSurgeDigitalRingMods;

// FX

Expand All @@ -82,6 +83,9 @@ extern rack::Model *modelFXEnsemble;
extern rack::Model *modelFXCombulator;
extern rack::Model *modelFXSpringReverb;
extern rack::Model *modelFXTreeMonster;
extern rack::Model *modelFXBonsai;
extern rack::Model *modelFXNimbus;

extern rack::Model *modelEGxVCA;
extern rack::Model *modelQuadAD;
extern rack::Model *modelQuadLFO;
7 changes: 4 additions & 3 deletions src/XTWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -1927,13 +1927,14 @@ struct LCDBackground : public rack::widget::TransparentWidget, style::StyleParti
bool centerRule{false};
bool splitLower{false};

static LCDBackground *createWithHeight(float endPosInMM, float widthInScrews = 12)
static LCDBackground *createWithHeight(float endPosInMM, float widthInScrews = 12,
float startPosY = posy)
{
auto width = rack::app::RACK_GRID_WIDTH * widthInScrews - 2 * posx;
auto height = rack::mm2px(endPosInMM) - posy;
auto height = rack::mm2px(endPosInMM) - startPosY;

auto res = new LCDBackground();
res->setup(rack::Vec(posx, posy), rack::Vec(width, height));
res->setup(rack::Vec(posx, startPosY), rack::Vec(width, height));

return res;
}
Expand Down

0 comments on commit 931e930

Please sign in to comment.