Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

PlaybackClock

Struct PlaybackClock 

Source
pub struct PlaybackClock { /* private fields */ }
Expand description

Audio-anchored song clock: GetlocP anchor + tick interpolation.

Feed it your per-display-frame tick counter (the same one you pass to PlaybackStarter); construct with that counter’s rate (60 for NTSC, 50 for PAL). Output is milliseconds into the playing track, smooth every tick, monotonic (never steps backwards), and immune to single-sample GetlocP jitter while still following a genuine seek or track loop.

Implementations§

Source§

impl PlaybackClock

Source

pub const fn new(ticks_hz: u32) -> Self

A stopped clock counting ticks_hz ticks per second (60 NTSC, 50 PAL).

Source

pub fn start(&mut self, now_tick: u32)

Call once CD-DA playback has actually started (e.g. on the tick PlaybackStarter::tick returns true).

Source

pub fn is_playing(&self) -> bool

Whether PlaybackClock::start has been called.

Source

pub fn tick_on(&mut self, cd: &mut Cd, now_tick: u32) -> u32

Advance and return the current song time in ms. Polls the drive through cd at most once per [RESYNC_TICKS]; interpolates otherwise.

Auto Trait Implementations§

§

impl Freeze for PlaybackClock

§

impl RefUnwindSafe for PlaybackClock

§

impl Send for PlaybackClock

§

impl Sync for PlaybackClock

§

impl Unpin for PlaybackClock

§

impl UnsafeUnpin for PlaybackClock

§

impl UnwindSafe for PlaybackClock

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.