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

HeadSample

Struct HeadSample 

Source
pub struct HeadSample {
    pub epoch: u32,
    pub serial: u32,
    pub sector: u32,
    pub sectors_per_second: u32,
}
Expand description

One reading of the drive head inside the playing song, taken by Player::poll.

Fields§

§epoch: u32

Changes whenever a read starts (a start, a loop or a resume): readings of different epochs do not belong to one run of the song.

§serial: u32

Changes with every new reading in the same epoch.

§sector: u32

The sector the head was in, counted from the top of the song file.

§sectors_per_second: u32

Sectors the drive reads per second at the file’s speed (75 or 150).

Implementations§

Source§

impl HeadSample

Source

pub const fn millis(self) -> u32

Start of the head’s sector, in milliseconds since the top of the file.

floor(sector * 1000 / sectors_per_second), wrapped to u32 exactly as the former u64 expression was, in 32-bit operations: the sector splits into whole seconds of sectors and a remainder below sectors_per_second, so the remainder term is at most 150 * 1000.

Source

pub const fn centre_millis(self) -> u32

Middle of the head’s sector, in milliseconds: the head was somewhere in the sector, so this is the reading with the least expected error (half a sector, 6.7 ms at single speed).

floor((2 * sector + 1) * 500 / sectors_per_second), which is floor((sector * 1000 + 500) / sectors_per_second), split like Self::millis so no product exceeds 32 bits.

Trait Implementations§

Source§

impl Clone for HeadSample

Source§

fn clone(&self) -> HeadSample

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HeadSample

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for HeadSample

Source§

fn eq(&self, other: &HeadSample) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for HeadSample

Source§

impl Eq for HeadSample

Source§

impl StructuralPartialEq for HeadSample

Auto Trait Implementations§

§

impl Freeze for HeadSample

§

impl RefUnwindSafe for HeadSample

§

impl Send for HeadSample

§

impl Sync for HeadSample

§

impl Unpin for HeadSample

§

impl UnsafeUnpin for HeadSample

§

impl UnwindSafe for HeadSample

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> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.