Skip to content

Commit 835ccd1

Browse files
committed
Start of feedover thing
1 parent 99cdd29 commit 835ccd1

File tree

2 files changed

+39
-14
lines changed

2 files changed

+39
-14
lines changed

Plateau2/Plateau2.cpp

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Plateau2::Plateau2(const InstanceInfo& info)
3333
GetParam(kStereoSource1)->InitPercentage("Stereo Source 1", 0, -100, 100);
3434
GetParam(kWidth1)->InitPercentage("Stereo Width 1", 100, 0, 200);
3535
GetParam(kPan1)->InitPercentage("Pan 1", 0, -100, 100);
36+
GetParam(kL1toL2)->InitPercentage("Send Left 1 to Left 2");
37+
GetParam(kR1toL2)->InitPercentage("Send Right 1 to Left 2");
38+
GetParam(kL1toR2)->InitPercentage("Send Left 1 to Right 2");
39+
GetParam(kR1toR2)->InitPercentage("Send Right 1 to Right 2");
3640

3741

3842
GetParam(kEnable2)->InitBool("Tank 2 Enable", false);
@@ -59,6 +63,10 @@ Plateau2::Plateau2(const InstanceInfo& info)
5963
GetParam(kStereoSource2)->InitPercentage("Stereo Source 2", 0, -100, 100);
6064
GetParam(kWidth2)->InitPercentage("Stereo Width 2", 100, 0, 200);
6165
GetParam(kPan2)->InitPercentage("Pan 2", 0, -100, 100);
66+
GetParam(kL2toL1)->InitPercentage("Send Left 2 to Left 1");
67+
GetParam(kR2toL1)->InitPercentage("Send Right 2 to Left 1");
68+
GetParam(kL2toR1)->InitPercentage("Send Left 2 to Right 1");
69+
GetParam(kR2toR1)->InitPercentage("Send Right 2 to Right 1");
6270

6371

6472
GetParam(kDanger)->InitBool("DANGER! Allow Unsafe Feedback Settings", false);
@@ -125,8 +133,11 @@ Plateau2::Plateau2(const InstanceInfo& info)
125133

126134
Knobs[16] = new NeedleKnob(IRECT::MakeXYWH(93, 250, 56, 56), NeedleSVG, NeedleBGSVG, NeedleFG1PNG, NeedleFG2PNG, kWidth1, kWidth2);
127135
Knobs[17] = new NeedleKnob(IRECT::MakeXYWH(166, 250, 56, 56), NeedleSVG, NeedleBGSVG, NeedleFG1PNG, NeedleFG2PNG, kPan1, kPan2);
136+
137+
Knobs[18] = new NeedleKnob(IRECT::MakeXYWH(93, 340, 56, 56), NeedleSVG, NeedleBGSVG, NeedleFG1PNG, NeedleFG2PNG, kL1toL2, kL2toL1);
138+
Knobs[19] = new NeedleKnob(IRECT::MakeXYWH(166, 340, 56, 56), NeedleSVG, NeedleBGSVG, NeedleFG1PNG, NeedleFG2PNG, kR1toR2, kR2toR1);
128139

129-
for (int i = 12; i <= 17; i++) {
140+
for (int i = 12; i <= 19; i++) {
130141
pGraphics->AttachControl(Knobs[i]);
131142
Knobs[i]->Hide(true);
132143
}
@@ -256,7 +267,7 @@ void Plateau2::UpdatePageVisibility()
256267
}
257268

258269
//Routing page
259-
for (int i = 14; i <= 17; i++) {
270+
for (int i = 14; i <= 19; i++) {
260271
Knobs[i]->Hide(currentPage != 2);
261272
}
262273
}
@@ -465,7 +476,6 @@ void Plateau2::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
465476

466477
const bool tank1Enabled = GetParam(kEnable1)->Value();
467478
const bool tank2Enabled = GetParam(kEnable2)->Value();
468-
const double input1 = GetParam(kInput1)->Value() / 100;
469479

470480
outputs[0][s] = inputs[0][s] * dryParam;
471481
if (nChans > 1)
@@ -477,6 +487,7 @@ void Plateau2::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
477487
const bool clear1Param = GetParam(kClear1)->Value() || GetParam(kClear)->Value();
478488
const bool freeze1Param = GetParam(kFreeze1)->Value();
479489
const double wet1Param = GetParam(kWet1)->Value() / 100;
490+
const double input1 = GetParam(kInput1)->Value() / 100;
480491

481492
if (clear1Param && !clear1 && cleared1) {
482493
cleared1 = false;
@@ -518,16 +529,18 @@ void Plateau2::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
518529
reverb1.freeze(frozen1);
519530
}
520531

521-
reverb1.process(balance((double)(inputs[0][s] * envelope1._value * input1), (double)(inputs[nChans > 1 ? 1 : 0][s] * envelope1._value * input1), GetParam(kStereoSource1)->Value()/100));
532+
reverb1.process(balance((double)(envelope1._value * (inputs[0][s] * input1 + (tank2Enabled ? (std::get<0>(reverbOut2) * (GetParam(kL2toL1)->Value() / 100) + std::get<1>(reverbOut2) * (GetParam(kR2toL1)->Value() / 100)) : 0))), (double)(envelope1._value * (inputs[nChans > 1 ? 1 : 0][s] * input1 + (tank2Enabled ? (std::get<0>(reverbOut2) * (GetParam(kL2toR1)->Value() / 100) + std::get<1>(reverbOut2) * (GetParam(kR2toR1)->Value() / 100)) : 0))), GetParam(kStereoSource1)->Value() / 100));
533+
534+
reverbOut1 = { reverb1.getLeftOutput(), reverb1.getRightOutput() };
522535

523-
std::tuple<double, double> output = seperation(reverb1.getLeftOutput() * wet1Param, reverb1.getRightOutput() * wet1Param, GetParam(kWidth1)->Value()/100);
524-
output = balance(std::get<0>(output), std::get<1>(output), GetParam(kPan1)->Value()/100);
536+
std::tuple<double,double> out = seperation(std::get<0>(reverbOut1), std::get<1>(reverbOut1), GetParam(kWidth1)->Value() / 100);
537+
out = balance(std::get<0>(out), std::get<1>(out), GetParam(kPan1)->Value()/100);
525538

526-
outputs[0][s] += std::get<0>(output);
539+
outputs[0][s] += std::get<0>(out) * wet1Param;
527540

528541
if (nChans > 1)
529542
{
530-
outputs[1][s] += std::get<1>(output);
543+
outputs[1][s] += std::get<1>(out) * wet1Param;
531544
}
532545
}
533546

@@ -578,16 +591,18 @@ void Plateau2::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
578591
reverb2.freeze(frozen2);
579592
}
580593

581-
reverb2.process(balance((double)(inputs[0][s] * envelope2._value * input2), (double)(inputs[nChans > 1 ? 1 : 0][s] * envelope2._value * input2), GetParam(kStereoSource2)->Value() / 100));
594+
reverb2.process(balance((double)(envelope2._value * (inputs[0][s] * input2 + (tank1Enabled ? (std::get<0>(reverbOut1) * (GetParam(kL1toL2)->Value() / 100) + std::get<1>(reverbOut1) * (GetParam(kR1toL2)->Value() / 100)) : 0))), (double)(envelope2._value*(inputs[nChans > 1 ? 1 : 0][s] * input2 + (tank1Enabled ? (std::get<0>(reverbOut1) * (GetParam(kL1toR2)->Value() / 100) + std::get<1>(reverbOut1) * (GetParam(kR1toR2)->Value() / 100)) : 0))), GetParam(kStereoSource2)->Value() / 100));
595+
596+
reverbOut2 = { reverb2.getLeftOutput(), reverb2.getRightOutput() };
582597

583-
std::tuple<double, double> output = seperation(reverb2.getLeftOutput() * wet2Param, reverb2.getRightOutput() * wet2Param, GetParam(kWidth2)->Value()/100);
584-
output = balance(std::get<0>(output), std::get<1>(output), GetParam(kPan2)->Value()/100);
598+
std::tuple<double, double> out = seperation(std::get<0>(reverbOut2), std::get<1>(reverbOut2), GetParam(kWidth2)->Value()/100);
599+
out = balance(std::get<0>(out), std::get<1>(out), GetParam(kPan2)->Value()/100);
585600

586-
outputs[0][s] += std::get<0>(output);
601+
outputs[0][s] += std::get<0>(out) * wet2Param;
587602

588603
if (nChans > 1)
589604
{
590-
outputs[1][s] += std::get<1>(output);
605+
outputs[1][s] += std::get<1>(out) * wet2Param;
591606
}
592607
}
593608
}

Plateau2/Plateau2.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ enum EParams
4343
kStereoSource1,
4444
kWidth1,
4545
kPan1,
46+
kL1toL2,
47+
kR1toL2,
48+
kL1toR2,
49+
kR1toR2,
4650

4751
kEnable2,
4852
kWet2,
@@ -68,13 +72,17 @@ enum EParams
6872
kStereoSource2,
6973
kWidth2,
7074
kPan2,
75+
kL2toL1,
76+
kR2toL1,
77+
kL2toR1,
78+
kR2toR1,
7179

7280
kDanger,
7381

7482
kNumParams
7583
};
7684

77-
const int kNumKnobs = 18;
85+
const int kNumKnobs = 20;
7886
const int kNumSwitches = 7;
7987
const int kNumButtons = 2;
8088
const int kNumPages = 3;
@@ -99,6 +107,7 @@ class Plateau2 final : public Plugin
99107
#endif
100108
private:
101109
Dattorro reverb1;
110+
std::tuple<double, double> reverbOut1 = {0,0};
102111
LinearEnvelope envelope1;
103112
bool clear1 = false;
104113
bool cleared1 = true;
@@ -107,6 +116,7 @@ class Plateau2 final : public Plugin
107116
bool frozen1 = false;
108117

109118
Dattorro reverb2;
119+
std::tuple<double, double> reverbOut2 = { 0,0 };
110120
LinearEnvelope envelope2;
111121
bool clear2 = false;
112122
bool cleared2 = true;

0 commit comments

Comments
 (0)