Skip to content

Commit 931e930

Browse files
authored
Shells of new modules (#892)
- Digital Ring Mod - Bonsai - Nimbus (Addresses #844) All stubbed out with screens, and Bonsai and Nimbus actually run effects.
1 parent a5a6c58 commit 931e930

File tree

8 files changed

+255
-3
lines changed

8 files changed

+255
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ target_sources(${RACK_PLUGIN_LIB} PRIVATE
8282
src/Delay.cpp
8383
src/DelayLineByFreq.cpp
8484
src/DelayLineByFreqExpanded.cpp
85+
src/DigitalRingMod.cpp
8586
src/EGxVCA.cpp
8687
src/FX.cpp
8788
src/LFO.cpp

plugin.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,25 @@
304304
"Ring modulator"
305305
]
306306
},
307+
{
308+
"slug": "SurgeXTFXBonsai",
309+
"name": "Bonsai",
310+
"description": "A Tape Distortion Model",
311+
"tags": [
312+
"Effect",
313+
"Polyphonic",
314+
"Distortion"
315+
]
316+
},
317+
{
318+
"slug": "SurgeXTFXNimbus",
319+
"name": "Nimbus",
320+
"description": "A popular granular eurorack module",
321+
"tags": [
322+
"Effect",
323+
"Polyphonic"
324+
]
325+
},
307326
{
308327
"slug": "SurgeXTLFO",
309328
"name": "LFO",
@@ -381,6 +400,15 @@
381400
"Polyphonic"
382401
]
383402
},
403+
{
404+
"slug": "SurgeXTDigitalRingMod",
405+
"name": "Digital RingMods",
406+
"description": "The Surge XT Digital Ring Modulation Models",
407+
"tags": [
408+
"Ring modulator",
409+
"Polyphonic"
410+
]
411+
},
384412
{
385413
"slug": "SurgeXTModMatrix",
386414
"name": "ModMatrix",

src/DigitalRingMod.cpp

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/*
2+
* SurgeXT for VCV Rack - a Surge Synth Team product
3+
*
4+
* Copyright 2019 - 2022, Various authors, as described in the github
5+
* transaction log.
6+
*
7+
* SurgeXT for VCV Rack is released under the Gnu General Public Licence
8+
* V3 or later (GPL-3.0-or-later). The license is found in the file
9+
* "LICENSE" in the root of this repository or at
10+
* https://www.gnu.org/licenses/gpl-3.0.en.html
11+
*
12+
* All source for Surge XT for VCV Rack is available at
13+
* https://github.com/surge-synthesizer/surge-rack/
14+
*/
15+
16+
#include "DigitalRingMod.h"
17+
#include "SurgeXT.h"
18+
#include "XTModuleWidget.h"
19+
#include "XTWidgets.h"
20+
#include "LayoutEngine.h"
21+
22+
namespace sst::surgext_rack::digitalrm::ui
23+
{
24+
struct DigitalRingModWidget : widgets::XTModuleWidget
25+
{
26+
typedef digitalrm::DigitalRingMod M;
27+
DigitalRingModWidget(M *module);
28+
};
29+
30+
DigitalRingModWidget::DigitalRingModWidget(DigitalRingModWidget::M *module) : XTModuleWidget()
31+
{
32+
setModule(module);
33+
34+
box.size = rack::Vec(rack::app::RACK_GRID_WIDTH * 6, rack::app::RACK_GRID_HEIGHT);
35+
auto bg = new widgets::Background(box.size, "", "other", "blank6hp");
36+
addChild(bg);
37+
38+
auto titleLabel = widgets::Label::createWithBaselineBox(
39+
rack::Vec(0, 0),
40+
rack::Vec(box.size.x, rack::mm2px(layout::LayoutConstants::mainLabelBaseline_MM)),
41+
"DIGITAL", layout::LayoutConstants::mainLabelSize_PT);
42+
titleLabel->tracking = 0.7;
43+
addChild(titleLabel);
44+
45+
auto titleLabelLower = widgets::Label::createWithBaselineBox(
46+
rack::Vec(0, 0),
47+
rack::Vec(box.size.x, rack::mm2px(layout::LayoutConstants::mainLabelBaseline_MM + 5.2)),
48+
"RINGMODS", layout::LayoutConstants::mainLabelSize_PT);
49+
titleLabelLower->tracking = 0.7;
50+
addChild(titleLabelLower);
51+
52+
float cols[2]{box.size.x * 0.5f - rack::mm2px(7), box.size.x * 0.5f + rack::mm2px(7)};
53+
54+
int col = 0;
55+
for (auto p : {M::INPUT_A_L, M::INPUT_A_R})
56+
{
57+
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[0]);
58+
auto xp = cols[col];
59+
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
60+
col++;
61+
}
62+
col = 0;
63+
for (auto p : {M::INPUT_B_L, M::INPUT_B_R})
64+
{
65+
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[1]);
66+
auto xp = cols[col];
67+
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
68+
col++;
69+
}
70+
71+
auto wb2 = rack::mm2px(layout::LayoutConstants::columnWidth_MM) * 0.5;
72+
col = 0;
73+
for (const std::string &s : {std::string("B: LEFT"), std::string("B: RIGHT")})
74+
{
75+
auto bl = layout::LayoutConstants::inputLabelBaseline_MM - 15;
76+
auto lab = widgets::Label::createWithBaselineBox(
77+
rack::Vec(cols[col] - wb2, rack::mm2px(bl - 5)), rack::Vec(2 * wb2, rack::mm2px(5)), s);
78+
addChild(lab);
79+
col++;
80+
}
81+
82+
col = 0;
83+
for (const std::string &s : {std::string("A: LEFT"), std::string("A: RIGHT")})
84+
{
85+
auto bl = layout::LayoutConstants::modulationRowCenters_MM[0] - 6;
86+
auto lab = widgets::Label::createWithBaselineBox(
87+
rack::Vec(cols[col] - wb2, rack::mm2px(bl - 5)), rack::Vec(2 * wb2, rack::mm2px(5)), s);
88+
addChild(lab);
89+
col++;
90+
}
91+
92+
auto bglcd = widgets::LCDBackground::createWithHeight(60, 6, 39);
93+
94+
addChild(bglcd);
95+
96+
{
97+
auto od = new widgets::OutputDecoration;
98+
auto bl = layout::LayoutConstants::inputLabelBaseline_MM;
99+
100+
auto pd_MM = 0.5;
101+
102+
auto c0 = 0, nc = 2;
103+
od->box.size = rack::Vec(
104+
rack::mm2px((nc - 0.2) * layout::LayoutConstants::columnWidth_MM + 2 * pd_MM), 42);
105+
od->box.pos = rack::Vec(
106+
cols[0] + rack::mm2px((c0 - 0.4) * layout::LayoutConstants::columnWidth_MM - pd_MM),
107+
rack::mm2px(bl - pd_MM) - 7.2 * 96 / 72);
108+
od->setup();
109+
addChild(od);
110+
}
111+
col = 0;
112+
for (auto p : {M::OUTPUT_L, M::OUTPUT_R})
113+
{
114+
auto yp = rack::mm2px(layout::LayoutConstants::inputRowCenter_MM);
115+
auto xp = cols[col];
116+
addOutput(rack::createOutputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
117+
col++;
118+
}
119+
120+
col = 0;
121+
for (const std::string &s : {std::string("LEFT"), std::string("RIGHT")})
122+
{
123+
auto bl = layout::LayoutConstants::inputLabelBaseline_MM;
124+
auto lab = widgets::Label::createWithBaselineBox(
125+
rack::Vec(cols[col] - wb2, rack::mm2px(bl - 5)), rack::Vec(2 * wb2, rack::mm2px(5)), s,
126+
layout::LayoutConstants::labelSize_pt, style::XTStyle::TEXT_LABEL_OUTPUT);
127+
addChild(lab);
128+
col++;
129+
}
130+
131+
resetStyleCouplingToModule();
132+
}
133+
} // namespace sst::surgext_rack::digitalrm::ui
134+
135+
// namespace sst::surgext_rack::vcf::ui
136+
137+
rack::Model *modelSurgeDigitalRingMods =
138+
rack::createModel<sst::surgext_rack::digitalrm::ui::DigitalRingModWidget::M,
139+
sst::surgext_rack::digitalrm::ui::DigitalRingModWidget>(
140+
"SurgeXTDigitalRingMod");

src/DigitalRingMod.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* SurgeXT for VCV Rack - a Surge Synth Team product
3+
*
4+
* Copyright 2019 - 2022, Various authors, as described in the github
5+
* transaction log.
6+
*
7+
* SurgeXT for VCV Rack is released under the Gnu General Public Licence
8+
* V3 or later (GPL-3.0-or-later). The license is found in the file
9+
* "LICENSE" in the root of this repository or at
10+
* https://www.gnu.org/licenses/gpl-3.0.en.html
11+
*
12+
* All source for Surge XT for VCV Rack is available at
13+
* https://github.com/surge-synthesizer/surge-rack/
14+
*/
15+
16+
#ifndef XTRACK_digitalrm_HPP
17+
#define XTRACK_digitalrm_HPP
18+
19+
#include "SurgeXT.h"
20+
#include "XTModule.h"
21+
#include "rack.hpp"
22+
#include <cstring>
23+
#include "DebugHelpers.h"
24+
#include "globals.h"
25+
#include "DSPUtils.h"
26+
27+
#include "sst/basic-blocks/dsp/CorrelatedNoise.h"
28+
#include "CXOR.h"
29+
30+
namespace sst::surgext_rack::digitalrm
31+
{
32+
struct DigitalRingMod : modules::XTModule
33+
{
34+
enum ParamIds
35+
{
36+
NUM_PARAMS
37+
};
38+
enum InputIds
39+
{
40+
INPUT_A_L,
41+
INPUT_A_R,
42+
43+
INPUT_B_L,
44+
INPUT_B_R,
45+
46+
NUM_INPUTS
47+
48+
};
49+
enum OutputIds
50+
{
51+
OUTPUT_L,
52+
OUTPUT_R,
53+
NUM_OUTPUTS
54+
};
55+
enum LightIds
56+
{
57+
NUM_LIGHTS
58+
};
59+
60+
DigitalRingMod() : XTModule()
61+
{
62+
std::lock_guard<std::mutex> ltg(xtSurgeCreateMutex);
63+
64+
setupSurgeCommon(NUM_PARAMS, false, false);
65+
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
66+
}
67+
68+
std::string getName() override { return "Mixer"; }
69+
70+
void process(const ProcessArgs &args) override {}
71+
};
72+
} // namespace sst::surgext_rack::digitalrm
73+
#endif

src/FX.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,11 @@ FXMODEL(fxt_chow, Chow);
288288
FXMODEL(fxt_exciter, Exciter);
289289
FXMODEL(fxt_ensemble, Ensemble);
290290
FXMODEL(fxt_combulator, Combulator);
291+
FXMODEL(fxt_nimbus, Nimbus);
291292
// skip Nimbus - there's loads of clouds out there
292293
// ski Tape - chow has that covered
293294
// skip Waveshaper - write a poly version instead
294295
// skip MSTool - covered by vcv core
295296
FXMODEL(fxt_spring_reverb, SpringReverb);
296297
FXMODEL(fxt_treemonster, TreeMonster);
298+
FXMODEL(fxt_bonsai, Bonsai);

src/SurgeXT.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ __attribute__((__visibility__("default"))) void init(rack::Plugin *p)
4545
p->addModel(modelSurgeLFO);
4646
p->addModel(modelSurgeMixer);
4747
p->addModel(modelSurgeModMatrix);
48+
p->addModel(modelSurgeDigitalRingMods);
4849

4950
p->addModel(modelFXReverb);
5051
p->addModel(modelFXPhaser);
@@ -64,6 +65,8 @@ __attribute__((__visibility__("default"))) void init(rack::Plugin *p)
6465
p->addModel(modelFXCombulator);
6566
p->addModel(modelFXSpringReverb);
6667
p->addModel(modelFXTreeMonster);
68+
p->addModel(modelFXBonsai);
69+
p->addModel(modelFXNimbus);
6770

6871
p->addModel(modelEGxVCA);
6972
p->addModel(modelQuadAD);

src/SurgeXT.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ extern rack::Model *modelSurgeWaveshaper;
6161
extern rack::Model *modelSurgeLFO;
6262
extern rack::Model *modelSurgeMixer;
6363
extern rack::Model *modelSurgeModMatrix;
64+
extern rack::Model *modelSurgeDigitalRingMods;
6465

6566
// FX
6667

@@ -82,6 +83,9 @@ extern rack::Model *modelFXEnsemble;
8283
extern rack::Model *modelFXCombulator;
8384
extern rack::Model *modelFXSpringReverb;
8485
extern rack::Model *modelFXTreeMonster;
86+
extern rack::Model *modelFXBonsai;
87+
extern rack::Model *modelFXNimbus;
88+
8589
extern rack::Model *modelEGxVCA;
8690
extern rack::Model *modelQuadAD;
8791
extern rack::Model *modelQuadLFO;

src/XTWidgets.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,13 +1927,14 @@ struct LCDBackground : public rack::widget::TransparentWidget, style::StyleParti
19271927
bool centerRule{false};
19281928
bool splitLower{false};
19291929

1930-
static LCDBackground *createWithHeight(float endPosInMM, float widthInScrews = 12)
1930+
static LCDBackground *createWithHeight(float endPosInMM, float widthInScrews = 12,
1931+
float startPosY = posy)
19311932
{
19321933
auto width = rack::app::RACK_GRID_WIDTH * widthInScrews - 2 * posx;
1933-
auto height = rack::mm2px(endPosInMM) - posy;
1934+
auto height = rack::mm2px(endPosInMM) - startPosY;
19341935

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

19381939
return res;
19391940
}

0 commit comments

Comments
 (0)