Cabbage Logo
Back to Cabbage Site

String combobox - potential breaking change

I just pushed some changes to enable better interaction between comboboxes with channelType("string") and the host. Up till now these comboboxes could not be easily automated, and if you managed to get something going you still had to deal with indices back from the host. Anyhow, this has been changed so that you can now:

  • see the combobox items in the DAW when you use a native plugin editor. You will no longer see numbers 1, 2, 3, etc., but strings, for example “Sine”, “Saw”, “Square”, etc.
  • add host automation.
  • test for the item string in Cabbage whenever the host changes the item, rather than the index.

I’ve tested this with some old string combobox instruments I had lying around and they all worked as I would expect. But I’m curious to see if others have the same success with their older instruments. That’s why I’m marking this as a potential breaking change for now. Please let me know if you have any problems with older instruments and I’ll try to find a fix.

Thanks, this is great. Currently testing this out, and I’m getting a syntax error when comparing strings. Also, what is the difference between defining the values of the combobox using items() and text()?

<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
combobox bounds(12, 22, 75, 19) channel("ComboboxTest"), colour(64, 73, 88), items("Yes", "No", "Maybe"), channelType("string")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1
    SCombobox, kTrig cabbageGetValue "ComboboxTest"
    printf SCombobox, kTrig
    
    if (SCombobox == "Yes") then
        printk 1, kTrig
    endif
endin

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

That’s because you can’t use == with strings. You’ll need to use strcmp :+1:

Thanks, the if-statement runs at runtime now, but does not run initially.

<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
combobox bounds(12, 22, 75, 19) channel("ComboboxTest"), colour(64, 73, 88), items("Yes", "No", "Maybe"), channelType("string")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1
    SCombobox, kTrig cabbageGetValue "ComboboxTest"
    printf SCombobox, kTrig

    if (strcmpk(SCombobox, "Yes") == 0) then
        printk 1, kTrig
    endif
endin

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

Right you are. Can you try the latest build when it’s done? I pushed a fix.

Newest one works fine with the previous example in Cabbage :+1:

But there’s a bug in FL Studio, second element of the combobox is missing.

I’ll run it through FL when I get a chance.

[edit] can you explain to me how to display a native UI in FL Studio. I’m pulling my hair out trying to find it?

Yeah, under the Current project folder

Thank @hdale94, I got it :+1:

[edit] I thought I’d get this done this morning but it seems to be a little more involved than I had expected. leave it with me, I’ll try to get a fix today at some point.

Can you try now when you get a chance?

Just tested. You fixed the issue I described, but I discovered something else. Changing the combobox doesn’t actually update channel… it seems

The behavior in 3x Osc is how it should be.

I’ll take a look.

Ok, can you try again. I’ve a feeling this last change might be the one that potentially breaks other people’s instruments… :see_no_evil:

Brokensomething

Tested ok. Works as I would expect in both FL and Reaper. Also works with older plugins, but that could need more testing.

Thanks for checking it out. The only issue is that previous string based combo-boxes had no interaction with the host. So now older instruments with string based combos will suddenly start sending info to and from the host. While this is not an issue in itself, it does mean an extra parameter for the host, and this might break previously saved sessions. Still, it shouldn’t be an issue if people continue using their previously exported plugins. If one needs to update and export with the latest version, they could brick their previous sessions.