Add retrigger to lfos

This commit is contained in:
Roland Rabien 2023-09-24 17:49:53 -07:00
commit 56c3bbfa51
7 changed files with 21 additions and 20 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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();
}

View file

@ -56,6 +56,7 @@ private:
gin::StereoOscillator::Params noiseParams;
gin::EasedValueSmoother<float> noteSmoother;
juce::Random rng;
float ampKeyTrack = 1.0f;
};