PlaybackController

A playback source that com.musicmuni.voxatrace.calibra.CalibraLiveEval can drive and clock against. Implemented by SonixPlayer (a single track) and SonixMixer (a reference track plus synced accompaniment), so live evaluation can run over either without knowing which.

Time contract (critical)

currentTime and audibleTimeMsAtWallNanos MUST be views of the same DAC-presentation clock. The eval derives segment timing / phase transitions from currentTime and aligns the student's captured pitch frames to playback via audibleTimeMsAtWallNanos; if the two disagree (e.g. one is a wall-clock and the other a hardware clock), scoring drifts even though audio sounds fine. Implementations should source both from one presentation clock (see the shared PresentationClock used by the platform players and the mixer's reference track).

Inheritors

Properties

Link copied to clipboard

This source as a PlaybackInfoProvider for recorder sync.

Link copied to clipboard
abstract val currentTime: StateFlow<Long>

Current playback position in milliseconds (DAC-presentation clock).

Link copied to clipboard
abstract val isPlaying: StateFlow<Boolean>

Whether playback is currently active.

Functions

Link copied to clipboard
abstract fun audibleTimeMsAtWallNanos(wallNanos: Long): Long

Audible playback position (ms since playback start) at the given monotonic-nanoseconds wall moment, or -1L during pre-play / transient seek states. Same clock as currentTime; see the time contract above.

Link copied to clipboard
abstract fun pause()

Pause playback.

Link copied to clipboard
abstract fun play()

Start or resume playback.

Link copied to clipboard
abstract fun release()

Release all native resources. The source cannot be reused after this.

Link copied to clipboard
abstract fun seek(positionMs: Long)

Seek to a position in milliseconds.