pub trait AudioCapture:
Send
+ Sync
+ 'static {
// Required method
fn start(
&self,
mode: RecordingMode,
stop: StopSignal,
) -> Result<RecordingReader, CaptureError>;
}Available on non-
target_family=wasm only.Expand description
A source of canonical 16 kHz mono audio. Each implementation bounds how long a recording runs.
Required Methods§
Sourcefn start(
&self,
mode: RecordingMode,
stop: StopSignal,
) -> Result<RecordingReader, CaptureError>
fn start( &self, mode: RecordingMode, stop: StopSignal, ) -> Result<RecordingReader, CaptureError>
Starts capturing and returns a reader for the new recording. Returns once capture is live or the recording has ended, and fails if it ended in error.
A live source writes from its own thread and polls stop there, so
the caller can transcribe while audio arrives.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<C: AudioCapture> AudioCapture for Arc<C>
One backend serves every operation that records, so the operations share
it rather than each opening a microphone of their own.
impl<C: AudioCapture> AudioCapture for Arc<C>
One backend serves every operation that records, so the operations share it rather than each opening a microphone of their own.
fn start( &self, mode: RecordingMode, stop: StopSignal, ) -> Result<RecordingReader, CaptureError>
Implementors§
impl AudioCapture for Microphone
Available on crate feature
microphone only.