Reset sliders and knobs
-
Good morning everyone,
I'm hoping that somebody can help me and tell me the best to reset any sliders & knobs that have been tweaked when I change sample map?
I am not using the preset system but rather buttons to switch between sample maps which are acting as the presets. This is working fine but any tweaks made on the piano are there carried across to the bass for example and I'd like the various knobs & effects to go back to default upon each new sample map change.
Presumably I need to write a script & call it in the button change part of my main script?
If so, how do I reset to the default value? Is there an easy way to set to the default value or will I need to hardcode values for each of the sliders I want to reset?Is there a better way to do this or is the method above the best/only way?
Thanks in advance
-
You can use the
.setValue()
function to set the value of a control. And you can use.changed()
to trigger its callback after you've set its value. There is also the.get()
function which can be used to retrieve a control's property, such as its defaultValue.Put this all together and you get something like:
local defaultValue = myControl.get("defaultValue"); myControl.setValue(defaultValue); myControl.changed();
You will probably want to put this inside an inline function. And you'll want to use a loop to go over all of your controls in one go so you don't need to write it out one by one.
-
@d-healey said in Reset sliders and knobs:
You can use the
.setValue()
function to set the value of a control. And you can use.changed()
to trigger its callback after you've set its value. There is also the.get()
function which can be used to retrieve a control's property, such as its defaultValue.Put this all together and you get something like:
local defaultValue = myControl.get("defaultValue"); myControl.setValue(defaultValue); myControl.changed();
You will probably want to put this inside an inline function. And you'll want to use a loop to go over all of your controls in one go so you don't need to write it out one by one.
That's fantastic David and was exactly what I was looking for - thankyou.
I will look at implementing this into my project this weekendThanks again