pub struct AudioBuffer<T> { /* private fields */ }
Expand description
An audio buffer with a format, sample rates, numbers of channels and a buffer.
Implementations§
Source§impl<T> AudioBuffer<T>
impl<T> AudioBuffer<T>
Sourcepub fn new(
format: AudioFormat,
samples: u32,
channels: u8,
buffer: Vec<T>,
) -> Self
pub fn new( format: AudioFormat, samples: u32, channels: u8, buffer: Vec<T>, ) -> Self
Constructs an audio buffer from arguments. The size of type which stored by buffer must equal to the format bit size.
§Panics
Panics if the size of type T
does not equal to the format bit size.
Sourcepub fn format(&self) -> &AudioFormat
pub fn format(&self) -> &AudioFormat
Returns the format of the audio buffer.
Sourcepub fn convert<U: Default + Clone>(
self,
format: AudioFormat,
samples: u32,
channels: u8,
) -> Result<AudioBuffer<U>>
pub fn convert<U: Default + Clone>( self, format: AudioFormat, samples: u32, channels: u8, ) -> Result<AudioBuffer<U>>
Convert into another AudioBuffer
with different format, sample rate or channels.
§Errors
Returns Err
if failed to convert into a specific format.
Sourcepub fn convert_in<U: Default + Clone>(
self,
other: &mut AudioBuffer<U>,
) -> Result<()>
pub fn convert_in<U: Default + Clone>( self, other: &mut AudioBuffer<U>, ) -> Result<()>
Convert and write into another existing AudioBuffer
.
§Errors
Returns Err
if failed to convert between self
and other
.
Trait Implementations§
Source§impl<T: Clone> Clone for AudioBuffer<T>
impl<T: Clone> Clone for AudioBuffer<T>
Source§fn clone(&self) -> AudioBuffer<T>
fn clone(&self) -> AudioBuffer<T>
Returns a copy 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<T> Freeze for AudioBuffer<T>
impl<T> RefUnwindSafe for AudioBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for AudioBuffer<T>where
T: Send,
impl<T> Sync for AudioBuffer<T>where
T: Sync,
impl<T> Unpin for AudioBuffer<T>where
T: Unpin,
impl<T> UnwindSafe for AudioBuffer<T>where
T: UnwindSafe,
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