Logaritmic fader

I’m looking to recreate the Protools volume fader behaviour in my plugin faders.
The Protools fader is a logarithmically mapped fader, whereas the Juce slider is linearly mapped. Is there a (quick and easy) way to get a logarithmic mapping for the Juce slider? I already looked into changing the skew factor but this won’t work since it kills the resolution on one end of the slider and it isn’t coupled to the host automation.

I guess i’m not the first one trying to make such a slider so if anyone can point me the right direction that would be great.

Btw, i’m not talking just about a dB conversion. E.g. The slider needs to go from -144 to +12dB and the 0dB point needs to be at 0.75. A simple dB conversion of the slider values would put the 0dB point at 0.25, which is not what i’m looking for.

Thx

You can perform any mapping you like by overriding Slider::proportionOfLengthToValue and valueToProportionOfLength.

Sorry to ressurect this post but could somebody possibly demonstrate how one would ovverride these methods (possibly by using the demo plugin). I keep running into linking errors.

Should I create my own class that inherits slider and override the porportion methods there, or can I simply override the methods without creating a new class?

Excuse my C++ noviceness, I'm running up against a deadline quick & it'd be great to get logarithmic faders in action. Any help is much appreciated!! :)

Muir

Have you looked at Slider::setSkewFactor()?
http://www.juce.com/juce/api/classSlider.html#a3253bce613f1770688380e4fcc91b964

Ah this is superb. JUCE never fails to pleasantly surprise me. Just what I was looking for. Many thanks Rory!

Cheers

 

Muir

It is worth noting that having the slider display logarithmic behavior will not cause the underlying automation parameter to have logarithmic behavior. So automation will cause big jumps in the slider, and the nice mapping of your slider will be lost. I'm speaking from experience here, and the complaints of many customers.


Sean Costello

1 Like

Ah, I see what you're saying. So in your plugins do you override the two proption/value methods? Many thanks for the heads up.