Cabbage Logo
Back to Cabbage Site

Making a "preview" signal display that only updates when parameters are changed

I’m working on a mixer effect right now, and I’d like to have a little preview window that shows what the effect does to a waveform (both to make testing easier and to make actual usage easier when it’s finished). I’m thinking of having two signal displays, one showing a sample of dry audio and the other showing the result.

I could just make an instrument that constantly sends the signals to their corresponding displays. However, that would be a constant drain on CPU, and a moving waveform is often difficult to understand visually. What I’d like is for the preview images to be static unless you change the parameters, in which case they’d update to reflect the new parameters but return to being static afterwards.

There are two things I need to figure out for this – how to make signal displays hold on to a single image unless they’re sent a new one, and how to make CSound/Cabbage look for GUI events and only update when an event triggers.

Is this kind of thing currently possible? How would I go about doing it? I guess for event checking I could simply just check all the relevant GUI elements every step to see if their value changed, but it seems like there should be a more elegant way to do it. And I really don’t know how to temporarily freeze a signal display, aside from just sending it the same signal over and over, exactly synced to its refresh rate.

Did you check out the simple table example from the Misc examples. That uses a gentable widget and only updates the waveforms when changes are made to the sliders. And it’s done like this for the reasons you mention, i.e, to improve efficiency. Note the general rule is: use a gentable widget when you only need to update occasionally, use a signaldisplay when you wish to draw a continuous waveform over time. Let me know how you get on :wink:

That’s super helpful, thanks a lot!