How to implement related AudioProcessorParameters


i’m using the AudioProcessorParameter for implementing a new plugin. There are two parameters that can be linked. Both parameter should always have the same value when the LINK option is activated (related META parameters). I don’t see any place where i can handle something like this, because there is no setParameters() method anymore.
The only way i can think of is to create a new class with a timer that checks if the two parameters are linked and then sets the values the right way. Another way would be to overwrite the parameter class and call a callback function for every parameter change. The callback would then update the other parameter when there are changes and they are linked. I don’t like both solutions and hope there is a better one…

What’s the best way to implement that?

Anyway, no answers can help too. It made me rethinking the whole thing and i came to a solution where i don’t have to link parameters. I was able to solve this on the UI side. Just showing other sliders when link is enabled, controlled by setVisibility(). A timer on the UI controls if the link option has changed and shows the right ones.

Do you mean the myAudioProcessor::setParameter() function? I havn’t used Juce in almost 2 years and want to start getting back into writing VSTs. How do you set and get parameters now?


Yes, i mean myAudioProcessor::setParameter(). It’s deprecated now. I hope that the JUCE team does not delete the method for backward compatibility, but you should build your new plugins without this method.
You can see that in the juce adio demo. Create AudioParameter classes. One for each parameter.It’s simple, but you maybe have to rethink some of the concepts you have used with the old method.

Thanks Patrick.

Or as an alternative use an AudioProcessorValueTreeState and create the parameters using this method:
AudioProcessorValueTreeState::createAndAddParameter (…)

The AudioProcessorValueTreeState (they are paid by letters… ;-)) has already different AudioProcessorParameter classes implemented.
Second benefit is you can use a listener to get notification when a parameter is changed.
And third one, you can easily serialize the complete plugin state by simply dumping the tree in AudioProcessor::setStateInformation(). It even gives undo/redo, but that needs a little work to be integrated properly (I always saved that task for later…).

Interesting thanks, Daniel!