Cabbage Logo
Back to Cabbage Site

Workaround for rslider value steps

Hi all,

Is there a way to update the rslider’s step value? like sometimes i want the slider to be in values of 1 (like an clicking knob) , and at other times at .01 (very smooth gradation) I know in the docs it mentions this cannot be changed via cabbageSetValue. Any thoughts?

Best, Tristan :frog:

It cannot be changed because it would break things in the host if it is ever updated, notably automation. One option would be to place several non-automatable knobs on top of a master slider. Each of these knobs would have a different step value. Their visibility could be controlled by a ‘step size’ widget and each time someone turns a slider it updates the master slider, which is never seen, but is picked up by the host, unlike the non-automatable sliders. Does his make sense, if not I can try to prepare a simple example of what I mean.

1 Like

id love a simple example, I was also having trouble with something like this

ktrig cabbageGetValue "button"
cabbageSet ktrig, "knobExample", "visible", ktrig

where in the instrument it wasn’t ever being drawn again even if it was flipped, I was also trying the same with active to just draw another knob on top, thanks Rory for the response per usual

form caption("test") size(370, 280) guiMode("queue"), pluginId("hsd1")

rslider bounds(132, 14, 160, 152) channel("master") range(0, 1, 0, 1, 0.001), visible(0)
rslider bounds(132, 14, 160, 152) channel("rslider1") range(0, 1, 0, 1, 0.01), visible(1), automatable(0)
rslider bounds(132, 14, 160, 152) channel("rslider2") range(0, 1, 0, 1, 0.5), visible(0), automatable(0)
rslider bounds(132, 14, 160, 152) channel("rslider3") range(0, 1, 0, 1, 1), visible(0), automatable(0)

combobox bounds(18, 20, 80, 20) channel("stepSize"), items("0.01", "0.5", "1"), value(1)
button bounds(18, 44, 80, 40) channel("masterValue"), text("Print master value")
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1
    SSliders[] init 3
    SSliders[0] = "rslider1"
    SSliders[1] = "rslider2"
    SSliders[2] = "rslider3"
    kCnt = 0
    kStepIndex, kTrig cabbageGetValue "stepSize"

    ;update visibility of selected slider
    if kTrig == 1 then
        while kCnt < lenarray(SSliders) do
            if kCnt == kStepIndex-1 then
                cabbageSetValue SSliders[kCnt], cabbageGetValue:k("master"), kTrig 
                cabbageSet kTrig, SSliders[kCnt], "visible", 1
                cabbageSet kTrig, SSliders[kCnt], "visible", 0
            kCnt += 1
    ;update master slider with value of most recently changed slider
    SChannel, kSliderTrig cabbageChanged SSliders
    cabbageSetValue "master", cabbageGetValue:k(SChannel), kSliderTrig 
    ;button to print current master value, which is read by the host..
    kBut, kMasterPrintTrig cabbageGetValue "masterValue"
    printf "Master Value: %f\n", kMasterPrintTrig , cabbageGetValue:k("master")

i1 0 z

Would this work?
1 Like

this would work, but still the issue of hiding the original knob in my instance as the below is not allowing me to toggle visibility

ktrig cabbageGetValue "button"
cabbageSet ktrig, "knobExample", "visible", ktrig

try something like the following:

kval, ktrig cabbageGetValue "button"
cabbageSet ktrig, "knobExample", "visible", kval
1 Like

i think this works perfectly actually! tysm