Cabbage Logo
Back to Cabbage Site

Combobox snaps selection from csound

Hello,
is possible to change the preset of a combobox from csound (the idea is to make presets midi controllable)?
I’ve got something along these lines:

combobox bounds(10, 20, 350, 30), channel("combobox"), populate("*.snaps"), identchannel("pre_set")
filebutton bounds(10, 50, 350, 20), channel("butsave"), text("Save", "Save"), mode("snapshot")

than in csound:

instr 1
kpres init 2
ktrg metro 1
if ktrg == 1 then
    kpres = (kpres+1) % 2
    event "i", 5, 0, -1, kpres + 1
endif
endin

instr 5
print p4
Svalue sprintf "value(%d) ", p4
chnset Svalue, "pre_set"
turnoff
endin

But obviously don’t work, instr 5 gets triggered but combobox don’t change.

When changing preset via combobox (it works as expected) the output of combobox (read with this)

kcombov chnget "combobox"
printk2 kcombov

gives me 1 for the first preset and 0 for the all others (I was expecting corresponding numbers).

Is this a limitation in “*.snaps” system? Am I missing something?

I’m afraid this is not possible. You would need to roll your own preset system to support this. It shouldn’t be that tricky, and a custom system will provide far more options than the basic one provided with Cabbage. @TONITORMX shared one he wrote for his ToneZ synth here. And having used his synth, I can tell you his preset system works incredibly well!

1 Like

I was using ftables as altenative metod but this one seems way more refined.
Thank you and @TONITORMX

1 Like

I’ve ruined the @TONITORMX preset system to accept midi PC.
It’s a little bit modified, all presets in a single subfolder, you can not search/open them from any position. The filenames must be NNN_presetName where NNN is the Program Change number separated with underscore from the name.
Don’t know why but save button don’t open directly in the folder indicated, other than that seems to work.
Find it here presetmanager2_midi.zip (2.0 KB)

Thanks for sharing your updates. What version of Cabbage are you using?

It’s build from sources around november 2019, About says 2.3.0

I think one of the newer beta have fixed the issue of the path not working. What OS are you on again?

Linux (Debian 10)

You should build from dev, a lot has changed since 2.3.0!