CaptureHandle

Struct CaptureHandle 

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

Handle for receiving AEC-processed audio samples. Capture stops automatically when dropped (channel disconnect stops backend).

Implementations§

Source§

impl CaptureHandle

Source

pub fn new(config: AecConfig) -> Result<Self, AecError>

Create and start a new AEC capture stream. Audio samples are received via the async recv() or blocking recv_blocking() methods.

Source

pub async fn recv(&self) -> Option<Result<Vec<f32>, AecError>>

Receive audio samples asynchronously. Returns None when the capture stream is closed.

Source

pub fn recv_blocking(&self) -> Option<Result<Vec<f32>, AecError>>

Receive audio samples, blocking the current thread. Returns None when the capture stream is closed.

Source

pub fn try_recv(&self) -> Option<Result<Vec<f32>, AecError>>

Try to receive audio samples without blocking. Returns None if no samples are available or stream is closed.

Source

pub fn native_sample_rate(&self) -> u32

Get the actual sample rate being used by the backend. May differ from requested rate if resampling is active.

Source

pub fn play_audio( &self, samples: Vec<f32>, sample_rate: u32, ) -> Result<(), AecError>

Play audio through the same engine used for capture. This enables AEC to cancel the played audio from the recording. Audio is played at the specified sample rate.

Source

pub fn start_playback_stream( &self, sample_rate: u32, ) -> Result<PlaybackStreamHandle, AecError>

Start a streaming playback session. Returns a handle for sending audio chunks incrementally. The stream ends when the handle is dropped.

Auto Trait Implementations§

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.