See
Here is one with an additional mid point setting:
template<typename FloatType>
inline juce::NormalisableRange<FloatType> getLogMidRange(
const FloatType xMin, const FloatType xMax, const FloatType xMid, const FloatType xInterval) {
const FloatType rng1{std::log(xMid / xMin) * FloatType(2)};
const FloatType rng2{std::log(xMax / xMid) * FloatType(2)};
return {
xMin, xMax,
[=](FloatType, FloatType, const FloatType v) {
return v < FloatType(.5) ? std::exp(v * rng1) * xMin : std::exp((v - FloatType(.5)) * rng2) * xMid;
},
[=](FloatType, FloatType, const FloatType v) {
return v < xMid ? std::log(v / xMin) / rng1 : FloatType(.5) + std::log(v / xMid) / rng2;
},
[=](FloatType, FloatType, const FloatType v) {
const FloatType x = xMin + xInterval * std::round((v - xMin) / xInterval);
return x <= xMin ? xMin : (x >= xMax ? xMax : x);
}
};
}