Hey there,
I’m working on a plug-in that controls a wfs-system via osc.
Here is an image of the GUI to get an idea:
I created three LFO (juce::Oscillator) objects to modulate x, y and z dimension.
The LFOs exist inside the pluginProcessor.
In processBlock() i wrote the following…
if (xLFO->isInitialised())
{
xLFOOut = xLFO->processSample(0.0f);
yLFOOut = yLFO->processSample(0.0f);
zLFOOut = zLFO->processSample(0.0f);
xAttachment->setValueAsCompleteGesture(xLFOOut);
yAttachment->setValueAsCompleteGesture(yLFOOut);
zAttachment->setValueAsCompleteGesture(zLFOOut);
}
… to make the oscillators move forwards once per audio-callback.
In my gui class when you hit the lfo start button the following happens:
LFOStartButton.setButtonText("Stop");
LFOStartButton.setColour(juce::TextButton::buttonColourId, seamlessGrey);
audioProcessor.xLFO->setFrequency(xRate);
audioProcessor.xLFO->initialise([xDepth, xPhase, xRate, xOffset](float x)
{
return xDepth * std::sin(xRate * 2 * M_PI * x + xPhase) + xOffset;
});
xAttachment->beginGesture();
audioProcessor.yLFO->setFrequency(yRate);
audioProcessor.yLFO->initialise([yDepth, yPhase, yRate, yOffset](float x)
{
return yDepth * std::sin(yRate * 2 * M_PI * x + yPhase) + yOffset;
});
yAttachment->beginGesture();
audioProcessor.zLFO->setFrequency(zRate);
audioProcessor.zLFO->initialise([zDepth, zPhase, zRate, zOffset](float x)
{
return zDepth * std::sin(zRate * 2 * M_PI * x + zPhase) + zOffset;
});
zAttachment->beginGesture();
When you hit the stop button:
LFOStartButton.setButtonText("Start");
LFOStartButton.setColour(juce::TextButton::buttonColourId, seamlessBlue);
xAttachment->endGesture();
audioProcessor.xLFO->reset();
audioProcessor.xLFO.reset();
audioProcessor.xLFO = std::make_unique<juce::dsp::Oscillator<float>>();
yAttachment->endGesture();
audioProcessor.yLFO->reset();
audioProcessor.yLFO.reset();
audioProcessor.yLFO = std::make_unique<juce::dsp::Oscillator<float>>();
zAttachment->endGesture();
audioProcessor.zLFO->reset();
audioProcessor.zLFO.reset();
audioProcessor.zLFO = std::make_unique<juce::dsp::Oscillator<float>>();
audioProcessor.prepareLFOs();
the prepareLFOs() function does the following:
xLFO->prepare(juce::dsp::ProcessSpec({ getSampleRate() / getBlockSize(), (juce::uint32)getBlockSize(), 1 }));
yLFO->prepare(juce::dsp::ProcessSpec({ getSampleRate() / getBlockSize(), (juce::uint32)getBlockSize(), 1 }));
zLFO->prepare(juce::dsp::ProcessSpec({ getSampleRate() / getBlockSize(), (juce::uint32)getBlockSize(), 1 }));
it also gets called in prepareToPlay().
Everything works fine, except that in regular time intervals the slider-knob jumps to a certain point of its oscillation as you can see in the following video:
https://youtu.be/Z6K83W2wv9Y
Where and when it jumps depends on the rate of the oscillation.
Does anybody have an idea where this could come from?
Cheers,
Christian