On Thu, May 21, 2009 at 3:27 PM, Lennart Poettering <mzynq(a)0pointer.de> wrote:
[ .... non linear faders ... ]
in addition to chris' suggestion, there is ardour's rather arbitrary
but definitely comfortable mapping. these map between a gain
coefficient (not a dB level) and a fader position that varies from 0.0
to 1.0 (gain_t is a double, btw)
--p
-------------------------------------------------------------------
static inline double
gain_to_slider_position (ARDOUR::gain_t g)
{
if (g == 0) return 0;
return pow((6.0*log(g)/log(2.0)+192.0)/198.0, 8.0);
}
static inline ARDOUR::gain_t
slider_position_to_gain (double pos)
{
/* XXX Marcus writes: this doesn't seem right to me. but i don't have
a better answer ... */
if (pos == 0.0) return 0;
return pow (2.0,(sqrt(sqrt(sqrt(pos)))*198.0-192.0)/6.0);
}