Anticipator

class Anticipator(spring: Spring)

Kicks a spring early enough that its peak lands on the next onset instead of just after it.

Hand it the seconds until the next onset every frame. It says yes once, when that time drops to the spring's own Spring.peakDelay. The queued audio knows exactly when the onset is, which is what makes this possible; with nothing queued, kick on the onset as usual.

Constructors

Link copied to clipboard
constructor(spring: Spring)

Functions

Link copied to clipboard
fun due(secondsToOnset: Float): Boolean

True on the one frame the spring should be kicked.

Link copied to clipboard
fun reset()