pub struct Engine { /* private fields */ }Implementations§
Source§impl Engine
impl Engine
pub fn new( cfg: Config, synth: Box<dyn Synthesizer>, sink: Box<dyn AudioSink>, ) -> Self
pub fn is_shutdown(&self) -> bool
pub fn handle(&mut self, cmd: Command)
Sourcepub fn submit(
&mut self,
text: String,
opts: SayOpts,
) -> Result<Option<u64>, String>
pub fn submit( &mut self, text: String, opts: SayOpts, ) -> Result<Option<u64>, String>
Submit text for synthesis, returning the queued utterance’s id on
acceptance, None if accepted but not queued (muted or empty after
cleanup), or the rejection reason on failure. This is the synchronous
answer a caller gets back for its own submission – distinct from
error/state, which describe the engine as a whole and must not be
disturbed by a rejection that has nothing to do with whatever else is
legitimately in flight (see the busy check below).
Returns Ok(Some(id)) if the text was queued for synthesis.
Returns Ok(None) if the submission was accepted but nothing was
queued (muted, or empty after cleanup). This is not an error.
Returns Err(reason) if the submission was rejected (e.g. text too long).
handle(Command::Say { .. }) calls this and discards the result, so
the existing command path is unchanged for callers that do not care.
A D-Bus Say method or a CLI entry point should call this directly
to learn whether its own submission was accepted and queued.
Sourcepub fn replace_sink(&mut self, sink: Box<dyn AudioSink>)
pub fn replace_sink(&mut self, sink: Box<dyn AudioSink>)
Swap in a fresh sink after a device failure, clearing the error.
The daemon calls this when it manages to reacquire the audio device. The queue was cleared when the failure surfaced, so this returns the engine to a clean idle state rather than resuming a half-played utterance whose audio is gone.