asFuture

fun SpectrumTimeline.asFuture(positionMicros: () -> Long): VizFuture

Lets a drawing see the audio that has been analysed but has not been played yet.

A player hands audio to the sound device before anyone hears it, and the device holds it for a fraction of a second. That gap is usually a nuisance: it is why a visualiser has to queue its analyses instead of drawing them at once. Read the other way it is a gift, because everything still in the queue is music the listener has not reached. A drawing can be already moving when a beat arrives rather than starting when it does, which is what a person listening does.

positionMicros is asked on every query. This adapter assumes 1x playback; the player view supplies its own rate-aware adapter for other playback rates.