Cabbage Logo
Back to Cabbage Site

Bug when deleting instrument from code

Hello, I am currently following Rory’s live-style sampler and have discovered a strange bug. I ran into an error as I had an instrument being reinstated, however when trying to save to run the code after I deleted the instrument, cabbage immediately crashes. I have provided a video to show the issue.

here is the code.

<Cabbage> bounds(0, 0, 0, 0)
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
keyboard bounds(0, 200, 400, 100)
</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 99


endin


instr 1

endin


;instrument will be triggered by keyboard widget
instr 1
    SFile, kFileChanged cabbageGet "LAST_FILE_DROPPED"
    printf SFile, kFileChanged
endin

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

Upon deleting the empty instance of instr1 and pressing cmd+s, the crash occurs.
I believe I am running on the latest version of cabbage

Hope this helps!

I’m not getting any crash here. There is obviously an error in your code in that you have two instr 1 definitions, but it doesn’t crash for me. What version are you on? I’m running 2.9.232.

I believe I’m running the same version, the error happens when deleting the empty instance of instr 1 and pressing save.

I don’t know what to say. re you on Windows or Mac? I tested on Mac and I’ve no problems. If it’s holding you up, just remove that code outside of Cabbage, and then open it once again within Cabbage?

I’ve managed to fix it, I just wanted to bring it up to your attention in case it was something worth looking at. Also your live-style sampler tutorial is incredible! Currently working on trying to make a more in depth version.

My full attention is on Cabbage3 these days, so unless it’s a showstopping bug I probably won’t find the time to fix it. I’m glad you find the Live sampler video helpful. I will try to make more of these for the new version. :+1: