Many programs have scrollable waveform views of audio files, which are often zoomable to the point of seeing individual samples.
The obvious way to implement this is using a
Viewport of a large
The problem is this:
Component's bounds are
int-based. When zooming such that each sample is a pixel, at 192kHz,
INT_MAX/sampleRate results in 3h 6m. That’s enough to import Interstellar (at 2h 49m) but a slightly longer movie would be out of bounds… If zoom allows a sample to take several pixels we reach the limits sooner.
I wonder what’s a good way to work around this limit, and wonder what JUCE-based DAWs like Waveform do? @dave96
- For example in Auto-Align Post we have a waveform viewer with our own custom scrollbar which isn’t based on Viewport (and it’s based on
doublevalues counting seconds so this problem doesn’t affect it)
- Do people limit the zoom so that the bounds won’t overflow?
- Would it make sense to switch
Component's bounds to be based on