Cabbage Logo
Back to Cabbage Site

Widgets no longer dynamically update (regression)

Using the latest build, 2.5.38.

I was trying to reproduce the code in the new opcode demonstration video here:
https://www.youtube.com/watch?v=3Y7kkfUmZsw

You can see the code I ran below.

When I instead downloaded the 2.5.37 build, it worked as expected.
[To clarify: it worked with the artifact for
20210423.1, build id 1283, but not 20210430.7 build id 1327
machine was running windows 10 64bit]

I’m not sure if this is specifically an issue with cabbageGet/cabbageSet, or if its an issue that would affect the id channel way of doing this as well. I’ve barely dipped my toes into cabbage, so I apologize if I’m not too helpful for debugging.

I did try uninstalling both csound and cabbage, and swapped between the versions multiple times through complete uninstalls + reinstalls (with csound selected for install), which consistently allowed the earlier version to change the label by button press, while the newer 2.5.38 could not.

Frustratingly, there was no output to the console that suggested an error, just a failure for the text to change.

Let me know if you need any more details, I really appreciate your hard work!

<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue") colour(58, 110, 182), pluginId("def1")
rslider bounds(296, 162, 100, 100), channel("gain"), range(0, 1, 0, 1, .01), text("Gain"), trackerColour("lime"), outlineColour(0, 0, 0, 50), textColour("black")

button bounds (16,14,80,40), channel("button1")
label bounds(114,10,136,46), channel("label1")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1


instr 1
kButton, kTrig cabbageGet "button1"
kButton1 chnget "button1"
kTrig changed kButton1

if kTrig == 1 then
    cabbageSet 1,"label1", "text(\"Goodbye\")"
    //update
endif


endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 [60*60*24*7] 
</CsScore>
</CsoundSynthesizer>

Thanks @fellgrail, and welcome to the community. You’re right, this is a regression. The following works:

instr 1
    kButton, kTrig cabbageGet "button1"
    cabbageSet kTrig,"label1", "text", "goodbye"
endin 

But passing the identifier and argument in the same text doesn’t, although it should. I think I might have tried being too clever is overloading these opcodes. I’ll get it sorted tomorrow. Thanks again for posting and letting me know.

I’ve just pushed a fix for this through to GIT. I didn’t bump the version number, but you can grab the latest build when it’s ready. In my test, both of the comment, and uncommented lines of code work the same:

instr 1
kButton, kTrig cabbageGet "button1"
;cabbageSet kTrig,"label1", "text(\"goodbye\")"
cabbageSet kTrig,"label1", "text", "goodbye"
endin

I just noticed some weird behavior with the rslider and hope this would be the right thread to report on. Also, not sure yet if this applies to all sliders (have yet to test):

  • If one first creates an rslider widget with the range identifier, then the default or initial value shows up as expected.

  • However, if you try to update the range after it has been declared, the default value updates OK but double-clicking on the rslider doesn’t default to the new value declared (it goes to the original value instead).

  • I tried not declaring the range when first creating the widgets (I’m actually using cabbageCreate, BTW), and then sending a cabbageSet to update the range. In this case, the new values come through but double-clicking goes to minimum (as opposed to the new default/initial value declared).

  • I was hoping –– when creating a relatively large number of widgets (say 24 rsliders) –– to declare a common range (or not declare it at all) first, but then update specific widgets with a new range and/or default value (being able to double-click on the knob to reset it to a specific spot would be a plus for me).

Hope that helps!

Ranges can’t be modified*. It would drive a host mad if the range of a slider changed during a session. It would lead to all sorts of issues. If you want to give the illusion of dynamic ranges, set everything to be between 0 and 1, and then use the popuptext() identifier to display custom ranges when the user hovers over a slider.

  • I’ll put a note about this in the docs…
1 Like

I understand, thanks (it wasn’t so much about the ranges but the default values that I wanted to define after creating the widgets, but I assume that this holds true for them as well anyway).

EDIT: sorry, I wasn’t thinking (easy to get loopy for me sometimes!), it’d be quite easy to pass an iArray with all the values beforehand! :sweat_smile:

idv[]   init 4
idv[0]  = 0.25
idv[1]  = 0.36
idv[2]  = 0.47
idv[3]  = 0.58

icnt    init 0

while icnt < 4 do
    print idv[icnt]
    icnt += 1
od

Yes the default values can be updated by simply setting the widget’s value when the instrument starts. :+1:

1 Like