SliderAttachment for a slider with multiple thumbs / Feature Request


#1

I’m using a Slider with two thumbs to set a ranged random value for a parameter in a piece of software I’m developing, and am now moving towards integrating this with the AudioProcessorValueTreeState system since it seems to help with some nasty problems.

What is a good way to do this? My assumption is that I should use two attachments targeting the min and max values respectively. I can’t override setValue(), sliderValueChanged() to target slider.get/setMin/MaxValue() in AudioProcessorValueTreeState::SliderAttachment::Pimpl however since Pimpl is private. For now, I’ve cobbled together the methods from Pimpl and AttachedControlBase, and am working with that, but wanted to see if there is something bad about this approach (the two attachments, one for min, one for max) and whether there is a better way to do this, since it’s not terribly maintenance friendly.

If there isn’t, as a feature request, could SliderAttachment take an optional argument that specifies whether it targets min/max/regular value?


#2

Good request, it doesn’t currently do that. But you could probably do it quite easily with a custom slider. If you have a look at how SliderAttachment is implemented, it’s not super-difficult, and you could pimp your own version of that to control multiple values.


#3

Thanks, @jules. I’ve got it working now with two custom SliderAttachments (the approach in the first post) and that seems to do the trick.