New cabbageChanged opcode

It’s working for me 100% of the time. I tested with the trigger opcode in Csound and they both seem to behave the same?

Sorry, my fault :grimacing: That’s fixed now

The problem is that when clicking on a radio group, two buttons change state at the same time, or thereabouts. This means that we intermittently miss one. Looks like there is little we can do in this case because it’s not a single channel changing but two.

One possible way around this would be to build your own radiogroup using a slider and some images. Each time you update a button(image) in the group it would send an update to the slider. That way you only have to keep track of the slider position? Here is n example:

<Cabbage>
form caption("Cabbage Changed") size(430, 390) pluginId("tl01") guiMode("queue")
image bounds(10, 296, 90, 30) channel("radioImage1"), value(1), colour("black"), _isGrouped(1)
image bounds(110, 296, 90, 30) channel("radioImage2"), value(1), _isGrouped(1)
image bounds(210, 296, 90, 30) channel("radioImage3"), value(1), _isGrouped(1)
image bounds(310, 296, 90, 30) channel("radioImage4"), value(1), _isGrouped(1)
hslider bounds(-1000, 310, 90, 20), alpha(0), popupText(0), channel("radioGroup1"), range(0, 3, 0, 1, 1)

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -m0d -+rtmidi=NULL 
</CsOptions>
<CsInstruments>
ksmps   = 32  

opcode Radio, 0,SS[]i
    SSliderChannel, SChannels[], iIndex xin
    kIndex, kTrig cabbageChanged SChannels
    kCnt = 0
    printf "Changed:%d", kTrig, kIndex 
    if kTrig == 1 then
        while kCnt < 4 do
            cabbageSet kTrig, SChannels[kCnt], (kCnt == kIndex ? "colour(255, 0, 0)" : "colour(255, 255, 255)") 
            kCnt+=1
        od
        cabbageSetValue SSliderChannel, kIndex
    endif
endop

instr 1
    SWidgetChannels[] cabbageGetWidgetChannels "_isGrouped(1)"
    Radio "RadioGroup1", SWidgetChannels, 1
    kIndex, kTrig cabbageGetValue "RadioGroup1"
    printf "RadioGroupIndex:%d", kTrig, kIndex
endin

</CsInstruments>
<CsScore>
i1 0 z
</CsScore>
</CsoundSynthesizer>

You might want to make each one of those image interactive(0) so they don’t confuse users in a DAW. In fact, I wonder can you just use a slider with your current setup too? Let me take a look..