I came across some peculiar behaviour. The example below is taken out of context, anyhow there are two buttons, “Browse” and “Load”, and I am simply copying a string, triggered by pushing “Load”. If I have cabbageGet
in the code and I am copying a longer string with strcpyk
then Cabbage crashes (upon a few clicks on the “Load” button). However, there seems to be no issue if I comment the cabbageGet
part or if I copy shorter names (underscore seem to be accepted well). See comments in the example below.
<Cabbage>
form caption("test load") size(330, 290) pluginId("tl01") colour(0, 0, 0) guiMode("queue")
button bounds(24, 24, 70, 14) channel("Load") text("LOAD", "LOAD") automatable(0) corners(3) latched(0) colour:0(255, 255, 0, 80) colour:1(255, 255, 0, 255) fontColour:0(255, 255, 0, 255) fontColour:1(160, 0, 0, 255)
filebutton bounds(24, 50, 70, 14) channel("Browse") text("BROWSE", "BROWSE") corners(3) colour:0(255, 255, 0, 80) colour:1(255, 255, 0, 255) fontColour:0(255, 255, 0, 255)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -m0d -+rtmidi=NULL
</CsOptions>
<CsInstruments>
ksmps = 32
instr 1
S_LoadFileName cabbageGet "Browse" ; if this line is commented, no issue
;SDefaultName = "FileName.txt" ; OK?
;SDefaultName = "A_FileName.txt" ; OK?
SDefaultName = "SomethingLonger_FileName.txt" ; Not OK!
if trigger(cabbageGetValue:k("Load"), .5, 0) == 1 then
S_LoadFileName strcpyk SDefaultName
endif
endin
</CsInstruments>
<CsScore>
f0 z
i 1 0 -1
</CsScore>
</CsoundSynthesizer>