Cabbage Logo
Back to Cabbage Site

New defaultValue() identifier for sliders

defaultValue(val) Sets the default value for a sliders. This is the value the slider will jump to on a double click. Below is a completely ridiculous example that will change the default value each time a user clicks a slider. A very good way to frustrate users I imagine! :rofl:

<Cabbage>
form caption("Untitled") size(430, 300), guiMode("queue") pluginId("def1")
vslider bounds(10, 12, 52, 268) channel("vslider1") range(0, 1, 0, 1, 0.001)
vslider bounds(60, 12, 52, 268) channel("vslider2") range(0, 1, 0, 1, 0.001)
vslider bounds(110, 12, 52, 268) channel("vslider3") range(0, 1, 0, 1, 0.001)
vslider bounds(160, 12, 52, 268) channel("vslider4") range(0, 1, 0, 1, 0.001)
vslider bounds(210, 12, 52, 268) channel("vslider5") range(0, 1, 0, 1, 0.001)
vslider bounds(260, 12, 52, 268) channel("vslider6") range(0, 1, 0, 1, 0.001)
vslider bounds(310, 12, 52, 268) channel("vslider7") range(0, 1, 0, 1, 0.001)
vslider bounds(360, 12, 52, 268) channel("vslider8") range(0, 1, 0, 1, 0.001)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1

    SSliders[] cabbageGetWidgetChannels "type(\"vslider\")"
    SChannel, kTrig cabbageChanged SSliders
    cabbageSet kTrig, SChannel, sprintfk("defaultValue(%f)", random:k(0, 1))

endin

</CsInstruments>
<CsScore>
i1 0 [60*60*24*7] 
</CsScore>
</CsoundSynthesizer>
1 Like