Cabbage Logo
Back to Cabbage Site

Comboboxes default to blank

In the latest beta builds of cabbage there is an issue where comboboxes default to having no value. This cannot be fixed by setting the value manually with the value identifier. The issue does not exist in the Cabbage 2.7 release, but was introduced in a beta release.

The csd I am using is using legacy channel methods of communication between csound and the GUI, but I would not think that would create this issue.

I just tested the combobox example in the Widgets folder and it works as expected? Here is it. Iā€™m setting the value to 2, but even without that it loads the default choice.

ComboTest.csd (2.1 KB)

The example is working on my end as well. I am unsure why things broke on my plugins. I have included a plugin I have been working on.

spectralDelay.csd (82.7 KB)

Actually, I think it has to do with using the old gui mode- I turned it off on the example and encountered the same issue.

Yes, I see that now. That shouldnā€™t be the case of course. Iā€™ll take a look when I get a moment. :+1:

Hi @Chris_Poovey. Iā€™ve pushed a ā€˜fixā€™ now and triggered a new build in Azure. To be honest though, Iā€™m not sure my ā€˜fixā€™ wonā€™t break another part of that system. Can you test it and let me know?

1 Like

It seems to work based on some cursory testing. Selections are taking and presets seem to work as expected!

Iā€™d say proceed with caution! If anything looks off let me know :+1:

Having an issue here where if I use cabbageSet on the combobox (in this case populated by a directory) it comes back blank each time even after manually setting a value.

combobox bounds(217, 50, 200, 20), populate("*.wav", "includes/IRs"), channel("IR"), value(2), automatable(0)

kverbtype, kverbchanged cabbageGetValue "ReverbType"

    if kverbtype == 1 then
            cabbageSet kverbchanged, "IR", sprintf("bounds(%i,30,400,16)", 3000)
        else 
            cabbageSet kverbchanged, "IR", sprintf("bounds(%i, 50, 140, 20)", 217)
    endif

Cabbage Pro 2.8.103

Does setting the channelType() to string help?

I forgot about that but it doesnā€™t seem to help

combobox bounds(3000, 50, 200, 20), channelType("string"), populate("*.wav", "includes/IRs"), channel("IR"), value(2), automatable(0)

Leave it with me. Iā€™ll take a look when I get a chance. :+1:

Thanks Rory,

Overall Iā€™m having trouble figuring out what the directory comboboxā€™s value is and how to address it. Is it a full path or just the file name? If the latter, it is without an extension? As you know, printing the strings is kind of a headache after init. I know thereā€™s been a few issues with the comboboxes and these params have changed. It would be great to see a help example just illustrating how to use the directory combobox with cabbage opcodes - if there isnā€™t already.

1 Like

For instance Iā€™m trying to get a full file path to load an audio file into a table for convolution. The combobox (i think) only returns the file name and extension, so I need to append the path before I do anything else.

Simpulse=chnget:S("IR") 
SimpulsePath strcat "includes/IRs/", Simpulse

but the strcat and strcatk always seem to run a single cycle before the concatenation returning only the first string - as if the ā€œIRā€ channel hasnā€™t loaded yet? Not sure but that is what it seems like. Sorry I know this veering off-topic a bit but I think it might be related?

If I print the SimpulsePath at k-rate

Simpulse =chnget:S("IR")
    SimpulsePath strcatk "includes/IRs/", Simpulse
    iImpLen filelen SimpulsePath
    iImpLenInSamples = iImpLen*gisr*2
    printks SimpulsePath, 0.5

I get

includes/IRs
includes/IRs/St Georges Med

as it seems to go a cycle before the combobox value is availableā€¦

A few mins laterā€¦

OK, I think Iā€™ve narrowed it down to the combobox not having a value on init despite the string being displayed in it. So I think it is only available at k-rate?

a few few mins later part 2ā€¦

I managed to get around this by checking for the string length in the combobox - if itā€™s greater than zero. That way it only calls the opcode that references it at k rate - after the string is loaded.

So the only remaining issue is that the combobox resets to empty after a cabbageSet operation on it.

Here what I can manage to string together about comboboxes that list a bunch of files:

  • When selected they return only the file name and extension, i.e, no path
  • To update an item in said combobox you need to set the text as it will appear in the combobox
    • this is a little annoying I have to say - but it can be worked around.

Iā€™ve attached a full example that will work as I think you would expect. Hereā€™s a run down of the best bits :rofl:

SFileType cabbageGet "combo1", "fileType"       ; get file type as set by populate()
SPath cabbageGet "combo1", "currentDir"         ; get the directory that is passed to poplate()
SCsdPath cabbageGet "CSD_PATH"                  ; get .csd directory
SFilesDir sprintf  "%s/%s/", SCsdPath, SPath    ; construct full path from absolute and relative paths
SFile, kComboChanged cabbageGetValue "combo1"   ; get file name
SFileName cabbageGetFileNoExtension sprintfk("%s/%s", SFilesDir, SFile) ;get filename from full name  

The code above constructs paths from the relative ones given to populate() and the absolute path that CSD_PATH returns. Changing to a different folder wonā€™t break this, as long as you keep things relative. Iā€™m also removing the file extension from the combobox return string. I add it later, itā€™s safer to do this.

if kSliderTrig == 1 then
        ;update combo and set current file
        cabbageSetValue "combo1", sprintfk("%02d", kSlider), kSliderTrig   
        chnset sprintfk("%s%02d%s", SFilesDir, kSlider, strsubk(SFileType, 1, -1)), "currentFile"                
endif

Here I set the combobox item to match the slider value, and then update the new ā€œcurrentFileā€ channel.

Itā€™s a bit of a hoop, but it works :slight_smile:

comboTest.zip (76.4 KB)

1 Like

Thanks for the detailed example! Iā€™ll dive in tomorrow and see what I can do

Thanks Rory - I havenā€™t fully dug in yet and my apologies if this thread has become convoluted. Just looking over your example here - does this address the issue with cabbageSet on the combobox resetting to a blank value? I have the other issues resolved but this it the only one outstanding. Just want to make sure before I go down this path! Hereā€™s the issue Iā€™m havingā€¦ https://recordit.co/EIOmGJxkqY

for instance, this line affecting the combobox causes it to go blank
cabbageSet ktrig, "ComboBox", sprintfk("active(%i)", 1)

as does a string affecting the comboBox bounds.
cabbageSet ktrig, "ComboBox", sprintfk("bounds(%i, 20, 100, 20)", 100)

No blank items in my example.

OK, just wondered b/c I didnā€™t see cabbageSet in there - only cabbageSetValue. Iā€™ll dig in now, thanks

Ah, youā€™re right, I donā€™t have cabbageSet. But think the same issue would be resolved with the cabbageSet if you only set the item to what should appear in the combobox. Anyhow, take a look and let me know. :+1: