We are porting old (VSTGUI) software to JUCE, and I have an issue with a slider that is supposed to use an exponential function to map between real-world values and the 0…1 range.
At first, we added a NormalisableRange for the parameter attached to the slider, and called setSkewForCenter() on it. That almost worked, but the curve that creates does not quite match the old exponential functions that the versions in the field use. We really would like those to match exactly, since users have saved session and preset data based on tweaking those knobs until they are just right.
So, instead of using setSkewForCenter(), I added lambdas that allowed me to call my own mapping functions. Those functions are getting called at some point, but when painting, the slider (rotary) doesn’t use those lambdas. Instead, it uses the valueToProportionOfLength() function to give us a value that tells us how far to turn the knob (by picking a specific image out of an array of knob images). So now the knob draws as if it were linearly mapped, instead of exponential.
What is the proper way to use my own exponential mapping for a slider’s range to the 0…1 range?
Could the issue somehow be that we’re using a derived class from Slider (to reverse its range via those valueToProportionOfLength() and proportionOfLengthToValue() functions)? Those call the base Slider class functions, subtracting from 1.0 as needed, but the Slider doesn’t see the lambda functions that the parameter it’s attached to defines in its NormalisableRange. I’m not sure how to get the two to talk to each other for this purpose.