Behaviour of AudioProcessorValueTreeState Parameter and ButtonAttachment


#1

I’m currently attempting to use AudioProcessorValueTreeState::Parameter to create a boolean parameter that toggles between the values 0 and 127, using a toggle button attached to the parameter using ButtonAttachment.

For this I have set the parameter’s minimum value to 0, maximum value to 127, isDiscrete to true and isBoolean to true. This works fine when adjusting the parameter in the host - the value registered in the parameterChanged callback is either 0 or 127 and the button UI updates correctly. However when interacting with the button the value just toggles between 0 and 1, meaning the backend parameter is never toggled on. I’ve tried changing the interval value to 127, but on button change no value is registered at all if doing this. I’ve also tried setting isBoolean to false (so it is just a discrete parameter of values 0 or 127), but again button interaction results in no registered change.

I was expecting that, like with the SliderAttachment object, the min/max/interval values set within the Parameter would also set the values on the attached button - is this something that can’t be done with buttons?

If wanting a boolean/discrete parameter controlled by a button am I constrained to the 0-1 range?

Thanks.