In a plugin I am writing, I have two parameters that can take any value in the range [0.0f,1.0f]. But I want P1 to also be limited to the range [P0,1.0f]. In other words, P1 cannot be less than P0. What is the best way to do that? I don’t see a snapValue function pointer in the AudioProcessorValueTreeState::createAndAddParameter() function, and even if there was one, I also don’t see how I could access another parameter from a function that is defined (currently, at least) as a lambda function when defining each individual parameter.
There is also the issue that I’d not only need to restrict P1 to >= P0 when P1 is changed, but also restrict P0 to <= P1 when P0 is changed. I do not want to automatically change the other parameter, but merely restrict the current parameter according to the other’s current value.
(Which also brings up the sticky issue of what if the user simply draws some automation that violates these restrictions. The order in which they change via automation may even differ between hosts, so who would win? Another issue for another day, sorry.)
So… what is the preferred method for dynamically restricting the range of a parameter based on another parameter’s current value?
