I’m trying to create a NormalisableRange which converts decibels to gain, used in a master volume slider. However, my current code produces junk values…
auto decibelToGainLambda = [](auto min, auto end, auto dB) {
return dB > min ? std::pow(10.0f, dB * 0.05f) / Decibels::decibelsToGain(end) : 0.0;
};
auto gainToDecibelLambda = [](auto min, auto end, auto gain) {
return gain > 0.0f ? 20.0f * std::log10(gain * Decibels::decibelsToGain(end) ) : -std::numeric_limits<float>::infinity();
};