Plugin Editor won't let me inherit from Slider::Listener

Hi guys,

I’m building an audio plugin and every time I try to inherit from Slider::Listener in my PluginEditor.h file, it won’t build. I get redirected to an error that happens elsewhere that doesn’t make sense to me. Picture below. Anybody else run into this? Thanks in advance!

Also, here’s a pic from the PluginEditor.h file that shows me trying to inherit.

Slider::Listener is an abstract class, you must override its pure virtual sliderValueChanged() function


The reason this won’t work for you is because Slider::Listener has a pure virtual function you need to declare in order to use the class.

If you see the documentation here, you’ll see that the function sliderValueChanged() is virtual function. Be sure to declare the function with the keyword override as well in the header file.

I have a video from a while back that shows how to do this, but I would now advise you to use the audioProcessorValueTreeState instead of Slider::Listener. This will allow you to seamlessly replay value changes from your slider to your processor without needing to inherit Slider::Listener. The video shows you both ways but you should use either one or the other.

There have also been recent updates to the audioProcessorValueTreeState which I’ve outlined here.

I know it’s a lot to get through but let us know if you have any questions.

Hope this helps!


Hey Josh! I’m actually a huge fan!
It’s funny, I was following your tutorial on automating plugin parameters and I made it to the end when I tried to add this. I forgot about overriding the virtual function but I also didn’t realize that I no longer needed a slider listener if I was using the audioProcessorValueTreeState.

Thanks for your help and for your videos!

1 Like

But is it possible to listen for a change in the value state tree? Like if I automate a parameter in Ableton, I’d like to be able to detect that change and trigger other functions such a redraw() function.

There is a Listener class available in the APVTS:

You can use that to get a callback when parameters associated with the tree change

1 Like

Works like a charm, thanks!

1 Like