From a2f1eb82e41dc8dafea255b1ce6aab2b993f4be8 Mon Sep 17 00:00:00 2001 From: Roland Rabien Date: Fri, 29 Sep 2023 13:29:08 -0700 Subject: [PATCH] LFO & StepLFO support multiple dots --- modules/gin | 2 +- plugin/Source/Panels.h | 32 ++++++++++++++++++++++++++++++-- plugin/Source/WavetableVoice.h | 1 - 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/modules/gin b/modules/gin index a830cb8..98c1f54 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit a830cb853f4d4d005f8a5b381b1c5c67804bcae2 +Subproject commit 98c1f54cb9b17090522327064bd2d76090f21af3 diff --git a/plugin/Source/Panels.h b/plugin/Source/Panels.h index 3d9c7c1..fef200a 100644 --- a/plugin/Source/Panels.h +++ b/plugin/Source/Panels.h @@ -321,7 +321,21 @@ public: addControl (new gin::Knob (lfo.offset, true)); auto l = new gin::LFOComponent(); - l->phaseCallback = [this] { return proc.modLFOs[idx].getCurrentPhase(); }; + l->phaseCallback = [this, &lfo] + { + std::vector res; + + if (lfo.enable->isOn()) + { + res.push_back (proc.modLFOs[idx].getCurrentPhase()); + + for (auto v : proc.getActiveVoices()) + if (auto wtv = dynamic_cast (v)) + res.push_back (wtv->modLFOs[idx].getCurrentPhase()); + } + + return res; + }; l->setParams (lfo.wave, lfo.sync, lfo.rate, lfo.beat, lfo.depth, lfo.offset, lfo.phase, lfo.enable); addControl (l, 2, 0, 4, 1); @@ -403,7 +417,21 @@ public: addControl (new gin::Knob (prs.length), 1, 1); auto g = new gin::StepLFOComponent (Cfg::numStepLFOSteps); - g->phaseCallback = [this] { return proc.modStepLFO.getCurrentPhase(); }; + g->phaseCallback = [this, &prs] + { + std::vector res; + + if (prs.enable->isOn()) + { + res.push_back (proc.modStepLFO.getCurrentPhase()); + + for (auto v : proc.getActiveVoices()) + if (auto wtv = dynamic_cast (v)) + res.push_back (wtv->modStepLFO.getCurrentPhase()); + } + + return res; + }; g->setParams (prs.beat, prs.length, prs.level, prs.enable); addControl (g, 0, 0, 4, 1); diff --git a/plugin/Source/WavetableVoice.h b/plugin/Source/WavetableVoice.h index 5dc5c81..24461bb 100644 --- a/plugin/Source/WavetableVoice.h +++ b/plugin/Source/WavetableVoice.h @@ -30,7 +30,6 @@ public: float getFilterCutoffNormalized(); gin::WTOscillator::Params getLiveWTParams (int osc); -private: void updateParams (int blockSize); WavetableAudioProcessor& proc;