Re: [LAD] Presenting volume control sliders

From: Paul Davis <paul@email-addr-hidden>
Date: Thu May 21 2009 - 22:55:53 EEST

On Thu, May 21, 2009 at 3:27 PM, Lennart Poettering <mzynq@email-addr-hidden> 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);
}
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri May 22 00:15:02 2009

This archive was generated by hypermail 2.1.8 : Fri May 22 2009 - 00:15:02 EEST