pub struct Samples { /* private fields */ }Expand description
A sound made at run time: 16-bit samples, interleaved (left first in
stereo), at a rate. Any rate from 1 to Self::MAX_RATE: a backend
plays it at its own.
Implementations§
Source§impl Samples
impl Samples
Sourcepub fn new(
rate: u32,
channels: u32,
samples: Vec<i16>,
) -> Result<Self, SamplesError>
pub fn new( rate: u32, channels: u32, samples: Vec<i16>, ) -> Result<Self, SamplesError>
samples, interleaved, at rate with channels (1 or 2), if they
are whole frames.
Sourcepub fn from_u8(
rate: u32,
channels: u32,
bytes: &[u8],
) -> Result<Self, SamplesError>
pub fn from_u8( rate: u32, channels: u32, bytes: &[u8], ) -> Result<Self, SamplesError>
bytes of 8-bit unsigned samples (128 is silence), as old formats keep
them, interleaved, at rate with channels: each becomes
(b − 128) × 256.
Sourcepub fn into_samples(self) -> Vec<i16>
pub fn into_samples(self) -> Vec<i16>
Its samples, handed over.
Trait Implementations§
impl Eq for Samples
impl StructuralPartialEq for Samples
Auto Trait Implementations§
impl Freeze for Samples
impl RefUnwindSafe for Samples
impl Send for Samples
impl Sync for Samples
impl Unpin for Samples
impl UnsafeUnpin for Samples
impl UnwindSafe for Samples
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more