pub struct Tts(/* private fields */);
Implementations§
Source§impl Tts
impl Tts
Sourcepub fn new(backend: Backends) -> Result<Tts, Error>
pub fn new(backend: Backends) -> Result<Tts, Error>
Create a new TTS
instance with the specified backend.
pub fn default() -> Result<Tts, Error>
Sourcepub fn supported_features(&self) -> Features
pub fn supported_features(&self) -> Features
Returns the features supported by this TTS engine
Sourcepub fn speak<S: Into<String>>(
&mut self,
text: S,
interrupt: bool,
) -> Result<Option<UtteranceId>, Error>
pub fn speak<S: Into<String>>( &mut self, text: S, interrupt: bool, ) -> Result<Option<UtteranceId>, Error>
Speaks the specified text, optionally interrupting current speech.
Sourcepub fn normal_rate(&self) -> f32
pub fn normal_rate(&self) -> f32
Returns the normal rate for this speech synthesizer.
Sourcepub fn normal_pitch(&self) -> f32
pub fn normal_pitch(&self) -> f32
Returns the normal pitch for this speech synthesizer.
Sourcepub fn min_volume(&self) -> f32
pub fn min_volume(&self) -> f32
Returns the minimum volume for this speech synthesizer.
Sourcepub fn max_volume(&self) -> f32
pub fn max_volume(&self) -> f32
Returns the maximum volume for this speech synthesizer.
Sourcepub fn normal_volume(&self) -> f32
pub fn normal_volume(&self) -> f32
Returns the normal volume for this speech synthesizer.
Sourcepub fn get_volume(&self) -> Result<f32, Error>
pub fn get_volume(&self) -> Result<f32, Error>
Gets the current speech volume.
Sourcepub fn set_volume(&mut self, volume: f32) -> Result<&Self, Error>
pub fn set_volume(&mut self, volume: f32) -> Result<&Self, Error>
Sets the desired speech volume.
Sourcepub fn is_speaking(&self) -> Result<bool, Error>
pub fn is_speaking(&self) -> Result<bool, Error>
Returns whether this speech synthesizer is speaking.
Sourcepub fn on_utterance_begin(
&self,
callback: Option<Box<dyn FnMut(UtteranceId)>>,
) -> Result<(), Error>
pub fn on_utterance_begin( &self, callback: Option<Box<dyn FnMut(UtteranceId)>>, ) -> Result<(), Error>
Called when this speech synthesizer begins speaking an utterance.
Sourcepub fn on_utterance_end(
&self,
callback: Option<Box<dyn FnMut(UtteranceId)>>,
) -> Result<(), Error>
pub fn on_utterance_end( &self, callback: Option<Box<dyn FnMut(UtteranceId)>>, ) -> Result<(), Error>
Called when this speech synthesizer finishes speaking an utterance.
Sourcepub fn on_utterance_stop(
&self,
callback: Option<Box<dyn FnMut(UtteranceId)>>,
) -> Result<(), Error>
pub fn on_utterance_stop( &self, callback: Option<Box<dyn FnMut(UtteranceId)>>, ) -> Result<(), Error>
Called when this speech synthesizer is stopped and still has utterances in its queue.