pub struct AudioData {
pub sample_rate: u32,
pub channels: usize,
pub samples: Vec<f32>,
}Expand description
Audio data representation.
Fields§
§sample_rate: u32Sample rate in Hz
channels: usizeNumber of channels
samples: Vec<f32>Audio samples (interleaved for multi-channel)
Implementations§
Source§impl AudioData
impl AudioData
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Get number of frames.
Sourcepub fn downsample(&self, target_rate: u32) -> Self
pub fn downsample(&self, target_rate: u32) -> Self
Downsample to target sample rate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioData
impl RefUnwindSafe for AudioData
impl Send for AudioData
impl Sync for AudioData
impl Unpin for AudioData
impl UnsafeUnpin for AudioData
impl UnwindSafe for AudioData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more