pub struct Sample { /* private fields */ }Expand description
A sample resident in SPU RAM.
Implementations§
Source§impl Sample
impl Sample
Sourcepub const fn resident(addr: SpuAddr, rate_hz: u32, blocks: u32) -> Self
pub const fn resident(addr: SpuAddr, rate_hz: u32, blocks: u32) -> Self
Describe a sample already resident in SPU RAM, for banks uploaded by
something other than Bank – VoXide streams its straight off the
disc into the SPU, never holding it in main RAM.
blocks is the sample’s ADPCM block count, or 0 when the bank format
does not record one. Length is what a cutoff is computed from, so a
sample without it gets no cutoff and falls back to the envelope: see
Sample::ticks_at.
Sourcepub const fn sample_rate_hz(&self) -> u32
pub const fn sample_rate_hz(&self) -> u32
The rate the sample was cooked at.
Sourcepub const fn len_samples(&self) -> u32
pub const fn len_samples(&self) -> u32
Decoded length in samples.
Sourcepub const fn ticks_at(&self, ticks_hz: u32) -> Option<u32>
pub const fn ticks_at(&self, ticks_hz: u32) -> Option<u32>
How long this sample runs, in ticks of a ticks_hz clock, played at
its own rate, with [TAIL_TICKS] of margin. None when the block
count is unknown, which means no cutoff can be computed and the
envelope has to finish the sound instead.
Pitch-shifted playback stretches this: see OneShot::with_pitch.
Trait Implementations§
impl Copy for Sample
impl Eq for Sample
impl StructuralPartialEq for Sample
Auto Trait Implementations§
impl Freeze for Sample
impl RefUnwindSafe for Sample
impl Send for Sample
impl Sync for Sample
impl Unpin for Sample
impl UnsafeUnpin for Sample
impl UnwindSafe for Sample
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)