Cabbage Logo
Back to Cabbage Site

LFO on GUI Parameters

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?

MOUSE_X and MOUSE_Y. You will basically have write your own mouse handlers. Not sure how efficient it will be, but I’ve seen people do things with Cabbage I never thought possible, so it wouldn’t surprise me if it works fine :laughing:

Nice, I will try :wink:

So another thing, how can I send sound through a meter-widget?

Also, I have been trying some .png files as testing the UI background, but I seem to get some blur even though the ratio is correct. Any tips on how to improve it?

Did you look at the meters example in the Misc. example menu? That’s a good place to start.

Hmm, I’ve not ever come across this issue before. Can you PM me the image so I can test here?

Ah nevermind, the file was a little different in size than what I thought it was, now it looks crisp.

Yep I checked it out, but "chnset abs(randi:k(1.1, 100, 2)), “vMeter1"”, so vMeter1 is the channel of the meter-widget itself, and would I be able to just set the levels through "chnset abs(ain), ain being the incoming audio?

Ah of course not through a absolute value if the incoming audio is measured in dBFS

The meter widget expects a value between 0 and 1 so you will need to scale accordingly.