[][src]Struct ttspico::Engine

pub struct Engine { /* fields omitted */ }

A Pico TTS engine.

Methods

impl Engine[src]

pub fn put_text(
    &mut self,
    utf8_text: impl AsRef<[u8]>
) -> Result<usize, PicoError>
[src]

Puts UTF-8 text to be spoken into the TTS engine. Returns the number of bytes of utf8_text that were in fact put in the engine (or a PicoError on failure).

Put null terminators (\0) in the text to flush the engine, forcing speech generation.

See

ttspico_sys::pico_putTextUtf8.

pub fn flush(&mut self) -> Result<usize, PicoError>[src]

Flushes the TTS engine, forcing speech generation. Equivalent to `self.put_text("\0").

pub fn reset(&mut self, mode: EngineResetMode) -> Result<(), PicoError>[src]

Resets the TTS engine according to mode.

See

ttspico_sys::pico_resetEngine.

pub fn get_data(
    &mut self,
    buf: impl AsMut<[i16]>
) -> Result<(usize, EngineStatus), PicoError>
[src]

Generates speech audio from the text input via put_text, outputting to buf.
Returns either a <number of samples generated, EngineStatus after stepping> pair (on success) or a PicoError (on failure).

Output data is encoded as 16-bit signed PCM, at a sample rate of 16kHz. buf should have length <= PICO_INT16_MAX.

See

ttspico_sys::pico_getData.

Trait Implementations

impl Debug for Engine[src]

impl Eq for Engine[src]

impl PartialEq<Engine> for Engine[src]

impl Send for Engine[src]

Auto Trait Implementations

impl !RefUnwindSafe for Engine

impl !Sync for Engine

impl Unpin for Engine

impl !UnwindSafe for Engine

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.