I have a control that can map to any given parameter, and a label that the user can edit rather than use the control. I’m having a problem trying to restrict the values of the label to what the currently mapped parameter accepts. For labels attached to known parameters, I can just use my personal knowledge of the parameter itself to write code that restricts it, but I need a generic solution.
When I use getFloatValue() on the text the label reports, it gives me 0 if the result is garbage. For parameters that don’t accept 0, I can detect that and reset the label to its previous text. But when 0 is a valid value for the parameter, typing in garbage like “xyzzy” results in the parameter being set to 0.
And of course the parameter might use strings to display its values (such as “Major” or “Minor” for a Scale parameter…
Is there any to detect that the value the user typed into the label is not valid for the given parameter? I don’t see any parameter or label function that allows me to detect that. A virtual function in the AudioProcessorParameterWithID or AudioProcessorParameter class would be nice, since the parameter knows what it will accept, and could override it. There is the textToValueFunction, but that requires the AudioProcessorValueTreeState::Parameter type, which is private to AudioProcessorValueTreeState. Is there some other way to access that?