Modifying AudioVisualiserComponent to draw additional data

Is there an elegant way that I could extend the functionality of the AudioVisualiserComponent class to draw an additional line on top of the waveform (also contained in a buffer, to line-up in time), using another colour? Or, will I likely need to create a new component from scratch? I’m hesitant to simply draw over the AudioVisualiserComponent using a second component, but perhaps this is the third completely reasonable way of doing things. Any suggestions would be appreciated!

Why are you hesitant about that? I think that is the cleanest way.

The framework (and the OS) will decide, what needs redrawing…

1 Like

I appreciate your feedback. I had a weird feeling that this was a klunky solution and there might be a better way. I suppose I thought that they might redraw at different times, or time-alignment would be less straightforward and it might look weird. It could be that I was looking at it wrong.

I’ll try adding a new component that draw separately on top.

Any drawing is single threaded. It is guaranteed by the MessageManagerLock, in case a second thread is created and tries to draw.

Thanks for your help in steering me down the right path here. It will surely save me some time.

One other thing you might be able to help with: I’ve noticed that the waveform can look a bit jittery at times even if I try to force the setRepaintRate method to use something quite high. If there are two channels they sort of jitter out of sync slightly by a few samples back and forth relative to each other. It’s not terrible, but it’s not buttery smooth for a fairly simple scrolling 2D waveform. There must be a way to fix that?