pub struct AudioBuffer {
pub data: Vec<u8>,
pub config: AudioConfig,
}Expand description
A chunk of raw audio data with its format metadata.
Fields§
§data: Vec<u8>Raw PCM sample data (little-endian).
config: AudioConfigAudio configuration describing the format of data.
Implementations§
Source§impl AudioBuffer
impl AudioBuffer
Sourcepub fn new(config: AudioConfig) -> Self
pub fn new(config: AudioConfig) -> Self
Create a new empty buffer with the given config.
Sourcepub fn from_pcm(data: Vec<u8>, config: AudioConfig) -> Self
pub fn from_pcm(data: Vec<u8>, config: AudioConfig) -> Self
Create a buffer from raw PCM bytes.
Sourcepub fn duration_secs(&self) -> f64
pub fn duration_secs(&self) -> f64
Duration of the audio in seconds.
Sourcepub fn num_frames(&self) -> usize
pub fn num_frames(&self) -> usize
Number of frames in this buffer.
Trait Implementations§
Source§impl Clone for AudioBuffer
impl Clone for AudioBuffer
Source§fn clone(&self) -> AudioBuffer
fn clone(&self) -> AudioBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AudioBuffer
impl RefUnwindSafe for AudioBuffer
impl Send for AudioBuffer
impl Sync for AudioBuffer
impl Unpin for AudioBuffer
impl UnsafeUnpin for AudioBuffer
impl UnwindSafe for AudioBuffer
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