'Holding' or 'Freezing' rendering when dragging/interpolating JUCE sliders

sliderattachment
gui
audiovaluetreestate

#1

Hi Juce devs!

Hope you are enjoying the sunshine this summer.

Background : I have currently built a spatial-reverb VST that is rendered using a convolution-structure using JUCE, and one of our third-party 3d frameworks.

I have designed the plugin in a conventional PluginProcessor and PluginEditor format using the AudioProcessorValueTreeState across both classes, and register sliders through the createAndAddParameter(…) . This all works fine.

However…

With convolving signals and interpolating through values, there appears to be some audio glitches that occur (quite natural for convolution) when audio is on playback. Therefore, the normal procedure I have seen from other convolution-based reverb VSTs is to ‘hold’ or ‘freeze’ the rendering. Thus, I need the AudioProcessorValueTree to behave according to these requirements:

  1. When the user begins dragging the slider, render only the previous state of the slider. ie. the position the user had before he clicked the slider.
  2. When the user has finished dragging, then render and send the newest value.

I have used juce::Slider::Listener in the context of the AudioProcessorValueTree the following functions I found from a bit of looking around on this forum to begin with:

void sliderValueChanged(juce::Slider* slider) override;

void sliderDragStarted(juce::Slider* slider) override;

void sliderDragEnded(juce::Slider* slider) override;

void addSliderListeners();

juce::AudioProcessorParameter* getParameterFromSlider (const juce::Slider* slider) const;

They are implemented to do this - but here my call procedure is not right.

void Editor::sliderValueChanged(juce::Slider* slider)
{
    if (juce::AudioProcessorParameter* param = getParameterFromSlider(slider))
    {
        param->setValueNotifyingHost((float)slider->getValue());
   
    }
}
    
void Editor::sliderDragStarted(juce::Slider* slider)
{
    if (juce::AudioProcessorParameter* param = getParameterFromSlider(slider))
    {
        param->beginChangeGesture();
    }
}
    
void Editor::sliderDragEnded (Slider* slider)
{
    if (AudioProcessorParameter* param = getParameterFromSlider(slider))
    {
        param->endChangeGesture();
    }
}

Am I on the right lines here? I thought that moving the functionality inside sliderValueChanged inside sliderDragEnded() because in that way you change the parameter only when you finished dragging.

Any insights on this?

Thanks!

Will