Cabbage Logo
Back to Cabbage Site

Change the range of an "rslider" dynamically

Hello!
I would like to ask if it is possible to change the range of an “rslider” dynamically. I have managed to change its position with this code:

kTrig6 changed kLfodestination1
if (kLfodestination1 == 9) then
cabbageSet kTrig6, “klfoamount1”, “bounds”, 20, 40, 70, 30
else
cabbageSet kTrig6, “klfoamount1”, “bounds”, 600, 232, 70, 70
endif

but not the range, tried something similar:

kTrig6 changed kLfodestination1
if (kLfodestination1 == 9) then
cabbageSet kTrig6, “klfoamount1”, “range”, -12, 12, 0, 1, 0.001
else
cabbageSet kTrig6, “klfoamount1”, “range”, 0, 1, 0, 1, 0.001
endif

I am not sure if I am doing something wrong or maybe is that not possible?
I am not launching a second instrument to run “CabbageSet” since in I included
“i1 0 z” in addition to “f0 z”.
Thanks!

I think that the range values for widgets must be static. A solution could be to use visible() to hide and show two widgets with different ranges.

Something like this:

cabbageSet gkTrig_OffsetSyncButton, "Offset", gkOffsetSyncButton == 1 ? "visible(0)" : "visible(1)"
cabbageSet gkTrig_OffsetSyncButton, "OffsetSync", gkOffsetSyncButton == 1 ? "visible(1)" : "visible(0)"

There was already a discussion about this.
In summary, it is not recommended to change the range of a widget, since host automations can break.
What you can do however is using a normalized range and multiply it later.

Yes, it’s actually not supported by plugin formats for the very reason outlined by @giovannibedetti. A multiplier is a good solution.

Thanks for the answers. I think that the best solution for what I need in this particular case is the visibility option that @hdale94 mentions. I have already used on other occasions and it is easy to implement.

Cool, if that works. My only concern would be when users use the native sliders in a DAW, they will see ALL parameters, even if they are hidden in the plugin UI.

I think as long as the naming of channels is clear and concise this shouldn’t be a problem. I have also thought about this, but never gotten any feedback from any users about it so I think it’s an alright solution :+1:

1 Like

Ok @rorywalsh thanks for the clarification. As @hdale94 mentions I don’t think it’s a big problem as long as things stay consistent and are logically structured.