pub struct AudioRingBuffer { /* private fields */ }Expand description
Lock-free audio transport for producer/consumer playback. Lock-free SPSC ring buffer for interleaved audio samples.
Implementations§
Source§impl AudioRingBuffer
impl AudioRingBuffer
Sourcepub fn new(
channels: usize,
capacity_frames: usize,
sample_rate: f64,
) -> Result<Self>
pub fn new( channels: usize, capacity_frames: usize, sample_rate: f64, ) -> Result<Self>
Creates a new ring buffer.
Sourcepub fn capacity_frames(&self) -> usize
pub fn capacity_frames(&self) -> usize
Returns the frame capacity.
Sourcepub fn sample_rate(&self) -> f64
pub fn sample_rate(&self) -> f64
Returns the current sample rate.
Sourcepub fn reset_sample_rate(&self, sample_rate: f64) -> Result<()>
pub fn reset_sample_rate(&self, sample_rate: f64) -> Result<()>
Updates the sample rate and clears buffered audio.
Sourcepub fn available_frames(&self) -> usize
pub fn available_frames(&self) -> usize
Returns the number of frames currently buffered.
Sourcepub fn free_frames(&self) -> usize
pub fn free_frames(&self) -> usize
Returns the remaining free frames.
Sourcepub fn push_planar_f64(&self, inputs: &[&[f64]], frames: usize) -> usize
pub fn push_planar_f64(&self, inputs: &[&[f64]], frames: usize) -> usize
Pushes planar f64 channel slices into the ring.
Trait Implementations§
Source§impl Clone for AudioRingBuffer
impl Clone for AudioRingBuffer
Source§fn clone(&self) -> AudioRingBuffer
fn clone(&self) -> AudioRingBuffer
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 AudioRingBuffer
impl RefUnwindSafe for AudioRingBuffer
impl Send for AudioRingBuffer
impl Sync for AudioRingBuffer
impl Unpin for AudioRingBuffer
impl UnwindSafe for AudioRingBuffer
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