Hello everybody,
setting up a logarithmic slider for frequencies I encounter the following problem:
with the skewfactor 0.2 I shoud retrieve equal distances between doubling values, but the first doubling step (20 - 40) is far to big…
as I altered the lookAndFeel for the left slider and was not sure, if I created this problem there, I put a standard slider as a reference to the right with the same skew settings
… which would mean I had to write and use my own NormalisableRangeClass? could try to do that, but I still do not understand, why my slider represents its values so different from the example in the link ( https://jucestepbystep.wordpress.com/logarithmic-sliders/ )
No, you have to create an instance of NormalisableRangewith your own remap functions, then assign that to the slider with setNormalisableRange.
If you look at the code in NormalisableRange::convertTo0to1, in absence of custom remap functions the normalised value is computed as pow((v - min) / (max - min)), skew). A log mapping would be (log(v) - log(min)) / (log(max) - log(min)). There is no value of skew that will give you a log mapping. The value suggested in the tutorial will match the ends and the midpoint, but nothing else:
oh thanks, kamedin, just found that out, and also the convertFrom0To1, which shoud be exp(v * (log(max) - log(min)) + log(min)) , if I’m not wrong. Now I only miss the correct syntax in creating the instance of the range…
maybe you could give me an example of that, how to correctly write the ValueRemapFunction?