Skip to main content

AudioCapture

Struct AudioCapture 

Source
pub struct AudioCapture { /* private fields */ }
Expand description

Stateful default-device audio capture session.

Implementations§

Source§

impl AudioCapture

Source

pub fn open(runtime: &Runtime, config: AudioCaptureConfig) -> Result<Self>

Open the default input device. The returned session is initially stopped.

Source

pub fn start(&mut self) -> Result<()>

Start capture and reset frame indices, timestamps, and drop counters.

Source

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.

Source

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.

Source

pub fn close(&mut self) -> Result<()>

Stop capture and release the device at an explicit result-bearing boundary.

Source

pub fn is_open(&self) -> bool

Source

pub fn is_started(&self) -> bool

Source

pub fn dropped_frame_count(&self) -> u64

Source

pub fn device_error_count(&self) -> u64

Trait Implementations§

Source§

impl Drop for AudioCapture

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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
where Rc<RefCell<RuntimeState>>: Unpin, Stream: Unpin, Arc<CaptureShared>: Unpin, *const RingBuffer<CaptureFrame> is !null: Unpin,

§

impl UnsafeUnpin for AudioCapture
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.