Struct tts::Tts

source ·
pub struct Tts(/* private fields */);

Implementations§

source§

impl Tts

source

pub fn new(backend: Backends) -> Result<Tts, Error>

Create a new TTS instance with the specified backend.

source

pub fn default() -> Result<Tts, Error>

source

pub fn supported_features(&self) -> Features

Returns the features supported by this TTS engine

source

pub fn speak<S: Into<String>>( &mut self, text: S, interrupt: bool ) -> Result<Option<UtteranceId>, Error>

Speaks the specified text, optionally interrupting current speech.

source

pub fn stop(&mut self) -> Result<&Self, Error>

Stops current speech.

source

pub fn min_rate(&self) -> f32

Returns the minimum rate for this speech synthesizer.

source

pub fn max_rate(&self) -> f32

Returns the maximum rate for this speech synthesizer.

source

pub fn normal_rate(&self) -> f32

Returns the normal rate for this speech synthesizer.

source

pub fn get_rate(&self) -> Result<f32, Error>

Gets the current speech rate.

source

pub fn set_rate(&mut self, rate: f32) -> Result<&Self, Error>

Sets the desired speech rate.

source

pub fn min_pitch(&self) -> f32

Returns the minimum pitch for this speech synthesizer.

source

pub fn max_pitch(&self) -> f32

Returns the maximum pitch for this speech synthesizer.

source

pub fn normal_pitch(&self) -> f32

Returns the normal pitch for this speech synthesizer.

source

pub fn get_pitch(&self) -> Result<f32, Error>

Gets the current speech pitch.

source

pub fn set_pitch(&mut self, pitch: f32) -> Result<&Self, Error>

Sets the desired speech pitch.

source

pub fn min_volume(&self) -> f32

Returns the minimum volume for this speech synthesizer.

source

pub fn max_volume(&self) -> f32

Returns the maximum volume for this speech synthesizer.

source

pub fn normal_volume(&self) -> f32

Returns the normal volume for this speech synthesizer.

source

pub fn get_volume(&self) -> Result<f32, Error>

Gets the current speech volume.

source

pub fn set_volume(&mut self, volume: f32) -> Result<&Self, Error>

Sets the desired speech volume.

source

pub fn is_speaking(&self) -> Result<bool, Error>

Returns whether this speech synthesizer is speaking.

source

pub fn voices(&self) -> Result<Vec<Voice>, Error>

Returns list of available voices.

source

pub fn voice(&self) -> Result<Option<Voice>, Error>

Return the current speaking voice.

source

pub fn set_voice(&mut self, voice: &Voice) -> Result<(), Error>

Set speaking voice.

source

pub fn on_utterance_begin( &self, callback: Option<Box<dyn FnMut(UtteranceId)>> ) -> Result<(), Error>

Called when this speech synthesizer begins speaking an utterance.

source

pub fn on_utterance_end( &self, callback: Option<Box<dyn FnMut(UtteranceId)>> ) -> Result<(), Error>

Called when this speech synthesizer finishes speaking an utterance.

source

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.

source

pub fn screen_reader_available() -> bool

Trait Implementations§

source§

impl Clone for Tts

source§

fn clone(&self) -> Tts

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Drop for Tts

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Tts

source§

impl Sync for Tts

Auto Trait Implementations§

§

impl RefUnwindSafe for Tts

§

impl Unpin for Tts

§

impl UnwindSafe for Tts

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.