pub struct AudioData {
pub samples: Vec<f32>,
pub format: AudioFormat,
}Expand description
Audio data with format information
Fields§
§samples: Vec<f32>Raw PCM audio samples (normalized -1.0 to 1.0)
format: AudioFormatAudio format information
Implementations§
Source§impl AudioData
impl AudioData
Sourcepub fn new(samples: Vec<f32>, format: AudioFormat) -> Self
pub fn new(samples: Vec<f32>, format: AudioFormat) -> Self
Create new audio data
Sourcepub fn split_channels(&self) -> Vec<Vec<f32>>
pub fn split_channels(&self) -> Vec<Vec<f32>>
Split into channels
Sourcepub fn from_channels(
channels: Vec<Vec<f32>>,
format: AudioFormat,
) -> Result<Self>
pub fn from_channels( channels: Vec<Vec<f32>>, format: AudioFormat, ) -> Result<Self>
Combine channels into interleaved samples
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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