UI component updates


I'm wondering what is the best way to update UI components:

I used a changeBroadcaster to update a label (showing some transport infos) with a sendChangeMessage to the associated component inside the processBolck method. It works well in my main computer (a quite powerfull i7) but i tried with a slower laptop and I had trouble with short latencies (audio crackle).

then I tried to call the sendChangeMessage only once each X processBlock (about 25 times a second), or to replace it with a timer callback... And in both case it worked better, but not perfectly when i run it with a very short latency.

And subsidiary question, what about opacity and performance : Does it changes anything to set it as opaque if there is nothing behind the component?

As a summary,  what are the best practices to manage UI updates?





Thanks a lot! I looked for it but i didn't find this topic...

At the end, what did you choose? Do you use VFlib or are you still working with timers ? (which seems to be the simplest way, as AsyncUpdater and ChangeBroadcaster are not fully safe)

I'll take a look on TheVinn's code (thanks to him too), but I don't know if I really need it or if timers may be sufficients to me.


I'm still using timers, but plan to look into a lock free fifo bazrush has contributed (https://github.com/bazrush/juce-toys/blob/master/nonblocking_call_queue.h). I'm also looking forward to see what Jules is developing with lambdas.


Thanks again, i'll look that too.