LFO & StepLFO support multiple dots

This commit is contained in:
Roland Rabien 2023-09-29 13:29:08 -07:00
commit a2f1eb82e4
3 changed files with 31 additions and 4 deletions

@ -1 +1 @@
Subproject commit a830cb853f4d4d005f8a5b381b1c5c67804bcae2 Subproject commit 98c1f54cb9b17090522327064bd2d76090f21af3

View file

@ -321,7 +321,21 @@ public:
addControl (new gin::Knob (lfo.offset, true)); addControl (new gin::Knob (lfo.offset, true));
auto l = new gin::LFOComponent(); auto l = new gin::LFOComponent();
l->phaseCallback = [this] { return proc.modLFOs[idx].getCurrentPhase(); }; l->phaseCallback = [this, &lfo]
{
std::vector<float> res;
if (lfo.enable->isOn())
{
res.push_back (proc.modLFOs[idx].getCurrentPhase());
for (auto v : proc.getActiveVoices())
if (auto wtv = dynamic_cast<WavetableVoice*> (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); 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 (l, 2, 0, 4, 1);
@ -403,7 +417,21 @@ public:
addControl (new gin::Knob (prs.length), 1, 1); addControl (new gin::Knob (prs.length), 1, 1);
auto g = new gin::StepLFOComponent (Cfg::numStepLFOSteps); auto g = new gin::StepLFOComponent (Cfg::numStepLFOSteps);
g->phaseCallback = [this] { return proc.modStepLFO.getCurrentPhase(); }; g->phaseCallback = [this, &prs]
{
std::vector<float> res;
if (prs.enable->isOn())
{
res.push_back (proc.modStepLFO.getCurrentPhase());
for (auto v : proc.getActiveVoices())
if (auto wtv = dynamic_cast<WavetableVoice*> (v))
res.push_back (wtv->modStepLFO.getCurrentPhase());
}
return res;
};
g->setParams (prs.beat, prs.length, prs.level, prs.enable); g->setParams (prs.beat, prs.length, prs.level, prs.enable);
addControl (g, 0, 0, 4, 1); addControl (g, 0, 0, 4, 1);

View file

@ -30,7 +30,6 @@ public:
float getFilterCutoffNormalized(); float getFilterCutoffNormalized();
gin::WTOscillator::Params getLiveWTParams (int osc); gin::WTOscillator::Params getLiveWTParams (int osc);
private:
void updateParams (int blockSize); void updateParams (int blockSize);
WavetableAudioProcessor& proc; WavetableAudioProcessor& proc;