AudioVisualiserComponent Slow Performance

This is a really useful class but the output is not very smooth, and the CPU usage is high. My plugin jumps from less than 20% to 50-80% when I use it. I can see that I can reduce the CPU usage to the lower end of the range by keeping fewer samples in the buffer (and therefore fewer painted) and by reducing the size of the component.

This might be a dumb question, but I’m looking for some advice. I’m trying to figure out if the lackluster performance is in fact as good as you can get, and if I just need to deal with it (drawing fewer samples if need be), or if there’s a lot of room in the implementation to improve this and I should go down the path of writing a custom component/paint method…

Has anyone run into this and do they have any recommendations?

Just an interesting note… in my test case I see a jump from 20% to 50% when I show the visualizer. Curiously, even if I override the paint method to do absolutely nothing I see a bump up to 45%. I had assumed the painting was the bottle neck… but I guess it’s just the buffering of the data, or how that’s managed, which surprised me.

In fact, even if I don’t call the pushBuffer() method to update the data, in addition to overriding paint to be an empty function, I see a jump to 45% in CPU usage.

It’s possible I’m missing something here. Where is the overhead?

The only way I can find to really bring this back down is to setRepaintRate to something in the single digits… even when I’m pushing no data to the function and I’ve overridden paint to do absolutely nothing… :upside_down_face:

Just having a conversation with myself here. After digging around the forum it sounds like this might be because repaint calls in my visualizer child component (that is opaque) may still be calling the paint function of the parent (everything). Without understanding why that would be, I’ll start there… For some reason I assumed repaint calls on an opaque component would limit drawing to the local bounds.