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: u32Changes 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: u32Changes with every new reading in the same epoch.
sector: u32The sector the head was in, counted from the top of the song file.
sectors_per_second: u32Sectors the drive reads per second at the file’s speed (75 or 150).
Implementations§
Source§impl HeadSample
impl HeadSample
Sourcepub const fn millis(self) -> u32
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.
Sourcepub const fn centre_millis(self) -> u32
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
impl Clone for HeadSample
Source§fn clone(&self) -> HeadSample
fn clone(&self) -> HeadSample
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HeadSample
impl Debug for HeadSample
Source§impl PartialEq for HeadSample
impl PartialEq for HeadSample
impl Copy for HeadSample
impl Eq for HeadSample
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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)