April 6, 2017, 1:16pm
In analogy with what is found in other parts of JUCE (
Rectangle), it would be nice if
Range had a method that, given a proportional position along the length of the range, returns the corresponding value:
0 -> start value
1 -> end value
0.5 -> middle value
and so on…
April 6, 2017, 1:21pm
But that is the job of
NormalisableRange, isn’t it?
You can get a Range from a NormalisableRange using NormalisableRange< ValueType >::getRange () const, or did I miss something?
I don’t know exactly the difference, maybe they could be merged at some point?
April 6, 2017, 1:50pm
Yes, I thought about that but switching to a NormalizableRange seemed overkill in my case…
Bump. It’s really just one member function being added:
ValueType getProportionalValue(FloatType proportion)
proportion = jlimit(0.f, 1.f, proportion);
return start + static_cast<ValueType>( ( FloatType(end) - FloatType(start) ) * proportion );