Cabbage Logo
Back to Cabbage Site

PDC can now be changed in realtime

A form’s latency() identifier can now be updated in realtime. The form widget has a channel automatically set up named ‘form’. The code shown below updates the plugin latency in realtime with a slider that jumps in integer increments from 1 to 8. Updating a plugin’s PDC in real time may not be supported by some plugin hosts.

instr UpdateLatency
    kLatencySliderVal, kLatencyTrig cabbageGetValue "latencySlider"
    cabbageSet kLatencyTrig, "form", "latency", pow(2, kLatencySliderVal)
    printf "Setting latency to %d\n", kLatencyTrig, pow(2, kLatencySliderVal)
endin

Rory, on a related note, I’ve been wondering if it is possible to get the size of a form? I’ve been putting an image into the form, and getting the size from that, but if I could get it directly from the form…

Not up until now. But now that I’ve changed the underlying form class it should be easy to access that info. Leave it with me. I’ll get that going shortly.

1 Like

Thanks.

So, does this mean that if we don’t specify a parent in cabbageCreate, that it will assume “form”? Also, can we explicitly use “form” in a parent identifier?

If you don’t specify a parent it will be assigned to the main form. No need to be able you assign this. It makes little sense. Or?

I just checked with the latest release and this is already possible. Try this:

instr 1
    kWidth cabbageGet "form", "width"
    kHeight cabbageGet "form", "height"
    printk2 kWidth
    printk2 kHeight
endin

[edit] I just added an i-time version of cabbageSet so you can also do this:

instr 1
    iWidth cabbageGet "form", "width"
    iHeight cabbageGet "form", "height"
    print iWidth
    print iHeight
endin

Thanks, Rory! This is great! Got the latest and will continue moving forward!