Cabbage Logo
Back to Cabbage Site

Updates to cabbageSet/Get opcodes

I’ve added an i-time variant of cabbageSetValue. The following code will only run at t-time:

cabbageSetValue "gain", .2

If you want to keep updating the value of “gain” use a k-rate argument, of employ trigger signal input argument.

I’ve also added support for strings in cabageSetValue. The following code will set a combobox’s value at i-time:

cabbageSetValue "combo", "3c"

Users can change the value of the combobox after it has been set this way. On the other hand, if you wish to continuously update the value of the combobox you must do the following:

cabbageSetValue "combo", sprintfk("%s", "3c"), 1

So you must wrap your string in a sprintfk() and you must supply a trigger argument. It’s clunky, but required because Csound treats string as i-time variables. I’ll update the docs once I get some feedback on these additions.

Rory, are in the develop branch source code only?
I’m interested in the strings support to manage listbox

Dev branch but you can pick up beta installers on the Devops Azure page. There is a sticky post about accessing the builds on the forums main page. Of course if your are on Linux you can just build yourself from source :+1:

Building develop on debian ends like this:
Schermata del 2021-07-12 18-00-37

cabbage seems build but the “cabbageSetValue SS” is not found

What version of Csound are you running? Here is the opcode entry:

:thinking: Perhaps the Cabbage binary you have it an older one?

Ok I’m stupid and was running the wrong binary :worried:

After running the right one (version 2.7.8 - I’ve re compiled and the compile error persists - Csound version is 6.17 built from sources few days ago) I’ve found the opcode and it seems to work :grin:
Sorry for the noise

1 Like

I’ve now added an i-time version of cabbageGet. I am not sure how I missed that in the initial release of these opcodes. :grimacing:

I just downloaded the latest azure build - something is definitely hogging the system when toggling rsliders now and the whole thing gets sluggish - my system monitor shows Cabbage at over 90%. Just A/B’d it with my previous version and the previous one runs at 40%.

Could it be the set value changes? It behaves as if something is updating continuous k-values. I’ll look into it some more but perhaps you know offhand what the issue could be due to the changes made.

EDIT : possibly my error here - I think my formatting wasn’t correct. Seems like the widgets are still a little sluggish on the tweak but not as obvious as before… I’ll test some more tomorrow and see.

Let me know. In my tests with I can run 20 rslider’s, all updating at k-rate without that much of a CPU spike. I can’t think why I would ever want to do that, but even still, it seems to be reasonable efficient. On the other hand, using cabbageSetValue without guiMode(“queue”) leads to some serious CPU spikes. Could this have been the issue?

guiMode is (“queue”)

I attached a simplified example of what I’m working with and a small vid that demonstrates the cpu spikes.
https://recordit.co/0xceHZVf3C

This example is only doing this

cabbageSet "EffectMacro1", {{ text("FREQ"), popupPostfix("FilterVerb") }}
        cabbageSet "EffectMacro2", {{ text("Q"), popupPostfix("FilterVerb")  }}
        cabbageSet "EffectMacro3", {{ text("DEPTH"),  popupPostfix("FilterVerb")   }}
        cabbageSet "EffectMacro4", {{ text("SPACE"), popupPostfix("FilterVerb")  }}
        cabbageSet "EffectMacro5", {{ text("MOTION"),  popupPostfix("FilterVerb")  }}
        cabbageSet "EffectMacro6", {{ text("BLEND"), popupPostfix("FilterVerb")  }}
    
  cabbageSetValue "EffectMacro1", 0.2
         cabbageSetValue "EffectMacro2",  0.3
          cabbageSetValue "EffectMacro3", 0.7
            cabbageSetValue "EffectMacro4", 0.7
              cabbageSetValue "EffectMacro5", 0.2
                cabbageSetValue "EffectMacro6", 0.99

As I mentioned above, the widgets also become sluggish although it’s less obvious in this simplified example (probably b/c I’m also compounding it with other processes in my working file).

testKnobsCpu.csd (2.9 KB)

Turns out it’s not the Cabbage opcodes, or even moving the slider that causes this, it’s actually the popup display that is wasting resources. I’m looking for a fix now…

[some time later…] Ok, I just pushed a fix for this. Seems to be much less CPU waste now. Nice spot on this. I think this must have been in Cabbage for quite some time :flushed:

Cool. Will check it. The spikes def coincided with slider movement though…

There will always be a slight spike in CPU when you interact with a widget. But what I never expected to see was the CPU remaining high for as long as the popup bubble is being displayed. Anyhow, it’s definitely better now. Let me know if you still have issues with it.

Maybe I’m crazy or doing something wrong (92% chance of that) but I don’t think strings are getting set at i-time. Just downloaded the latest beta to be sure. On init, this combobox is empty…

combobox bounds(84, 100, 100, 25), channelType("string") channel("recallCombo"), items("item1", "item2", "item3")

cabbageSetValue "recallCombo", "item2"

Have you the GUI mode set right?

That’s right! The .csd is attached.
stringSetValue.csd (703 Bytes)

I’ll take a look a little later this evening…

I think the heat might be getting to you :rofl: because you forgot to start instrument 1.

Ha! It’s always something isn’t it? Who invented this instrument starting thing anyway…:bowling:

OK well, I tried to make a simplified version of another thing I’m working with here that in fact is not setting the string of the combo box. I’ll try again tomorrow to see if I can reproduce it in a simplified form. Thanks again for checking.

OK, here’s another example that more closely resembles what I’m working with. When the left combobox changes, the right one should set value to “itemB”, right?

https://recordit.co/sewsGrDnCQ

instr 1
cabbageSetValue "recallCombo", "item2"
    if changed(chnget:S("recallCombo")) == 1 then 
        event "i", 2, 0, 1
    endif
endin

instr 2
    prints "instr 2 triggered\n"
    cabbageSetValue "recallCombo2", "itemB"
endin

Also, saving a snapshot makes both comboboxes lose their contents?
https://recordit.co/VtuXB00Bum

stringSetValue.csd (1.2 KB)

If channelType(“string”) is omitted then the contents stay and recall as expected.