i-time state of k-rate channels received from valuator widgets seems to change between the first and second time the instrument containing the cabbageGetValue
is called - either MIDI notes or score events - and always zero the first time. So in the following:
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
rslider bounds(5,5,150,150), channel("test"), range(0,1,0.5)
keyboard bounds(5,160,390,85)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -dm0 -+rtmidi=NULL -M0
</CsOptions>
<CsInstruments>
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
ktest cabbageGetValue "test"
print i(ktest)
endin
</CsInstruments>
<CsScore>
i 1 1 1
i 1 2 1
</CsScore>
</CsoundSynthesizer>
the print
from the two notes will be:
instr 1: #i0 = 0.000
instr 1: #i0 = 0.500
It seems to be the same behaviour with both queue and polling methods.
The workaround/solution seems to be to read the widgets in an always-on instrument, output as global variables, and cast to i-rate in the other instrument:
instr 1
gktest cabbageGetValue "test"
endin
instr 2
print i(gktest)
endin
</CsInstruments>
<CsScore>
i 1 0 z
i 2 1 1
i 2 2 1
</CsScore>
but this feels like a bit of a kludge.