pub struct Audio {
pub rate: u32,
pub channels: Vec<Vec<f32>>,
}Expand description
Planar audio: one Vec<f32> per channel, all the same length.
Fields§
§rate: u32§channels: Vec<Vec<f32>>Implementations§
Source§impl Audio
impl Audio
Sourcepub fn silence(rate: u32, channels: usize, frames: usize) -> Self
pub fn silence(rate: u32, channels: usize, frames: usize) -> Self
channels channels of frames samples of silence.
pub fn mono(rate: u32, samples: Vec<f32>) -> Self
pub fn seconds(&self) -> f64
Sourcepub fn to_stereo(&self) -> Self
pub fn to_stereo(&self) -> Self
Mono is copied to both sides; more than two channels fold down to the first two.
Sourcepub fn mix_in(&mut self, other: &Audio, at: usize)
pub fn mix_in(&mut self, other: &Audio, at: usize)
Adds other (same channel count) into self starting at frame at, growing as needed.
Sourcepub fn set_frames(&mut self, frames: usize)
pub fn set_frames(&mut self, frames: usize)
Pads (with silence) or truncates to frames.
Trait Implementations§
impl StructuralPartialEq for Audio
Auto Trait Implementations§
impl Forget for Audio
impl Freeze for Audio
impl RefUnwindSafe for Audio
impl Send for Audio
impl Sync for Audio
impl Unpin for Audio
impl UnsafeUnpin for Audio
impl UnwindSafe for Audio
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