pub struct MemoryPcmSource { /* private fields */ }Expand description
In-memory PcmSource that replays a fixed queue of buffers.
This is the deterministic test backend for the source side of the PCM fabric: it hands out the buffers it was constructed with, in order, then reports end-of-stream.
§Examples
use sim_lib_stream_audio::{MemoryPcmSource, PcmBuffer, PcmSource, PcmSpec};
let spec = PcmSpec::i16(1, 48_000)?;
let buffer = PcmBuffer::i16(spec, 2, vec![1, 2])?;
let mut source = MemoryPcmSource::new(spec, vec![buffer])?;
assert_eq!(source.remaining(), 1);
assert!(source.read_buffer()?.is_some());
assert!(source.read_buffer()?.is_none());Implementations§
Trait Implementations§
Source§impl Clone for MemoryPcmSource
impl Clone for MemoryPcmSource
Source§fn clone(&self) -> MemoryPcmSource
fn clone(&self) -> MemoryPcmSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MemoryPcmSource
impl Debug for MemoryPcmSource
Auto Trait Implementations§
impl Freeze for MemoryPcmSource
impl RefUnwindSafe for MemoryPcmSource
impl Send for MemoryPcmSource
impl Sync for MemoryPcmSource
impl Unpin for MemoryPcmSource
impl UnsafeUnpin for MemoryPcmSource
impl UnwindSafe for MemoryPcmSource
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