pub struct CollectorSink { /* private fields */ }Expand description
An AudioSink that collects all samples into an internal buffer.
Primarily intended for testing – you can inspect the accumulated samples after synthesis is complete.
Implementations§
Source§impl CollectorSink
impl CollectorSink
Sourcepub fn sample_rate(&self) -> Option<u32>
pub fn sample_rate(&self) -> Option<u32>
Return the sample rate (from the first chunk), if any.
Sourcepub fn is_finalized(&self) -> bool
pub fn is_finalized(&self) -> bool
Whether finalize has been called.
Sourcepub fn into_samples(self) -> Vec<i16>
pub fn into_samples(self) -> Vec<i16>
Consume self and return the collected samples.
Trait Implementations§
Source§impl AudioSink for CollectorSink
impl AudioSink for CollectorSink
Source§fn write_chunk(
&mut self,
samples: &[i16],
sample_rate: u32,
) -> Result<(), PiperError>
fn write_chunk( &mut self, samples: &[i16], sample_rate: u32, ) -> Result<(), PiperError>
Called for each audio chunk produced by the synthesizer.
Auto Trait Implementations§
impl Freeze for CollectorSink
impl RefUnwindSafe for CollectorSink
impl Send for CollectorSink
impl Sync for CollectorSink
impl Unpin for CollectorSink
impl UnsafeUnpin for CollectorSink
impl UnwindSafe for CollectorSink
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