Skip to main content

Module playback

Module playback 

Source
Available on crate feature preview only.
Expand description

The preview playback state machine: one clock, two strategies.

While playing there is exactly one source of time. If the scene carries audio and an output device is available, the audio player is the clock and each repaint reads its position; otherwise the wall clock advances the playhead. In both cases the visual is a pure function sampled at the clock reading โ€” nothing is evaluated between repaints, and errors never accumulate because the playhead is always read, never integrated.

Paused, there is no clock at all: the playhead is a plain position variable only moved by scrubbing, stepping, or reading the clock one last time when pausing.

Structsยง

PlaybackEngine ๐Ÿ”’
Playback engine for the preview: owns the persistent audio player (so the output device survives pause cycles) and the active clock while playing.

Enumsยง

PlaybackClock ๐Ÿ”’
The active clock while playing.