pub struct ResamplingCons<T: Sample> { /* private fields */ }
Expand description
The consumer end of a realtime-safe spsc channel for sending samples across streams.
If the input and output samples rates differ, then this will automatically resample the input stream to match the output stream. If the sample rates match, then no resampling will occur.
Internally this uses the ringbuf
crate.
Implementations§
Source§impl<T: Sample> ResamplingCons<T>
impl<T: Sample> ResamplingCons<T>
Sourcepub fn num_channels(&self) -> NonZeroUsize
pub fn num_channels(&self) -> NonZeroUsize
The number of channels configured for this stream.
Sourcepub fn max_block_frames(&self) -> usize
pub fn max_block_frames(&self) -> usize
The maximum number of frames that can be read in a single call to
ResamplingCons::read
.
Sourcepub fn read(&mut self, output: &mut [T]) -> ReadStatus
pub fn read(&mut self, output: &mut [T]) -> ReadStatus
Read from the channel and store the results into the output buffer in interleaved format.
§Panics
Panics if the number of frames in output
is greater than
ResamplingCons::max_block_frames
.
Auto Trait Implementations§
impl<T> !Freeze for ResamplingCons<T>
impl<T> !RefUnwindSafe for ResamplingCons<T>
impl<T> Send for ResamplingCons<T>
impl<T> !Sync for ResamplingCons<T>
impl<T> Unpin for ResamplingCons<T>where
T: Unpin,
impl<T> !UnwindSafe for ResamplingCons<T>
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