Skip to main content

AudioInput

Trait AudioInput 

Source
pub trait AudioInput: 'static {
    // Required method
    fn start(
        &self,
        format: AudioFormat,
        sink: AudioSink,
        cx: &mut App,
    ) -> Result<Subscription, SpeechError>;
}
Expand description

A source of audio for a SpeechState, such as the microphone.

Enable the speech feature for the built-in Microphone, or implement this trait to feed audio from elsewhere, e.g. a file in tests.

Required Methods§

Source

fn start( &self, format: AudioFormat, sink: AudioSink, cx: &mut App, ) -> Result<Subscription, SpeechError>

Start capturing format audio into sink.

Capture runs until the returned Subscription is dropped.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: AudioInput + ?Sized> AudioInput for Rc<T>

Source§

fn start( &self, format: AudioFormat, sink: AudioSink, cx: &mut App, ) -> Result<Subscription, SpeechError>

Implementors§