Is it better to use Slider Listener or AudioProcessorValueTreeState for knobs and sliders?

In terms of connecting PluginEditor knobs and sliders to the PluginProcessor, is Slider.listener the best thing to use or AudioProcessorValueTreeState ?

If I understand correctly those both do the same thing (?) Just wondering which one was best/easiest to use.

The alternatie to AudioProcessorValueTreeState::SliderAttachment is SliderParameterAttachment.

If you use the AudioProcessorValueTreeState at all is personal preference.

Writing using Slider::Listener by hand is not advisable. You would need to take care of concurrency (main thread/audio thread), ping-pong updates, changeGestures for automations etc.
Slider::Listener is only useful, if you don’t attach it to an AudioParameter, but instead trigger something on the main thread.

1 Like

Do you use AudioProcessorValueTreeState personally, or something else?

I did in the past. For a new project I am undecided yet. Seems APVTS is no longer necessary for the reasons it was created, but at the same time without it you need to write your own serialisation of the parameter values.

That is not hard to do, once you checked which methods to call when restoring the values. And you need to write that only once in a lifetime, so it’s a good start for your personal stash of code.