Cabbage Logo
Back to Cabbage Site

Comboboxes default to blank

Not sure what’s going on - still having trouble with it. I’ve tried sending the combobox a hard path when it updates. Why does the combobox go blank just by changing an attribute? Does it completely reinitialize each time? I’ll try it again a bit later.

I did this to your example and it works…

if kSliderTrig == 1 then
        ;update combo and set current file
        cabbageSetValue "combo1", sprintfk("%02d", kSlider), kSliderTrig   
        cabbageSet kSliderTrig, "combo1", sprintfk("bounds(%i, 22, 200, 20)", kSlider*10) 
        ;chnset sprintfk("%s%02d%s", SFilesDir, kSlider, strsubk(SFileType, 1, -1)), "currentFile"                
    endif

not sure why mine isn’t… but maybe something else is happening!

Something really odd is happening here - I will send you a vid via Discord

I have to take tip my hat to you on this one! Leave it with me…

I just pushed a fix for this. There were several issues that led to this bug. One, and I can’t believe it has only now come to light, was in how Cabbage was parsing comments. It turns out code I wrote 10 years ago is not as good as I thought it was back then! :man_facepalming:

The other issue was that non-automatable comboboxes were having their contents updated every time any identifier changed. This wasn’t an issue before the new GUI system was introduced, which explains why it probably went unnoticed.

Oh, one other thing :roll_eyes: The default value for comboboxes as stated in the docs is 0. This is true, but they were starting at 1, and then on the first k-cycle changing to 0. This meant a channel change on the first k-cycle, which is confusing as hell. This is also fixed.

Ahh ok, so they are back to starting at 0 again? I noticed this for sure as the changed opcodes were triggered on each 1st pass.

Yes, I thought it best to go with what the docs say. :+1:

1 Like

Not sure if this is related but I’m having issues again with the string combobox on preset save/recall…
https://recordit.co/luhQQ5L4Z5

channelType is set to “string”

Is the .snaps method still supported?

See that it doesn’t recall the correct combobox val, and on save the combobox turns blank…

Most certainly. I’ll take a look at this tomorrow, looks like a bug.

Just wondering if there’s an update for this?

I thought this was fixed? Maybe I missed it…

oh - i didn’t try the latest…

Maybe you only updated the public build? In the Pro version this is still an issue. 2.8.11

Sorry, did you test the public build?

This instrument behaves as I would expect, i.e, it doesn’t blank the combobox when a preset is saved…

<Cabbage>
form caption("Presets") size(370, 280), colour(58, 110, 182), pluginid("MPre")
keyboard bounds(10, 90, 345, 95)
rslider bounds(12, 8, 85, 79), channel("att"), range(0, 1, 0.01), text("Att.")
rslider bounds(98, 8, 85, 79), channel("dec"), range(0, 1, 0.4), text("Dec.")
rslider bounds(184, 8, 85, 79), channel("sus"), range(0, 1, 0.7), text("Sus.")
rslider bounds(270, 8, 85, 79), channel("rel"), range(0, 1, 0.8), text("Rel.")
combobox bounds(74, 190, 100, 25), populate("*.snaps")
filebutton bounds(12, 190, 60, 25), text("Save"), populate("*.snaps"), mode("snapshot")
combobox bounds(178, 194, 80, 20) channel("combo1"), items("1", "2", "3"), value(1)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
;sr is set by the host
ksmps = 32
nchnls = 2
0dbfs = 1

;instrument will be triggered by keyboard widget
instr 1
printk2 chnget:k("att")
endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i1 0 z
</CsScore>
</CsoundSynthesizer>

Hi Rory,

Would you try this one? This is my actual working file and saving the preset still renders the combobox (sample selection) blank. On Cabbage public build 2.8.113

EDIT: here’s a much simpler example based on yours. Just put a .wav file in /samples and you will see… maybe?

<Cabbage>
form caption("Presets") size(370, 280), colour(58, 110, 182), pluginid("MPre")
keyboard bounds(10, 90, 345, 95)
rslider bounds(12, 8, 85, 79), channel("att"), range(0, 1, 0.01), text("Att.")
rslider bounds(98, 8, 85, 79), channel("dec"), range(0, 1, 0.4), text("Dec.")
rslider bounds(184, 8, 85, 79), channel("sus"), range(0, 1, 0.7), text("Sus.")
rslider bounds(270, 8, 85, 79), channel("rel"), range(0, 1, 0.8), text("Rel.")
combobox bounds(74, 190, 100, 25), populate("*.snaps")
filebutton bounds(12, 190, 60, 25), text("Save"), populate("*.snaps"), mode("snapshot")
combobox bounds(23, 210, 120, 20), populate("*.wav", "samples/"), colour("19,23,22,230"), channelType("string"), value("Abeille.wav"), channel("Sample"), fontColour(235,228,218)

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
;sr is set by the host
ksmps = 32
nchnls = 2
0dbfs = 1

;instrument will be triggered by keyboard widget
instr 1
printk2 chnget:k("att")
endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i1 0 z
</CsScore>
</CsoundSynthesizer>

Confirmed. String combos string again! I’ll try to get around to this during the week. Most likely Wednesday if I’m lucky. I’ll let you know, oh and thanks for the simplified example.

Me trying to fix these bloody comboboxes -

But I think I have it now! Can you test the latest public build and if all is good there, I will run off a pro build for you.

Oh sorry - didn’t see this… I will check this week.

1 Like

Sorry to bother again - especially on this dreaded topic.

I am working on a plugin which allows the user to select a wavetable and read it into a csound table. That works perfectly when I run it from the Cabbage environment. But when I run it as a plugin it does not read the string from the combobox until I show the GUI in the DAW (REAPER). Since usually I have all GUIs closed, this means there is no wavetable loaded thus no sound.

To trace down what really happens I put in two lines, one which prints what is read from the combobox (channel: wavetable) by cabbageGetValue every 0.1 seconds, one which prints the table-reading scoreline (both to a file). The result is:

0.000010: 0
0.100010: 0
0.200010: 0

16.800010: 0
16.900010: 0
16.960031: f100 0 524288 1 “C:\Program Files\Common Files\VST3\Cabbage/qikdrum/fibo.wav” 0 0 0
17.000010: fibo 0
17.100010: fibo 0

So for the first 16.9 seconds the cabbageGetvalue from “wavetable” results in an empty string and the trigger is zero. Then (after I open the GUI in the DAW) it reads the string “fibo”, constructs the correct file name and loads the file. That happens without me selecting anything from the combobox. The string “fibo” is taken from the value when the project was last saved.

The intended behaviour would be that this last-saved setting from the DAW project would be used immediately without the user having to open the GUI in the DAW. Is there any way to realise this?

I could try a workaround by establishing another channel “wavetable-saved” which contains a copy of the combobox value and using it at init time instead of the value. But that seems not very elegant, especially because both channels will show up in the automation of the DAW.

The csd file is attached. (You would have to change the user name in lines 123 and 127 from “Reiner” to yours or outcomment the diagnostics.)

qikdrum.csd (4.9 KB)

I pushed a fix for this now. I didn’t have to test your instrument directly. But I was able to recreate the issues with a simplified version of it. I just triggered a new build if you want to test it :+1: