Skip to content

Commit bd58bd1

Browse files
committed
Added retrig to ADSRs
1 parent 2190db8 commit bd58bd1

File tree

7 files changed

+82
-53
lines changed

7 files changed

+82
-53
lines changed

Changelist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- Increase performance of Wavetable oscillator
44
- Increase clickable size of next/prev preset buttons
5+
- Add dots to ADSRs
6+
- Add retrig to ADSRs (mono + glissando/portamento only)
57

68
1.0.11:
79

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.11
1+
1.0.12

plugin/Resources/layout.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
{ "id": "D", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
5151
{ "id": "S", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
5252
{ "id": "R", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
53-
{ "id": "adsr", "x": "getX('A')", "y": "getY('Res')", "r": "getR('R')", "b": "getY('A')" }
53+
{ "id": "adsr", "x": "getX('A')", "y": "getY('Res')", "r": "getR('R')", "b": "getY('A')" },
54+
{ "id": "Retrig", "r": "getR('adsr') - 3", "y": "getY('adsr') + 3", "w": 12, "h": 12 }
5455
]
5556
},
5657
{ "id": "adsr", "x": "prevR()+1", "y": "prevY()", "w": "210 + 160", "h": 163, "children":
@@ -60,7 +61,8 @@
6061
{ "id": "S", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
6162
{ "id": "R", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
6263
{ "id": "Vel", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
63-
{ "id": "adsr", "x": 0, "y": 23, "r": "parW()", "b": "getY('A')" }
64+
{ "id": "adsr", "x": 0, "y": 23, "r": "parW()", "b": "getY('A')" },
65+
{ "id": "Retrig", "r": "getR('adsr') - 3", "y": "getY('adsr') + 3", "w": 12, "h": 12 }
6466
] },
6567
{ "id": "lfo[1..3]", "x": 0, "y": "prevB()+1,prevY()", "w": 280, "h": 163, "children":
6668
[
@@ -82,7 +84,8 @@
8284
{ "id": "D", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
8385
{ "id": "S", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
8486
{ "id": "R", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
85-
{ "id": "adsr", "x": 0, "y": 23, "r": "parW()", "b": "getY('A')" }
87+
{ "id": "adsr", "x": 0, "y": 23, "r": "parW()", "b": "getY('A')" },
88+
{ "id": "Retrig", "r": "getR('adsr') - 3", "y": "getY('adsr') + 3", "w": 12, "h": 12 }
8689
] },
8790
{ "id": "step", "x": "prevR()+1", "y": "prevY()", "w": 218, "h": 163, "children":
8891
[

plugin/Source/Panels.h

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,24 @@ class ADSRBox : public gin::ParamBox
267267
addControl (new gin::Knob (preset.sustain), 2, 1);
268268
addControl (new gin::Knob (preset.release), 3, 1);
269269
addControl (new gin::Knob (preset.velocityTracking), 4, 1);
270+
addControl (retrig = new gin::SVGPluginButton (preset.retrig, gin::Assets::retrigger));
271+
272+
watchParam (proc.globalParams.mono);
273+
watchParam (proc.globalParams.glideMode);
274+
}
275+
276+
void paramChanged() override
277+
{
278+
gin::ParamBox::paramChanged ();
279+
280+
if (retrig != nullptr)
281+
retrig->setVisible (proc.globalParams.mono->isOn() && proc.globalParams.glideMode->getUserValue() > 0);
270282
}
271283

272284
WavetableAudioProcessor& proc;
273-
gin::ParamComponent::Ptr a, d, s, r;
274-
gin::ADSRComponent* adsr;
285+
gin::ParamComponent::Ptr a = nullptr, d = nullptr, s = nullptr, r = nullptr;
286+
gin::ADSRComponent* adsr = nullptr;
287+
gin::SVGPluginButton* retrig;
275288
};
276289

277290
//==============================================================================
@@ -290,13 +303,13 @@ class FilterBox : public gin::ParamBox
290303
addModSource (new gin::ModulationSourceButton (proc.modMatrix, proc.modSrcFilter, true));
291304

292305
auto freq = new gin::Knob (flt.frequency);
293-
addControl (freq, 0, 0);
294-
addControl (new gin::Knob (flt.resonance), 1, 0);
295-
addControl (new gin::Knob (flt.amount, true), 2, 0);
306+
addControl (freq);
307+
addControl (new gin::Knob (flt.resonance));
308+
addControl (new gin::Knob (flt.amount, true));
296309

297-
addControl (new gin::Knob (flt.keyTracking), 0, 1);
298-
addControl (new gin::Select (flt.type), 1, 1);
299-
addControl (v = new gin::Knob (flt.velocityTracking), 2, 1);
310+
addControl (new gin::Knob (flt.keyTracking));
311+
addControl (new gin::Select (flt.type));
312+
addControl (v = new gin::Knob (flt.velocityTracking));
300313

301314
adsr = new gin::ADSRComponent ();
302315
adsr->setParams (flt.attack, flt.decay, flt.sustain, flt.release);
@@ -333,8 +346,11 @@ class FilterBox : public gin::ParamBox
333346
addControl (new gin::SVGPluginButton (flt.wt2, asset2));
334347
addControl (new gin::SVGPluginButton (flt.sub, assetS));
335348
addControl (new gin::SVGPluginButton (flt.noise, assetN));
349+
addControl (retrig = new gin::SVGPluginButton (flt.retrig, gin::Assets::retrigger));
336350

337351
watchParam (flt.amount);
352+
watchParam (proc.globalParams.mono);
353+
watchParam (proc.globalParams.glideMode);
338354
}
339355

340356
void paramChanged () override
@@ -349,11 +365,16 @@ class FilterBox : public gin::ParamBox
349365
s->setEnabled (flt.amount->getUserValue() != 0.0f);
350366
r->setEnabled (flt.amount->getUserValue() != 0.0f);
351367
adsr->setEnabled (flt.amount->getUserValue() != 0.0f);
368+
369+
if (retrig != nullptr)
370+
retrig->setVisible (proc.globalParams.mono->isOn() && proc.globalParams.glideMode->getUserValue() > 0);
352371
}
353372

373+
354374
WavetableAudioProcessor& proc;
355-
gin::ParamComponent::Ptr v, a, d, s, r;
356-
gin::ADSRComponent* adsr;
375+
gin::ParamComponent::Ptr v = nullptr, a = nullptr, d = nullptr, s = nullptr, r = nullptr;
376+
gin::ADSRComponent* adsr = nullptr;
377+
gin::SVGPluginButton* retrig = nullptr;
357378

358379
juce::String asset1 = "M0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zm236 35.2c-7.4-4.3-16.5-4.3-24-.1l-56 32c-11.5 6.6-15.5 21.2-8.9 32.7s21.2 15.5 32.7 8.9L200 193.4V336H160c-13.3 0-24 10.7-24 24s10.7 24 24 24h64 64c13.3 0 24-10.7 24-24s-10.7-24-24-24H248V152c0-8.6-4.6-16.5-12-20.8z";
359380
juce::String asset2 = "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM190.7 184.7l-24.2 18.4c-10.5 8-25.6 6-33.6-4.5s-6-25.6 4.5-33.6l24.2-18.4c15.8-12 35.2-18.4 55.1-18.1l3.4 .1c46.5 .7 83.8 38.6 83.8 85.1c0 23.5-9.7 46-26.9 62.1L212.7 336H296c13.3 0 24 10.7 24 24s-10.7 24-24 24H152c-9.8 0-18.7-6-22.3-15.2s-1.3-19.6 5.9-26.3L244.3 240.6c7.5-7 11.7-16.8 11.7-27.1c0-20.3-16.3-36.8-36.6-37.1l-3.4-.1c-9.1-.1-18 2.8-25.3 8.3z";
@@ -407,13 +428,11 @@ class LFOBox : public gin::ParamBox
407428
return res;
408429
};
409430
l->setParams (lfo.wave, lfo.sync, lfo.rate, lfo.beat, lfo.depth, lfo.offset, lfo.phase, lfo.enable);
410-
addControl (l, 2, 0, 4, 1);
431+
addControl (l);
411432

412433
addControl (new gin::SVGPluginButton (lfo.retrig, gin::Assets::retrigger));
413434

414435
watchParam (lfo.sync);
415-
416-
setSize (112, 163);
417436
}
418437

419438
void paramChanged () override
@@ -472,11 +491,22 @@ class ENVBox : public gin::ParamBox
472491
return res;
473492
};
474493
addControl (g, 0, 0, 4, 1);
494+
addControl (retrig = new gin::SVGPluginButton (env.retrig, gin::Assets::retrigger));
475495

476-
setSize (112, 163);
496+
watchParam (proc.globalParams.mono);
497+
watchParam (proc.globalParams.glideMode);
498+
}
499+
500+
void paramChanged () override
501+
{
502+
gin::ParamBox::paramChanged ();
503+
504+
if (retrig != nullptr)
505+
retrig->setVisible (proc.globalParams.mono->isOn() && proc.globalParams.glideMode->getUserValue() > 0);
477506
}
478507

479508
WavetableAudioProcessor& proc;
509+
gin::SVGPluginButton* retrig = nullptr;
480510
int idx;
481511
};
482512

@@ -519,8 +549,6 @@ class StepBox : public gin::ParamBox
519549
addControl (g, 0, 0, 4, 1);
520550

521551
addControl (new gin::SVGPluginButton (prs.retrig, gin::Assets::retrigger));
522-
523-
setSize (112, 163);
524552
}
525553

526554
WavetableAudioProcessor& proc;
@@ -618,8 +646,6 @@ class GateBox : public gin::ParamBox
618646
auto g = new gin::GateEffectComponent (Cfg::numGateSteps);
619647
g->setParams (proc.gateParams.length, proc.gateParams.l, proc.gateParams.r, proc.gateParams.enable);
620648
addControl (g, 0, 1, 4, 1);
621-
622-
setSize (112, 163);
623649
}
624650

625651
WavetableAudioProcessor& proc;
@@ -642,8 +668,6 @@ class ChorusBox : public gin::ParamBox
642668

643669
addControl (new gin::Knob (proc.chorusParams.depth), 0.5f, 1.0f);
644670
addControl (new gin::Knob (proc.chorusParams.width), 1.5f, 1.0f);
645-
646-
setSize (168, 163);
647671
}
648672

649673
WavetableAudioProcessor& proc;
@@ -661,8 +685,6 @@ class DistortBox : public gin::ParamBox
661685
addEnable (proc.distortionParams.enable);
662686

663687
addControl (new gin::Knob (proc.distortionParams.amount), 0, 0);
664-
665-
setSize (112, 163);
666688
}
667689

668690
WavetableAudioProcessor& proc;
@@ -691,8 +713,6 @@ class DelayBox : public gin::ParamBox
691713
b->setName ("Delay2");
692714

693715
watchParam (proc.delayParams.sync);
694-
695-
setSize (168, 163);
696716
}
697717

698718
void paramChanged () override
@@ -724,8 +744,6 @@ class ReverbBox : public gin::ParamBox
724744
addControl (new gin::Knob (proc.reverbParams.damping), 0, 1);
725745
addControl (new gin::Knob (proc.reverbParams.predelay), 1, 1);
726746
addControl (new gin::Knob (proc.reverbParams.mix), 2, 1);
727-
728-
setSize (168, 163);
729747
}
730748

731749
WavetableAudioProcessor& proc;

plugin/Source/PluginProcessor.cpp

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,22 @@ void WavetableAudioProcessor::FilterParams::setup (WavetableAudioProcessor& p)
169169

170170
float maxFreq = float (gin::getMidiNoteFromHertz (20000.0));
171171

172-
enable = p.addIntParam (id + "enable", nm + "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, 1.0f, 0.0f);
173-
type = p.addIntParam (id + "type", nm + "Type", "Type", "", { 0.0, 7.0, 1.0, 1.0 }, 0.0, 0.0f, filterTextFunction);
174-
keyTracking = p.addExtParam (id + "key", nm + "Key", "Key", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
175-
velocityTracking = p.addExtParam (id + "vel", nm + "Vel", "Vel", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
176-
frequency = p.addExtParam (id + "freq", nm + "Freq", "Freq", "Hz", { 0.0, maxFreq, 0.0, 1.0 }, 64.0, 0.0f, freqTextFunction);
177-
resonance = p.addExtParam (id + "res", nm + "Res", "Res", "", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
178-
amount = p.addExtParam (id + "amount", nm + "Amount", "Amnt", "", { -1.0, 1.0, 0.0, 1.0 }, 0.0, 0.0f);
179-
attack = p.addExtParam (id + "attack", nm + "Attack", "A", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
180-
decay = p.addExtParam (id + "decay", nm + "Decay", "D", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
181-
sustain = p.addExtParam (id + "sustain", nm + "Sustain", "S", "%", { 0.0, 100.0, 0.0, 1.0 }, 80.0f, 0.0f);
182-
release = p.addExtParam (id + "release", nm + "Release", "R", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
183-
wt1 = p.addIntParam (id + "wt1", nm + "WT1", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
184-
wt2 = p.addIntParam (id + "wt2", nm + "WT2", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
185-
sub = p.addIntParam (id + "sub", nm + "sub", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
186-
noise = p.addIntParam (id + "noise", nm + "noise", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
172+
enable = p.addIntParam (id + "enable", nm + "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, 1.0f, 0.0f);
173+
retrig = p.addIntParam (id + "retrig", nm + "Retrig", "Retrig", "", { 0.0, 1.0, 1.0, 1.0 }, 1.0, 0.0f, enableTextFunction);
174+
type = p.addIntParam (id + "type", nm + "Type", "Type", "", { 0.0, 7.0, 1.0, 1.0 }, 0.0, 0.0f, filterTextFunction);
175+
keyTracking = p.addExtParam (id + "key", nm + "Key", "Key", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
176+
velocityTracking = p.addExtParam (id + "vel", nm + "Vel", "Vel", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
177+
frequency = p.addExtParam (id + "freq", nm + "Freq", "Freq", "Hz", { 0.0, maxFreq, 0.0, 1.0 }, 64.0, 0.0f, freqTextFunction);
178+
resonance = p.addExtParam (id + "res", nm + "Res", "Res", "", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
179+
amount = p.addExtParam (id + "amount", nm + "Amount", "Amnt", "", { -1.0, 1.0, 0.0, 1.0 }, 0.0, 0.0f);
180+
attack = p.addExtParam (id + "attack", nm + "Attack", "A", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
181+
decay = p.addExtParam (id + "decay", nm + "Decay", "D", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
182+
sustain = p.addExtParam (id + "sustain", nm + "Sustain", "S", "%", { 0.0, 100.0, 0.0, 1.0 }, 80.0f, 0.0f);
183+
release = p.addExtParam (id + "release", nm + "Release", "R", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
184+
wt1 = p.addIntParam (id + "wt1", nm + "WT1", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
185+
wt2 = p.addIntParam (id + "wt2", nm + "WT2", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
186+
sub = p.addIntParam (id + "sub", nm + "sub", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
187+
noise = p.addIntParam (id + "noise", nm + "noise", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f);
187188

188189
sustain->conversionFunction = [] (float in) { return in / 100.0f; };
189190
velocityTracking->conversionFunction = [] (float in) { return in / 100.0f; };
@@ -197,6 +198,7 @@ void WavetableAudioProcessor::EnvParams::setup (WavetableAudioProcessor& p, int
197198
juce::String nm = "ENV" + juce::String (idx + 1) + " ";
198199

199200
enable = p.addIntParam (id + "enable", nm + "Enable", "Enable", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0, 0.0f, enableTextFunction);
201+
retrig = p.addIntParam (id + "retrig", nm + "Retrig", "Retrig", "", { 0.0, 1.0, 1.0, 1.0 }, 1.0, 0.0f, enableTextFunction);
200202
attack = p.addExtParam (id + "attack", nm + "Attack", "A", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
201203
decay = p.addExtParam (id + "decay", nm + "Decay", "D", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
202204
sustain = p.addExtParam (id + "sustain", nm + "Sustain", "S", "%", { 0.0, 100.0, 0.0, 1.0 }, 80.0f, 0.0f);
@@ -271,7 +273,8 @@ void WavetableAudioProcessor::GateParams::setup (WavetableAudioProcessor& p)
271273
//==============================================================================
272274
void WavetableAudioProcessor::ADSRParams::setup (WavetableAudioProcessor& p)
273275
{
274-
velocityTracking = p.addExtParam ("vel", "Vel", "Vel", "", { 0.0, 100.0, 0.0, 1.0 }, 100.0, 0.0f);
276+
retrig = p.addIntParam ("retrig", "Retrig", "Retrig","", { 0.0, 1.0, 1.0, 1.0 }, 1.0f, 0.0f, enableTextFunction);
277+
velocityTracking = p.addExtParam ("vel", "Vel", "Vel", "", { 0.0, 100.0, 0.0, 1.0 }, 100.0f, 0.0f);
275278
attack = p.addExtParam ("attack", "Attack", "A", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
276279
decay = p.addExtParam ("decay", "Decay", "D", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f);
277280
sustain = p.addExtParam ("sustain", "Sustain", "S", "%", { 0.0, 100.0, 0.0, 1.0 }, 80.0f, 0.0f);

plugin/Source/PluginProcessor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class WavetableAudioProcessor : public gin::Processor,
8686
FilterParams() = default;
8787

8888
gin::Parameter::Ptr enable, type, keyTracking, velocityTracking,
89-
frequency, resonance, amount,
89+
frequency, resonance, amount, retrig,
9090
attack, decay, sustain, release, wt1, wt2, sub, noise;
9191

9292
void setup (WavetableAudioProcessor& p);
@@ -98,7 +98,7 @@ class WavetableAudioProcessor : public gin::Processor,
9898
{
9999
EnvParams() = default;
100100

101-
gin::Parameter::Ptr enable, attack, decay, sustain, release;
101+
gin::Parameter::Ptr enable, attack, decay, sustain, release, retrig;
102102

103103
void setup (WavetableAudioProcessor& p, int idx);
104104

@@ -132,7 +132,7 @@ class WavetableAudioProcessor : public gin::Processor,
132132
{
133133
ADSRParams() = default;
134134

135-
gin::Parameter::Ptr attack, decay, sustain, release, velocityTracking;
135+
gin::Parameter::Ptr attack, decay, sustain, release, velocityTracking, retrig;
136136

137137
void setup (WavetableAudioProcessor& p);
138138

plugin/Source/WavetableVoice.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,15 @@ void WavetableVoice::noteRetriggered()
119119

120120
updateParams (0);
121121

122-
filterADSR.noteOn();
122+
if (proc.filterParams.retrig->getBoolValue())
123+
filterADSR.noteOn();
123124

124-
for (auto& a : modADSRs)
125-
a.noteOn();
125+
for (auto idx = 0; auto& a : modADSRs)
126+
if (proc.envParams[idx++].retrig->getBoolValue())
127+
a.noteOn();
126128

127-
adsr.noteOn();
129+
if (proc.adsrParams.retrig->getBoolValue())
130+
adsr.noteOn();
128131
}
129132

130133
void WavetableVoice::noteStopped (bool allowTailOff)

0 commit comments

Comments
 (0)