pub struct AudioCapture { /* private fields */ }Expand description
Stateful default-device audio capture session.
Implementations§
Source§impl AudioCapture
impl AudioCapture
Sourcepub fn open(runtime: &Runtime, config: AudioCaptureConfig) -> Result<Self>
pub fn open(runtime: &Runtime, config: AudioCaptureConfig) -> Result<Self>
Open the default input device. The returned session is initially stopped.
Sourcepub fn start(&mut self) -> Result<()>
pub fn start(&mut self) -> Result<()>
Start capture and reset frame indices, timestamps, and drop counters.
Sourcepub fn stop(&mut self) -> Result<()>
pub fn stop(&mut self) -> Result<()>
Stop callback delivery without releasing the device.
On backends without hardware pause, the stream remains active but its
frames are discarded until restart. Use close to release the device.
Sourcepub fn poll(&mut self, max_frames: u32) -> Option<AudioCaptureChunk>
pub fn poll(&mut self, max_frames: u32) -> Option<AudioCaptureChunk>
Return the next contiguous frame run without blocking.
A physical capture gap caused by a full ring ends the current chunk. The next call begins at the first frame after that gap.
Sourcepub fn close(&mut self) -> Result<()>
pub fn close(&mut self) -> Result<()>
Stop capture and release the device at an explicit result-bearing boundary.
pub fn is_open(&self) -> bool
pub fn is_started(&self) -> bool
pub fn dropped_frame_count(&self) -> u64
pub fn device_error_count(&self) -> u64
Trait Implementations§
Source§impl Drop for AudioCapture
impl Drop for AudioCapture
Auto Trait Implementations§
impl !Freeze for AudioCapture
impl !RefUnwindSafe for AudioCapture
impl !Send for AudioCapture
impl !Sync for AudioCapture
impl !UnwindSafe for AudioCapture
impl Forget for AudioCapture
impl Move for AudioCapture
impl Unpin for AudioCapture
impl UnsafeUnpin for AudioCapturewhere
*const RcInner<RefCell<RuntimeState>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<RuntimeState>>>: UnsafeUnpin,
Stream: UnsafeUnpin,
*const ArcInner<CaptureShared> is !null: UnsafeUnpin,
PhantomData<ArcInner<CaptureShared>>: UnsafeUnpin,
*const RingBuffer<CaptureFrame> is !null: UnsafeUnpin,
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