Cabbage Logo
Back to Cabbage Site

LFO on GUI Parameters

Try latched mode. :+1:

Yep I am using that now, but that changes value when you release the left mouse button correct?

Right now I am using, as I referenced earlier:

if (chnget:k(“button2”) == 1) then
kLFOtype += 1

So when I hold in the button it will continously add up. I’m trying to only do a single change, and I was thinking if using something like chnset (0), “button2” would work to immediately change the value back, but I am having a little trouble with it.

try something like this:

kButton chnget "button"
if changed(kButton) == 1 then
//do shit here
endif

This will do stuff on each click…

1 Like

That was EXACTLY IT! You genius! Thank you so much :grin: :grin: :grin:

Okey, so I tried the new one and it works nicely, but I got it working with the normal xy-pad too!

Check it out!XY-pad LFO

1 Like

I worked on it a bit more.

Now it moves nicely along, and it will also change the pitch value so that the LFO modulate the new value. I am having a problem since “kPV * kLFO_1” will make the modulation be bigger at higher values, and smaller at lower ones. Do you have any suggestions on how to make it modulate the same amount no matter what kPV is?XY-pad LFO 2

Can you just use kLFO_1 in this instance and ignore kPV?

Yep that will work fine :+1:

Okey, so I have a small question.

I am trying to change a active value (rslider widget using identchannel) from 1 to 0, but am having some problems using this technique in a if-statement

kCombo

It always changes the value to 0 when I run the code, even if kCombo_1 is not equal to 4. Any obvious mistake I have made perhaps?

Yes, I’m afraid there is, you are using = instead of == in your comparison.

1 Like

Thanks fixed that, but it is still happening for some reason? The printk 1, kX runs when kCombo == 4 (number in a combobox), but even if I set value(1) in the GUI, it still forces it to 0 when I run. And when I hide the code, it will start at 1

Can you post your full .csd so I can take a look?

Yes, is it possible to send om PM?

Yeah, it would be easier to have the actual file. PM it to me…

Ok, it seems to be behave as I would expect?

Yes, because you do:

elseif kCombo_1 == 4 then
    chnset (kX), "knob2"
    printk 1, kX

Forces what exactly?

Sent you a video on pm

You should be using k versions of those opcodes if you want to update in realtime. Also there is fallthrough on the k tests at init time, so make sure you’re last condition is the default.

In general I would keep the GUI stuff separate from the audio stuff. Even to its own instrument. I find it make things easier. You see you don’t need to send active(0) to your combobox on each cycle. It’s a waste of processing. You only need to change the state once.

1 Like

Perfect! Yes I definitely need to work on optimizing the code.