Logarithmic Sliders/Knobs

Post Reply
User avatar
AndyMac
Posts: 152
Joined: Wed Sep 05, 2018 6:16 pm
Location: Wirral UK
Contact:

Logarithmic Sliders/Knobs

Post 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.
Cherry Garcia
Site Admin
Posts: 293
Joined: Fri Aug 31, 2018 2:57 am

Re: Logarithmic Sliders/Knobs

Post by Cherry Garcia »

AndyMac,

The developer of Module Designer has read your post and is going to be adding this, I am told. (=
User avatar
AndyMac
Posts: 152
Joined: Wed Sep 05, 2018 6:16 pm
Location: Wirral UK
Contact:

Re: Logarithmic Sliders/Knobs

Post by AndyMac »

Excellent - thanks
DoctorG
Posts: 35
Joined: Thu Dec 27, 2018 9:42 pm

Re: Logarithmic Sliders/Knobs

Post by DoctorG »

That's great. I want the same functionality...

Thanks...
gary
DoctorG
Posts: 35
Joined: Thu Dec 27, 2018 9:42 pm

Re: Logarithmic Sliders/Knobs

Post 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
CherryRuss
Posts: 27
Joined: Sat Oct 20, 2018 9:29 pm

Re: Logarithmic Sliders/Knobs

Post 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()
User avatar
AndyMac
Posts: 152
Joined: Wed Sep 05, 2018 6:16 pm
Location: Wirral UK
Contact:

Re: Logarithmic Sliders/Knobs

Post 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?
Post Reply

Return to “Module Designer”