pub struct PcmReader { /* private fields */ }Expand description
Threaded PCM reader — direct port of pcm_async.
Reads raw PCM from any Read source on a background thread,
converts S16→f32 if needed, and fills a ring buffer.
Implementations§
Source§impl PcmReader
impl PcmReader
Sourcepub fn new(source: Box<dyn Read + Send>, config: PcmReaderConfig) -> Self
pub fn new(source: Box<dyn Read + Send>, config: PcmReaderConfig) -> Self
Create and immediately start the reader thread.
Sourcepub fn pop_ms(&self, ms: i32) -> Vec<f32>
pub fn pop_ms(&self, ms: i32) -> Vec<f32>
Pop up to ms milliseconds of audio from the ring buffer.
Returns fewer samples if not enough are available.
Sourcepub fn available_samples(&self) -> usize
pub fn available_samples(&self) -> usize
Number of unread samples currently in the ring buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PcmReader
impl !RefUnwindSafe for PcmReader
impl Send for PcmReader
impl Sync for PcmReader
impl Unpin for PcmReader
impl !UnwindSafe for PcmReader
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