diff --git a/modules/gin b/modules/gin index c68d934..49e7a0e 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit c68d93436944689defeb513e4e1007fb9a8995c8 +Subproject commit 49e7a0e0d34f0bd47cbd083790e55721573a200e diff --git a/plugin/Resources/layout.json b/plugin/Resources/layout.json index b1b0a92..793aaa7 100644 --- a/plugin/Resources/layout.json +++ b/plugin/Resources/layout.json @@ -56,7 +56,8 @@ { "id": "Phase", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 }, { "id": "Delay", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 }, { "id": "Fade", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 }, - { "id": "lfo", "x": "getX('Offset')", "y": "getY('Rate')", "r": "getR('Fade')", "b": "getY('Fade')" } + { "id": "lfo", "x": "getX('Offset')", "y": "getY('Rate')", "r": "getR('Fade')", "b": "getY('Fade')" }, + { "id": "Retrig", "r": "getR('lfo') - 3", "y": "getY('lfo') + 3", "w": 12, "h": 12 } ] }, { "id": "env[1..3]", "x": "getR('lfo1')+1", "y": "prevY()", "w": "168 + 50", "h": 163, "children": [ diff --git a/plugin/Source/Panels.h b/plugin/Source/Panels.h index 9ecba15..a12bafc 100644 --- a/plugin/Source/Panels.h +++ b/plugin/Source/Panels.h @@ -309,21 +309,23 @@ public: addModSource (new gin::ModulationSourceButton (proc.modMatrix, proc.modSrcLFO[idx], true)); addModSource (new gin::ModulationSourceButton (proc.modMatrix, proc.modSrcMonoLFO[idx], false)); - addControl (r = new gin::Knob (lfo.rate), 0, 0); - addControl (b = new gin::Select (lfo.beat), 0, 0); - addControl (new gin::Knob (lfo.depth, true), 1, 0); - addControl (new gin::Knob (lfo.fade, true), 0, 1); - addControl (new gin::Knob (lfo.delay), 1, 1); - - addControl (new gin::Select (lfo.wave), 2, 1); - addControl (new gin::Switch (lfo.sync), 3, 1); - addControl (new gin::Knob (lfo.phase, true), 4, 1); - addControl (new gin::Knob (lfo.offset, true), 5, 1); + addControl (r = new gin::Knob (lfo.rate)); + addControl (b = new gin::Select (lfo.beat)); + addControl (new gin::Knob (lfo.depth, true)); + addControl (new gin::Knob (lfo.fade, true)); + addControl (new gin::Knob (lfo.delay)); + addControl (new gin::Select (lfo.wave)); + addControl (new gin::Switch (lfo.sync)); + addControl (new gin::Knob (lfo.phase, true)); + addControl (new gin::Knob (lfo.offset, true)); + auto l = new gin::LFOComponent(); l->phaseCallback = [this] { return proc.modLFOs[idx].getCurrentPhase(); }; l->setParams (lfo.wave, lfo.sync, lfo.rate, lfo.beat, lfo.depth, lfo.offset, lfo.phase, lfo.enable); addControl (l, 2, 0, 4, 1); + + addControl (new gin::SVGPluginButton (lfo.retrig, gin::Assets::retrigger)); watchParam (lfo.sync); diff --git a/plugin/Source/PluginProcessor.cpp b/plugin/Source/PluginProcessor.cpp index 51bbabd..8cb2384 100644 --- a/plugin/Source/PluginProcessor.cpp +++ b/plugin/Source/PluginProcessor.cpp @@ -211,6 +211,7 @@ void WavetableAudioProcessor::LFOParams::setup (WavetableAudioProcessor& p, int enable = p.addIntParam (id + "enable", nm + "Enable", "Enable", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0f, 0.0f, enableTextFunction); sync = p.addIntParam (id + "sync", nm + "Sync", "Sync", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0, 0.0f, enableTextFunction); + retrig = p.addIntParam (id + "retrig", nm + "Retrig", "Retrig", "", { 0.0, 1.0, 1.0, 1.0 }, 1.0, 0.0f, enableTextFunction); wave = p.addIntParam (id + "wave", nm + "Wave", "Wave", "", { 1.0, 17.0, 1.0, 1.0 }, 1.0, 0.0f, lfoTextFunction); rate = p.addExtParam (id + "rate", nm + "Rate", "Rate", "Hz", { 0.0, 50.0, 0.0, 0.3f }, 10.0, 0.0f); beat = p.addIntParam (id + "beat", nm + "Beat", "Beat", "", { 0.0, float (notes.size() - 1), 1.0, 1.0 }, 13.0, 0.0f, durationTextFunction); diff --git a/plugin/Source/PluginProcessor.h b/plugin/Source/PluginProcessor.h index e590289..3c408d9 100644 --- a/plugin/Source/PluginProcessor.h +++ b/plugin/Source/PluginProcessor.h @@ -108,7 +108,7 @@ public: { LFOParams() = default; - gin::Parameter::Ptr enable, sync, wave, rate, beat, depth, phase, offset, fade, delay; + gin::Parameter::Ptr enable, sync, retrig, wave, rate, beat, depth, phase, offset, fade, delay; void setup (WavetableAudioProcessor& p, int idx); diff --git a/plugin/Source/WavetableVoice.cpp b/plugin/Source/WavetableVoice.cpp index 5ac815c..917f098 100644 --- a/plugin/Source/WavetableVoice.cpp +++ b/plugin/Source/WavetableVoice.cpp @@ -61,8 +61,8 @@ void WavetableVoice::noteStarted() for (auto& a : modADSRs) a.noteOn(); - for (auto& l : modLFOs) - l.noteOn(); + for (auto idx = 0; auto& l : modLFOs) + l.noteOn (proc.lfoParams[idx++].retrig->getBoolValue() ? -1 : rng.nextFloat()); modStepLFO.reset(); modStepLFO.noteOn(); @@ -91,15 +91,11 @@ void WavetableVoice::noteRetriggered() updateParams (0); - for (auto& osc : oscillators) - osc.noteOn(); - filterADSR.noteOn(); for (auto& a : modADSRs) a.noteOn(); - modStepLFO.noteOn(); adsr.noteOn(); } diff --git a/plugin/Source/WavetableVoice.h b/plugin/Source/WavetableVoice.h index 734c0e5..af70162 100644 --- a/plugin/Source/WavetableVoice.h +++ b/plugin/Source/WavetableVoice.h @@ -56,6 +56,7 @@ private: gin::StereoOscillator::Params noiseParams; gin::EasedValueSmoother noteSmoother; + juce::Random rng; float ampKeyTrack = 1.0f; };