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