Page 1 of 1

Logarithmic Sliders/Knobs

Posted: Wed Feb 06, 2019 9:06 am
by AndyMac
Is there an easy way to get knobs/sliders to work logarithmically - specifically for timing where low values (in ms) should be easy to control from the UI as accurately as possible whilst larger values can be less granular.

It would be ideal if there were an attribute for knobs/sliders for them to be working in logarithmic or linear mode.

Re: Logarithmic Sliders/Knobs

Posted: Thu Feb 07, 2019 6:30 pm
by Cherry Garcia
AndyMac,

The developer of Module Designer has read your post and is going to be adding this, I am told. (=

Re: Logarithmic Sliders/Knobs

Posted: Thu Feb 07, 2019 6:43 pm
by AndyMac
Excellent - thanks

Re: Logarithmic Sliders/Knobs

Posted: Mon Feb 18, 2019 8:37 pm
by DoctorG
That's great. I want the same functionality...

Thanks...
gary

Re: Logarithmic Sliders/Knobs

Posted: Wed Feb 20, 2019 5:17 pm
by DoctorG
Hi there,
I was thinking about this in more detail, and about some of the problems I had implementing controls in my hybrid analogue/digital system a few years ago.

Log response (i.e. a lin to log converter) is useful. However, so is an anti-log response, and so is some arbitrary set responses (which I spent some time implementing a few weeks ago with if()'s and interpolation).

So it would be useful to have a set of common responses (lin, log, anti-log) but maybe also a callback for implementing arbitrary responses.

Thanks...
gary

Re: Logarithmic Sliders/Knobs

Posted: Tue Feb 26, 2019 5:37 am
by CherryRuss
The next build, which should be out this week barring last minute emergencies, will have settings for non-linear knobs and sliders. You'll be able to set either a custom skew factor or a custom midpoint. With a custom skew factor, values < 1 will increasingly skew the knob/slider towards the low end of the knob's range and values > 1 will increasingly skew it towards the high end of the range. With a custom midpoint, you can select a midpoint for the knob and it will effectively have a custom skew factor that results in that midpoint (i.e., if a knob has a range from 0 to 20 and a custom midpoint of 1, the left half of the knob will range from 0 to 1, and the right half from 1 to 20, which is roughly the same as using a custom skew factor of 0.23). Try experimenting with a knob's or slider's "Range Type" & associated settings once the new build comes out and it'll probably be a lot clearer than it seems after reading this paragraph.

We hadn't considered adding a callback for custom scaling algorithms; we'll give that some thought. It's possible to implement custom knob /slider scaling yourself, as it sounds like you've already done, but in case anyone else wants to do this, here's what you'd need to do:

* make sure that you add processing to any calls to your knob or slider's GetValue() and SetValue() functions to account for your custom algorithm, and do the same for notifications that the knob/slider value has changed (i.e., Knob_Changed and Slider_Changed notifications in Notify())

* add code in GetTooltipText to translate the knob's internal value to the value of your custom algorithm

* add code in EditComponentValue (which gets called after a user has edited the knob/slider value's tooltip) to translate whatever the user has typed in from your algorithm to the knob's internal scale and call SetValue()

Re: Logarithmic Sliders/Knobs

Posted: Tue Feb 26, 2019 7:22 am
by AndyMac
Great, and sounds a really flexible implementation. Now I need to work out whether I can migrate my custom code to this (as the custom skew point sounds ideal for my uses) in a way that can maintain existing stored settings/presets for existing users.

So, to make it possible to do automatic migration of settings, is there a way to recognise the build version that was used for storing presets, or will I need to implement this through adding code into GetStateInformation and SetStateInformation to include this information?