Could you please rename the ‘value’ arguments (to something like ‘float normalisedValue’, or float fullRangeValue) of the parameters functions to make it clear when the values are normalised or not?
And also always specify in the documentation?
it’s been a decade i’m using juce, and I still can’t get it right.
That won’t solve the issue because you are only creating alias names for the type, which remains float.
You could assign one ParamValNormalised value to a ParamValDeNormalised variable, for example, and the compiler would not complain.
One slightly better approach to have compilation errors whenever the types are mixed up, is to have something like:
Those types still have the size of a float, but are different types in the eyes of the compiler, thus you get a compilation error if you try to assign one denormalised struct to a normalised one. Sure, you have to avoid code that does silly things with the variable members like
n.normalised = d.denormalised
but that’s up to you and the names of the variable members are of help, for sure.
I doubt one such solution would be taken in consideration by the JUCE team “as is”, because it’s basically a poor man’s version of what a strong type is.