The earlier bugs should all be fixed now, I can’t recall if I explained the final one to you by PM, but in case I didn’t, the radiogroup mechanism is something I’m taking from the underlying GUI library I use to create Cabbage, i.e., JUCE. It works on button press events. If notevent arrives it won’t update the state of the button. But there’s an easy work around (see note below):
<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginID("def1")
checkbox bounds(6, 10, 8, 8) channel("checkchan0") colour:1(255, 255, 255, 255) corners(2) shape("circle") ;radiogroup(100)
checkbox bounds(16,10, 8, 8) channel("checkchan1") colour:1(255, 255, 255, 255) corners(2) shape("circle") ;radiogroup(100)
checkbox bounds(26, 10, 8, 8) channel("checkchan2") colour:1(255, 255, 255, 255) corners(2) shape("circle") ;radiogroup(100)
checkbox bounds(36, 10, 8, 8) channel("checkchan3") colour:1(255, 255, 255, 255) corners(2) shape("circle") ;radiogroup(100)
button bounds(67, 53, 80, 40) channel("button") text("Start", "Stop")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
;instrument will be triggered by keyboard widget
instr 1
kBut chnget "button"
kIndex init 0
if kBut==1 then
k1 metro 1
if k1 ==1 then
event "i", "ToggleButtons", 0, 0, kIndex % 4
kIndex += 1
endif
endif
endin
instr ToggleButtons
iCnt init 0
while iCnt < 4 do
SBut sprintf "checkchan%d", iCnt
chnset (p4 == iCnt ? 1 : 0), SBut
iCnt += 1
od
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i1 0 3600
</CsScore>
</CsoundSynthesizer>
- for now we must use a separate instrument to set the channels because Csound chnset only works with i-time strings. The Csound developers are going to address this soon, so in the future we should be able to do everything from a single instrument.
Once again, note that I don’t need to use the identchannel() identifier when updating the value of the button. I can use its normal channel.