Cabbage Logo
Back to Cabbage Site

Combobox init empty string

Hi,
It seems that a combobox with type string will not initialize the string channel contents.

This one:
combobox channel(“partitionlength”), bounds(20, 50, 70, 20), items(“256”, “512”, “1024”, “2048”, “4096”), channeltype(“string”), value(4)
… even if it displays the 4th item, it does not init the string channel with that item.

Full csd:

<Cabbage>
form size(300, 200), caption("LiveConvolver3"), pluginID("lic3")
label text("p_length"), bounds(20, 20, 70, 13)
combobox channel("partitionlength"), bounds(20, 50, 70, 20), items("256", "512", "1024", "2048", "4096"), channeltype("string"), value(4)

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

gkpartitionlen init 2048

        instr 1
        Spartitionlen chnget "partitionlength"
        k1 changed Spartitionlen
        if (strlenk(Spartitionlen)>0) && (k1>0) then
        gkpartitionlen strtodk Spartitionlen 
        endif
        printk2 gkpartitionlen
        endin

        instr 2
        chnset  "1234567", "partitionlength"
        endin
        
</CsInstruments>
<CsScore>
;i2 0 .1 ; we can enable this to initialize the string, would hope not to need to do that
i1 0.1 10
f0 60
e

</CsScore>
</CsoundSynthesizer>

This is a strange one Oeyvind as, for me, this mostly works okay, printing “2048” to the terminal as desired. When it doesn’t work, and I get a “strtodk: empty string” error, is when using “save (update instrument)” from the Cabbage built-in editor. It seems that “options->reload instrument” from the main Cabbage window and “save (update instrument)” from the editor are instigating slightly different procedures to reload a csd.

Another thing I noticed Rory, when I try to select text from the csound output in the editor the selected text instantly disappears! Mac and Win versions.

Actually, here it happens if I load the instrument from scratch also (run Cabbage …Open Cabbage Instrument)

Perhaps it is uniquely troublesome on the 64bit Windows build. (Although still slightly troublesome on Mac and Win32 build).

Thanks for the report. I’ll take a look at this once I get a chance.

I found what was causing this issue, the init string one that is. I know why the output text is disappearing, but I’ve not yet found the best solution to the problem. ~It’s fixed in GIT. I’ll mark this thread resolved as soon as I sort the output message issue raised by Iain.

I have a fix now for the output message issue too, although it’s not perfect if you wish to use the csoundoutput widget while in standalone mode. The problem is that the standalone host queries Csound for messages, and when it gets them it flushes the message queue. The csoundoutput widget also does the same, so whoever gets there first will flush the messages for the other. I don’t think it’s much of an issue as the csoundoutput widget is really just for debugging plugins. I’ll push through the fix now anyhow as it’s still an improvement over the current state of play.

Oh, good. Thanks for this.
Just so I understand it correctly: In standalone mode it will be a problem to use the csoundoutput widget, but the “View Csound output” console window in the standalone would work well (as long as the widget is not used)?
To avoid confusion, would it then be a good idea to automatically disable the csoundoutput widget when running in standalone? It could just print a message "output widget disabled in standalone mode, see the “View Csound output” windows for messages.

Good idea. I’ll double check the csound output window. I was concentrating on the other two for now.