pub struct ManualSink { /* private fields */ }Expand description
A sink with no device. ManualSink::render_block plays the part of the device’s callback, so a test decides exactly when and how much
audio is pulled. It accepts any valid config.
Implementations§
Source§impl ManualSink
impl ManualSink
pub fn is_running(&self) -> bool
pub fn stats(&self) -> &SinkStats
Trait Implementations§
Source§impl AudioSink for ManualSink
impl AudioSink for ManualSink
Source§fn default_config(&self) -> Result<SinkConfig, SinkError>
fn default_config(&self) -> Result<SinkConfig, SinkError>
The format the device prefers, to ask for when a request is
SinkError::UnsupportedConfig.Source§fn start(
&mut self,
config: SinkConfig,
render: RenderFn,
) -> Result<SinkHandle, SinkError>
fn start( &mut self, config: SinkConfig, render: RenderFn, ) -> Result<SinkHandle, SinkError>
Starts the stream.
render is called on the audio thread with a buffer to fill. The stream stops when the handle is dropped.
A sink that cannot run the exact config returns SinkError::UnsupportedConfig instead of running at another rate, so the render
function never has to guess its format.Source§impl Clone for ManualSink
impl Clone for ManualSink
Auto Trait Implementations§
impl Forget for ManualSink
impl Freeze for ManualSink
impl Move for ManualSink
impl RefUnwindSafe for ManualSinkwhere
Atomic<usize>: RefUnwindSafe,
Mutex<Option<Running>>: RefUnwindSafe,
Atomic<u64>: RefUnwindSafe,
impl Send for ManualSink
impl Sync for ManualSink
impl Unpin for ManualSink
impl UnsafeUnpin for ManualSinkwhere
*const ArcInner<Mutex<Option<Running>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<Option<Running>>>>: UnsafeUnpin,
*const ArcInner<Atomic<u64>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Atomic<u64>>>: UnsafeUnpin,
impl UnwindSafe for ManualSink
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