pub struct MockSource { /* private fields */ }Expand description
An AudioSource that yields a predetermined list of chunks, then None.
Implementations§
Source§impl MockSource
impl MockSource
Sourcepub fn new(
format: AudioFormat,
chunks: impl IntoIterator<Item = Arc<[f32]>>,
) -> Self
pub fn new( format: AudioFormat, chunks: impl IntoIterator<Item = Arc<[f32]>>, ) -> Self
A source that yields each of chunks in order (restamped with format),
then None.
Sourcepub fn ramp(format: AudioFormat, chunk_frames: usize, chunks: usize) -> Self
pub fn ramp(format: AudioFormat, chunk_frames: usize, chunks: usize) -> Self
A source whose entire output is the ramp 0.0, 1.0, 2.0, … — one value
per sample — split into chunks chunks of chunk_frames samples each.
The values are exact and monotonic, so a passthrough test can flatten the sink’s output and compare it to the same ramp.
Trait Implementations§
Source§impl AudioSource for MockSource
impl AudioSource for MockSource
Source§fn format(&self) -> AudioFormat
fn format(&self) -> AudioFormat
The format of the chunks this source yields. Fixed for the source’s life.
Source§fn next_chunk<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<AudioChunk>, AudioError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next_chunk<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<AudioChunk>, AudioError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Await the next chunk. Read more
Auto Trait Implementations§
impl Freeze for MockSource
impl RefUnwindSafe for MockSource
impl Send for MockSource
impl Sync for MockSource
impl Unpin for MockSource
impl UnsafeUnpin for MockSource
impl UnwindSafe for MockSource
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