pub struct AudioCapture { /* private fields */ }Expand description
Audio capture device (microphone).
Implementations§
Source§impl AudioCapture
impl AudioCapture
Sourcepub fn start() -> Result<Self>
pub fn start() -> Result<Self>
Start capturing audio from the default input device.
Samples are buffered internally and can be retrieved with read_samples().
Sourcepub fn read_samples(&self, target_rate: u32, max_samples: usize) -> Vec<i16>
pub fn read_samples(&self, target_rate: u32, max_samples: usize) -> Vec<i16>
Read samples from the capture buffer, resampled to the target rate.
Returns up to max_samples samples at the target sample rate.
Sourcepub fn device_rate(&self) -> u32
pub fn device_rate(&self) -> u32
Get the native device sample rate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioCapture
impl !RefUnwindSafe for AudioCapture
impl Send for AudioCapture
impl Sync for AudioCapture
impl Unpin for AudioCapture
impl UnsafeUnpin for AudioCapture
impl !UnwindSafe for AudioCapture
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