Cabbage Logo
Back to Cabbage Site

LFO on GUI Parameters

You mean like setting up all the “chnget” in a individual instrument, and using them as global variables perhaps?

No need for global variables. The channels are all global anyway.

1 Like

Nice, I will try to organize it more :+1:

Hi, I was wondering if it’s possible to change font-type in the GUI? Also, when you set the value box to “is visible” at the bottom of a knob editor, it will put the text on top, and the value on bottom, which is great. I was wondering if there is a way to remove the value under the knob, outside of reducing alpha? Because even if you reduce alpha to 0, you can still click on the box and edit the value. I want to have something else under some knobs instead of the number box :slight_smile:

I would suggest you create your GUI in an image editor. Spend some time getting the layout right, add your text labels to it as well. Then place your Cabbage widgets on top of it in the right place. Check out this Cabbage plugin:
https://gbsoundlab.com/equphonic/
It’s just a simple image as a background with widgets placed on top. This is much easier than messing with labels and fonts in Cabbage. That stuff is great for quickly prototyping, but when it comes to creating a polished look, you should use some nice GUI resources. You can also use PNGs for your sliders to to make your plugins look completely unique.

Yep, I am doing that at the moment. When I assign the parameter to a combobox, it makes the modulation-knob for that parameter inactive (so the color on the font turns to grey). It really shows that you cannot use this knob anymore unless you unassign it from the combobox, but I am not sure how to replicate this in another way using a png file :confused:

Okey so I was wondering. I am trying to do a switch between .svg files like this (image widgets):

if (changed(gkButton_1) == 1) then
kLFOtype += 1
chnset “visible(0)”,“imageIdentS1”
chnset “visible(1)”,“imageIdentT1”
;SIdent_1 sprintfk “visible(%d)”, 1 ;Commented out
;chnset SIdent_1, “imageIdentS1” ;Commented out

if (kLFOtype == 3) then
    kLFOtype = 0
endif

reinit UPDATE

endif

I have a similar problem like earlier, where the chnset will run even if the if-statement condition is not true. So it changes instantly when running the code.

I’m just dropping in at the tail end of the discussion, but if I had to guess, I’d say it’s probably because chnset is operating at irate here due to the arguments all being statically set.

Maybe try something like:

chnset strcpyk(“visible(0)”),“imageIdentS1”
chnset strcpyk(“visible(1)”),“imageIdentT1”

Which should force chnset to see the argument as a krate string, so now it will evaluate on each k-cycle. Assuming that is the problem, it’s a pretty common one… I think we’ve all banged our heads against this wall once or twice. :wink:

Hope that helps!

1 Like

Thanks, I tried it, but it didn’t solve it :sob:

imageIdentS1 and imageIdentT1 are identchannels, which should be correct right?

Correct, if you’re trying to send anything that would normally have been part of the widget’s declaration in cabbage, send it to the ident channel (in this case, “visible(x)”)

But if you’re trying to set the value, you can send that to the channel itself.

Like Rory tho, with partial code I can only take guesses… but if you’d like me to take a look later this evening, send it my way and I’ll see if I can figure anything else out.

1 Like

Nice! The whole script is long and messy, so I took out the part that I am trying to correct.

I am choosing between two (or more) LFO-types, and I am trying to match the change with a visual image.LFO-Selection.rar (8.6 KB)

I think I found the problem! Try changing:

gkButton_1 chnget "button1"
gkButton_2 chnget "button2"

to

gkButton_1 = chnget:k("button1")
gkButton_2 = chnget:k("button2")

The gk variables you’re watching for changes were getting read in at i-rate! Hopefully that helps get you going again :slight_smile:

1 Like

I tried, still the same :sob:

There were other issues too, I didn’t get it working perfectly, just tried to find what was preventing it from working. That was definitely the biggest problem… those variables were never changing otherwise.

Aside from that, you’re only setting that visible states once, and it’s always the same… so you won’t see any changes. If you change the chnsets to look like this for instance:

    chnset sprintfk("visible(%d)",kLFOtype==1 ? 1 : 0),"imageIdentS1"
    chnset sprintfk("visible(%d)",kLFOtype==2 ? 1 : 0),"imageIdentT1"

You’ll see the changes then, but only when using the “-” button for some reason. I didn’t figure that one out yet… but one mystery at a time, right? :wink:

1 Like

You genius!!! This I can definitely work with! Thank you! :grin: :grin:

Can you explain what happens here? “kLFOtype==1 ? 1 : 0”

1 Like

It’s basically an in-line if statement.

if kLFOtype == 1, supply a 0 in the sprintf…
“:” means else, so if it isn’t 1, supply a 1 into the sprintf

Hopefully that made sense :slight_smile:

1 Like

Ahh, I have never heard of a inline if-statement before! That is brilliant!

1 Like

I have a question. When you hover over UI buttons (widget), there is something of a highlight (brighter color). Is this possible to transfer over to buttons using images? Maybe it’s possible to use a if-statement to check when they are hovering over, and change image?

You could check the mouse coordinates to see if it is over the image, and if so update the image. I’m not sure how well it will work, let us know how you get on. It’s an interesting one.

I will! Will be done with exam in a couple days, so will continue working then. Is there a reserved channel that checks the mouse coordinates? Run it through a while-loop or a if-statement to continuously check?