AudioThumbnail electrified waveform drawing

Hi, I have UIClip components that display a waveform similar to any standard editor out there. I’m using an AudioThumbnail to perform the drawing in the UIClip’s paint method.

Whenever I resize a clip (especially during recording), the waveform has a buzzing, electrified effect. This is due to the parameter values that I pass in resulting in a slightly different value for timePerPixel in AudioThumbnail::CachedWindow::refillCache.

Time per Pixel: 0.0464888277
Time per Pixel: 0.0464399093
Time per Pixel: 0.0464724759

So I’m wondering how to work around this. I’ve tried to redraw just the effected portion of the waveform, but to resize the clip I call setbounds which forces a full repaint. I’d like to figure out something to this regard as doing a full repaint doesn’t seem efficient, but I’m guessing at that. Maybe I should just be ensuring that the values I pass to drawChannels will work out to a constant timePerPixel?

Any insight is appreciated. Thanks


It seems I only get smart AFTER posting a question to the forum. :roll: Anyway, I’ve managed to get my less-than-genius brain to calculate the values in a way that keeps timePerPixel the same. I still question the efficiency of redrawing the whole waveform each time but it isn’t really causing me any trouble at this point.