How would you link a button controlled via ButtonParameterAttachment to untoggle a different button?

Im using a ButtonParameterAttachment to link an audio processor to the GUI but Im in a situation where there are two different parameters present in my tree and I want a button in the UI to toggle the state of the parameter its attached to but also, if another button is active to untangle that button. This could be models with a Radio button where there is a radio button group id involved, but I really wanted separate parameters rather than having mutually exclusive button writing to a single parameter like a tristate bool.

Kind of like mute and solo buttons where you want the mute button to untoggle the solo button and vice verse, but the mute and solo parameters are separate parameters. Any ideas?

You can set the buttons button::onClick lambda. In it, get your parameter from the tree and call setValueNotifyingHost on it. And be careful - like getValue and setValue it takes in the normalised value, although it isn’t mentioned in the docs.

I personally wouldn’t check for the other buttons state but for the other parameters value, since it reduces coupling a bit.

1 Like

I was pondering something similar recently, and I saw that VSTs are not supposed to have parameters that control other parameters. AU apparently has ‘metaparameters’ for this purpose. I saw parameters influencing other parameters in a plugin a while ago and it caused some problems and automation was written unintentionally. Since the parameters can be changed when the GUI is closed, you have to consider what happens when the DAW sets your parameters to a state your GUI is supposed to prevent. It might be more reliable to have this interdependent state represented in the plugin state but not via an automatable parameter.

1 Like

Im wondering how to do that if its something like mute/solo/none, with radio buttons for just solo/mute its easy using a custom RadioButtonAttachment but when they can both be be off it makes things trickier as there is no actual button for the off state. Maybe I need just a RadioButtonAttachment with logic for both buttons being in an off state. I take you point about non representable state being absent in the parameter binding, this might be the way I’ll have to approach this.

I think the solution is to roll the two parameters like mute/solo inot one parameter, then make either a RadioButtonAttachment that allows a button to be deselected on a re-click, or have a MultipleButtonParameterAttachment for having multiple UI elements interacting with a single Parameter.

Im not sure which is the easiest or nicest solution?

Back to the simple mute/solo button case: do you have a audio parameter for both? If so, I wouldn’t address this issue in the UI at all. Attach a parameterlistener in the logic/engine part of your application and do this logic in there like untoggleing a bool parameter when another bool parameter gets set to true.

This way, your application will be more responsive to changes and you’ll avoid a lot of edge cases e.g. parameter automation and loading/saving state.