gpui_component/speech/
mod.rs1mod button;
14mod level;
15mod recognizer;
16mod state;
17mod waveform;
18
19#[cfg(all(feature = "speech", not(target_family = "wasm")))]
20mod microphone;
21#[cfg(all(feature = "speech", not(target_family = "wasm")))]
22mod system;
23
24use std::rc::Rc;
25
26pub use button::SpeechButton;
27#[cfg(all(feature = "speech", not(target_family = "wasm")))]
28pub use microphone::Microphone;
29pub use recognizer::{
30 AudioFormat, AudioInput, AudioSink, RecognitionSession, SpeechError, SpeechRecognizer,
31 SpeechSink,
32};
33pub use state::{SpeechEvent, SpeechState, SpeechStatus};
34#[cfg(all(feature = "speech", not(target_family = "wasm")))]
35pub use system::SystemRecognizer;
36pub use waveform::SpeechWaveform;
37
38fn default_input() -> Option<Rc<dyn AudioInput>> {
40 #[cfg(all(feature = "speech", not(target_family = "wasm")))]
41 return Some(Rc::new(Microphone::default()));
42 #[allow(unreachable_code)]
43 None
44}
45
46fn system_recognizer() -> Option<Rc<dyn SpeechRecognizer>> {
48 #[cfg(all(feature = "speech", any(target_os = "macos", target_os = "windows")))]
49 return Some(Rc::new(SystemRecognizer::new()));
50 #[allow(unreachable_code)]
51 None
52}