Skip to content

Commit

Permalink
FInish connector stuff for 2.2 (#946)
Browse files Browse the repository at this point in the history
This makes sure everyone has appropriate neighbor connectors,
mixmaster connectors, and that the UI is appropriate.

Closes #945
Addresses #829
  • Loading branch information
baconpaul committed Nov 22, 2023
1 parent 936f58a commit 285c85f
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 18 deletions.
2 changes: 1 addition & 1 deletion libs/sst-rackhelpers
13 changes: 11 additions & 2 deletions src/DelayLineByFreq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ DelayLineByFreqWidget::DelayLineByFreqWidget(DelayLineByFreqWidget::M *module) :
{
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[1]);
auto xp = cols[col];
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
auto ipt = rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p);
ipt->connectAsInputFromMixmaster = true;
ipt->mixMasterStereoCompanion = (p == M::INPUT_L ? M::INPUT_R : M::INPUT_L);
addInput(ipt);
col++;
}

Expand Down Expand Up @@ -129,7 +132,13 @@ DelayLineByFreqWidget::DelayLineByFreqWidget(DelayLineByFreqWidget::M *module) :
{
auto yp = rack::mm2px(layout::LayoutConstants::inputRowCenter_MM);
auto xp = cols[col];
addOutput(rack::createOutputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
auto opt = rack::createOutputCentered<widgets::Port>(rack::Vec(xp, yp), module, p);

opt->connectOutputToNeighbor = true;
opt->connectAsOutputToMixmaster = true;
opt->mixMasterStereoCompanion = (p == M::OUTPUT_L ? M::OUTPUT_R : M::OUTPUT_L);

addOutput(opt);
col++;
}

Expand Down
15 changes: 14 additions & 1 deletion src/DelayLineByFreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
#include <memory>
#include <array>

#include <sst/rackhelpers/neighbor_connectable.h>

#include "dsp/utilities/SSESincDelayLine.h"

namespace sst::surgext_rack::delay
{
struct DelayLineByFreq : modules::XTModule
struct DelayLineByFreq : modules::XTModule,
sst::rackhelpers::module_connector::NeighborConnectable_V1
{
enum ParamIds
{
Expand Down Expand Up @@ -135,6 +138,16 @@ struct DelayLineByFreq : modules::XTModule
outputs[INPUT_R].setVoltage(dr, i);
}
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryInputs() override
{
return {{std::make_pair("Input", std::make_pair(INPUT_L, INPUT_R))}};
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryOutputs() override
{
return {{std::make_pair("Output", std::make_pair(OUTPUT_L, OUTPUT_R))}};
}
};
} // namespace sst::surgext_rack::delay
#endif
19 changes: 13 additions & 6 deletions src/DelayLineByFreqExpanded.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,13 @@
#include "dsp/utilities/SSESincDelayLine.h"
#include "BiquadFilter.h"

/*
* FB Filter
* Display Area
* LintBuddy
*/
#include <sst/rackhelpers/neighbor_connectable.h>

namespace sst::surgext_rack::delay
{

struct DelayLineByFreqExpanded : modules::XTModule
struct DelayLineByFreqExpanded : modules::XTModule,
sst::rackhelpers::module_connector::NeighborConnectable_V1
{
static constexpr int n_mod_inputs{4};
static constexpr int n_mod_params{7};
Expand Down Expand Up @@ -471,6 +468,16 @@ struct DelayLineByFreqExpanded : modules::XTModule
{
vuFalloff = exp(-2.0 * M_PI * 8 / APP->engine->getSampleRate());
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryInputs() override
{
return {{std::make_pair("Input", std::make_pair(INPUT_L, INPUT_R))}};
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryOutputs() override
{
return {{std::make_pair("Output", std::make_pair(OUTPUT_L, OUTPUT_R))}};
}
};
} // namespace sst::surgext_rack::delay
#endif
32 changes: 29 additions & 3 deletions src/DigitalRingMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,31 @@ DigitalRingModWidget::DigitalRingModWidget(DigitalRingModWidget::M *module) : XT
{
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[0]) + yShift;
auto xp = cols[col];
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
auto pt = rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p);

pt->connectAsInputFromMixmaster = true;
if (p == M::INPUT_0_A_L + inOff)
pt->mixMasterStereoCompanion = M::INPUT_0_A_R + inOff;
else
pt->mixMasterStereoCompanion = M::INPUT_0_A_L + inOff;

addInput(pt);
col++;
}
col = 0;
for (auto p : {M::INPUT_0_B_L + inOff, M::INPUT_0_B_R + inOff})
{
auto yp = rack::mm2px(layout::LayoutConstants::modulationRowCenters_MM[1]) + yShift;
auto xp = cols[col];
addInput(rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
auto pt = rack::createInputCentered<widgets::Port>(rack::Vec(xp, yp), module, p);

pt->connectAsInputFromMixmaster = true;
if (p == M::INPUT_0_B_L + inOff)
pt->mixMasterStereoCompanion = M::INPUT_0_B_R + inOff;
else
pt->mixMasterStereoCompanion = M::INPUT_0_B_L + inOff;

addInput(pt);
col++;
}

Expand Down Expand Up @@ -115,7 +131,17 @@ DigitalRingModWidget::DigitalRingModWidget(DigitalRingModWidget::M *module) : XT
{
auto yp = rack::mm2px(layout::LayoutConstants::inputRowCenter_MM) + yShift;
auto xp = cols[col];
addOutput(rack::createOutputCentered<widgets::Port>(rack::Vec(xp, yp), module, p));
auto pt = rack::createOutputCentered<widgets::Port>(rack::Vec(xp, yp), module, p);

pt->connectAsOutputToMixmaster = true;
pt->connectOutputToNeighbor = true;
pt->connectAsInputFromMixmaster = true;
if (p == M::OUTPUT_0_L + outOff)
pt->mixMasterStereoCompanion = M::OUTPUT_0_R + outOff;
else
pt->mixMasterStereoCompanion = M::OUTPUT_0_L + outOff;

addOutput(pt);
col++;
}

Expand Down
20 changes: 19 additions & 1 deletion src/DigitalRingMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
#include "sst/basic-blocks/mechanics/block-ops.h"
#include "CXOR.h"
#include "SurgeStorage.h"
#include <sst/rackhelpers/neighbor_connectable.h>

namespace sst::surgext_rack::digitalrm
{
struct DigitalRingMod : modules::XTModule
struct DigitalRingMod : modules::XTModule,
sst::rackhelpers::module_connector::NeighborConnectable_V1
{
enum ParamIds
{
Expand Down Expand Up @@ -292,6 +294,22 @@ struct DigitalRingMod : modules::XTModule
blockPos++;
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryInputs() override
{
return {{std::make_pair("CXOR 1 Port A", std::make_pair(INPUT_0_A_L, INPUT_0_A_R)),
std::make_pair("CXOR 1 Port B", std::make_pair(INPUT_0_B_L, INPUT_0_B_R)),
std::make_pair("CXOR 2 Port A", std::make_pair(INPUT_1_B_L, INPUT_1_B_R)),
std::make_pair("CXOR 2 Port A", std::make_pair(INPUT_1_B_L, INPUT_1_B_R))}};
}

std::optional<std::vector<labeledStereoPort_t>> getPrimaryOutputs() override
{
return {{
std::make_pair("CXOR 1", std::make_pair(OUTPUT_0_L, OUTPUT_0_R)),
std::make_pair("CXOR 2", std::make_pair(OUTPUT_1_L, OUTPUT_1_R)),
}};
}

std::array<std::array<std::unique_ptr<sst::filters::HalfRate::HalfRateFilter>, MAX_POLY>, 2>
halfbandInA, halfbandInB, halfbandOut;
static constexpr int blockSize{4}, blockSizeOS{blockSize << 1};
Expand Down
15 changes: 15 additions & 0 deletions src/LayoutEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,21 @@ template <typename W, int param0, int clockId = -1> struct LayoutEngine
lay.parId);
w->addChild(port);

if (lay.extras.find("mixmaster") != lay.extras.end())
{
auto sp = lay.extras.find("stereo_pair");
if (sp == lay.extras.end())
{
std::cout << "MIX MASTER PORT WITHOUT STEREO PAIR IN EXTRAS" << std::endl;
std::terminate();
}
else
{
port->connectAsInputFromMixmaster = true;
port->mixMasterStereoCompanion = (int)std::round(sp->second);
}
}

auto boxx0 = lay.xcmm - lc::columnWidth_MM * 0.5;
auto boxy0 = lay.ycmm + 8.573 - 5;

Expand Down
21 changes: 17 additions & 4 deletions src/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ MixerWidget<useKnobs>::MixerWidget(MixerWidget::M *module) : XTModuleWidget()
lay.label = "";
lay.xcmm = xc;
lay.ycmm = yc;
lay.extras["mixmaster"] = true;
lay.extras["stereo_pair"] = ((i - M::INPUT_OSC1_L) % 2 == 0) ? i + 1 : i - 1;
engine_t::layoutItem(this, lay, "Mixer");

if (kc % 2 == 0)
Expand All @@ -294,13 +296,24 @@ MixerWidget<useKnobs>::MixerWidget(MixerWidget::M *module) : XTModuleWidget()
auto yp = layout::LayoutConstants::inputRowCenter_MM;
auto xp =
layout::LayoutConstants::firstColumnCenter_MM + layout::LayoutConstants::columnWidth_MM * 2;
addOutput(rack::createOutputCentered<widgets::Port>(rack::mm2px(rack::Vec(xp, yp)), module,
M::OUTPUT_L));
auto optL = rack::createOutputCentered<widgets::Port>(rack::mm2px(rack::Vec(xp, yp)), module,
M::OUTPUT_L);

xp =
layout::LayoutConstants::firstColumnCenter_MM + layout::LayoutConstants::columnWidth_MM * 3;
addOutput(rack::createOutputCentered<widgets::Port>(rack::mm2px(rack::Vec(xp, yp)), module,
M::OUTPUT_R));
auto optR = rack::createOutputCentered<widgets::Port>(rack::mm2px(rack::Vec(xp, yp)), module,
M::OUTPUT_R);

optL->connectAsOutputToMixmaster = true;
optL->connectOutputToNeighbor = true;
optL->mixMasterStereoCompanion = M::OUTPUT_R;

optR->connectAsOutputToMixmaster = true;
optR->connectOutputToNeighbor = true;
optR->mixMasterStereoCompanion = M::OUTPUT_L;

addOutput(optL);
addOutput(optR);

auto bl = layout::LayoutConstants::inputLabelBaseline_MM;
auto laylab =
Expand Down

0 comments on commit 285c85f

Please sign in to comment.