VoicePipelinePort

Trait VoicePipelinePort 

Source
pub trait VoicePipelinePort: Send + Sync {
Show 19 methods // Required methods fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<VoiceStatusDto, VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_models<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<VoiceModelsDto, VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn download_stt_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn download_tts_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn download_vad_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_stt<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_tts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_mode<'life0, 'life1, 'async_trait>( &'life0 self, mode: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_voice<'life0, 'life1, 'async_trait>( &'life0 self, voice_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_speed<'life0, 'async_trait>( &'life0 self, speed: f32, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn set_auto_speak<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn unload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn list_devices<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AudioDeviceDto>, VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn start<'life0, 'async_trait>( &'life0 self, mode: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn ptt_start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn ptt_stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn speak<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn stop_speaking<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Port trait for voice data, configuration, and audio I/O operations.

Implemented by VoiceService in gglib-voice. Consumed by VoiceOps in gglib-gui and delegated to by Axum handlers.

§Scope

This trait covers all 19 voice operations:

  • 13 data/config endpoints (no audio hardware required, curl-testable)
  • 6 audio I/O endpoints (start, stop, ptt-start, ptt-stop, speak, stop-speaking)

Required Methods§

Source

fn status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<VoiceStatusDto, VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the current pipeline status (state machine, loaded models, etc.).

Source

fn list_models<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<VoiceModelsDto, VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the full model catalog with per-model download status.

Source

fn download_stt_model<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Download an STT model archive by ID (e.g. "base.en").

Source

fn download_tts_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Download the TTS model archive.

Source

fn download_vad_model<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Download the Silero VAD model.

Source

fn load_stt<'life0, 'life1, 'async_trait>( &'life0 self, model_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load a downloaded STT model into the pipeline by ID.

Source

fn load_tts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load the downloaded TTS model into the pipeline.

Source

fn set_mode<'life0, 'life1, 'async_trait>( &'life0 self, mode: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the interaction mode ("ptt" | "vad").

Source

fn set_voice<'life0, 'life1, 'async_trait>( &'life0 self, voice_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the TTS voice by ID.

Source

fn set_speed<'life0, 'async_trait>( &'life0 self, speed: f32, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the TTS playback speed (1.0 = normal).

Source

fn set_auto_speak<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Enable or disable automatic TTS for LLM responses.

Source

fn unload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop audio I/O and release all model memory.

Source

fn list_devices<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<AudioDeviceDto>, VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List available audio input devices.

Source

fn start<'life0, 'async_trait>( &'life0 self, mode: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start the voice pipeline audio I/O.

mode overrides the current interaction mode for this session ("ptt" | "vad"). When None, the previously configured mode is used.

Returns VoicePortError::NotInitialised if no STT model is loaded. Returns VoicePortError::AlreadyActive if the pipeline is already running.

Source

fn stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop audio I/O, releasing mic + playback resources, but keep STT/TTS models warm so the user can restart without a reload delay.

Source

fn ptt_start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Begin PTT recording (user pressed the talk button).

Returns VoicePortError::NotInitialised if the pipeline is not active.

Source

fn ptt_stop<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

End PTT recording and transcribe the captured audio.

Returns the transcript text (empty string if no speech was detected).

Source

fn speak<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Synthesize text via TTS and stream the audio to the speaker.

This is an asynchronous operation: implementations may perform synthesis and playback work while this future is pending. Callers MUST NOT assume that it returns immediately after dispatch. VoiceEvent::SpeakingStarted / SpeakingFinished are emitted via the SSE event bus to report speaking lifecycle events.

Source

fn stop_speaking<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VoicePortError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Interrupt any active TTS playback immediately.

Implementors§