Add retrig to OSCs

This commit is contained in:
Roland Rabien 2023-10-03 08:11:07 -07:00
commit 73b34ded3f
6 changed files with 13 additions and 7 deletions

@ -1 +1 @@
Subproject commit a03d9fcc37cc708f5fdf8ade35037438651d1ecf
Subproject commit f8c67b8a184bc33b7470889a44e984e6cc7b5f8a

View file

@ -3,6 +3,7 @@
[
{ "id": "osc[1..2]", "x": "0,prevR()+1", "y": 0, "w": "parW()/2", "h": 163, "children":
[
{ "id": "Retrig", "r": "parW() - 6", "y": 6, "w": 12, "h": 12 },
{ "id": "Pos", "x": 0, "y": 23, "w": 56, "h": 70 },
{ "id": "Tune", "x": "prevR()", "y": 23, "w": 56, "h": 70 },
{ "id": "Fine", "x": "prevR()", "y": 23, "w": 56, "h": 70 },
@ -26,6 +27,7 @@
},
{ "id": "sub", "x": "prevR()+1", "y": "prevY()", "w": 112, "h": 163, "children":
[
{ "id": "Retrig", "r": "parW() - 6", "y": 6, "w": 12, "h": 12 },
{ "id": "Wave", "x": 0, "y": 23, "w": 56, "h": 70 },
{ "id": "Tune", "x": "prevR()", "y": 23, "w": 56, "h": 70 },
{ "id": "Level", "x": 0, "y": "prevB()", "w": 56, "h": 70 },

View file

@ -24,6 +24,7 @@ public:
addEnable (osc.enable);
addControl (new gin::SVGPluginButton (osc.retrig, gin::Assets::retrigger));
addControl (new gin::Knob (osc.pos));
addControl (new gin::Knob (osc.tune, true));
addControl (new gin::Knob (osc.finetune, true));
@ -205,6 +206,7 @@ public:
addEnable (sub.enable);
addControl (new gin::SVGPluginButton (sub.retrig, gin::Assets::retrigger));
addControl (new gin::Knob (sub.tune, true), 0, 0);
addControl (new gin::Knob (sub.level), 1, 0);
addControl (new gin::Knob (sub.pan, true), 0, 1);

View file

@ -114,6 +114,7 @@ void WavetableAudioProcessor::OSCParams::setup (WavetableAudioProcessor& p, int
juce::String nm = "OSC" + juce::String (idx + 1) + " ";
enable = p.addIntParam (id + "enable", nm + "Enable", "Enable", "", { 0.0, 1.0, 1.0, 1.0 }, idx == 0 ? 1.0f : 0.0f, 0.0f);
retrig = p.addIntParam (id + "retrig", nm + "Retrig", "Retrig", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0, 0.0f, enableTextFunction);
voices = p.addIntParam (id + "unison", nm + "Unison", "Unison", "", { 1.0, 8.0, 1.0, 1.0 }, 1.0, 0.0f);
tune = p.addExtParam (id + "tune", nm + "Tune", "Tune", "st", { -36.0, 36.0, 1.0, 1.0 }, 0.0, 0.0f);
finetune = p.addExtParam (id + "finetune", nm + "Fine Tune", "Fine", "ct", { -100.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
@ -134,7 +135,8 @@ void WavetableAudioProcessor::SubParams::setup (WavetableAudioProcessor& p)
juce::String id = "sub";
juce::String nm = "SUB ";
enable = p.addIntParam (id + "enable", nm + "Enable", "Enable", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0f, 0.0f);
enable = p.addIntParam (id + "enable", nm + "Enable", "Enable", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0f, 0.0f, enableTextFunction);
retrig = p.addIntParam (id + "retrig", nm + "Retrig", "Retrig", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0, 0.0f, enableTextFunction);
wave = p.addIntParam (id + "wave", nm + "Wave", "Wave", "", { 0.0, 3.0, 1.0, 1.0 }, 1.0, 0.0f, subTextFunction);
tune = p.addExtParam (id + "tune", nm + "Tune", "Tune", "st", { -36.0, 36.0, 1.0, 1.0 }, 0.0, 0.0f);
level = p.addExtParam (id + "level", nm + "Level", "Level", "db", { -100.0, 0.0, 1.0, 4.0 }, 0.0, 0.0f);

View file

@ -52,7 +52,7 @@ public:
{
OSCParams() = default;
gin::Parameter::Ptr enable, voices, tune, finetune, level, pos, detune, spread, pan, bend, formant;
gin::Parameter::Ptr enable, voices, tune, finetune, level, pos, detune, spread, pan, bend, formant, retrig;
void setup (WavetableAudioProcessor& p, int idx);
@ -63,7 +63,7 @@ public:
{
SubParams() = default;
gin::Parameter::Ptr enable, wave, tune, level, pan;
gin::Parameter::Ptr enable, wave, tune, level, pan, retrig;
void setup (WavetableAudioProcessor& p);

View file

@ -51,11 +51,11 @@ void WavetableVoice::noteStarted()
updateParams (0);
snapParams();
for (auto& osc : oscillators)
osc.noteOn();
for (auto idx = 0; auto& osc : oscillators)
osc.noteOn (proc.oscParams[idx++].retrig->getBoolValue() ? 0.0f : proc.rng.nextFloat());
noise.noteOn();
sub.noteOn();
sub.noteOn (proc.subParams.retrig->getBoolValue() ? 0.0f : proc.rng.nextFloat());
filterADSR.noteOn();