TtsSynthesizer

interface TtsSynthesizer

Base interface used for implementing TTS speech synthesizers. A ITtsSynthesizer maintains a queue of ITtsUtteranceData and manages its playback. A newly created TtsSynthesizer is in paused state, has its volume set to 1.0 and playback rate set to 1.0.

The framework provides a default implementation based on the Android Text to speech API android.speech.tts.TextToSpeech. See ColibrioTtsSynthesizer for more information.

Functions

Link copied to clipboard
abstract fun addUtterance(speechData: TtsUtteranceData)

Add the utterance to the queue of utterances to speak.

Link copied to clipboard
abstract fun clearAndPause()

The implementation must stop any current playing utterance and set itself in paused state. It should then clear the queue of utterances to speak.

Link copied to clipboard
abstract fun destroy()

Destroys this instance. The synthesizer will clear the utterance queue and set itself in paused state. The reference to any callbacks passed with init() is released.

Link copied to clipboard
abstract fun init(callbacks: TtsSynthesizerCallbacks)

Called before any other method to register a callbacks instance used for reporting progress, etc.

Link copied to clipboard
abstract fun pause()

Will be called by the SyncMediaPlayer when it should pause playback.

Link copied to clipboard
abstract fun play()

Resume the playback of the current active utterance if any exists, otherwise the next utterance from the utterance queue. The implementation must use callbacks.onUtteranceEnd() when each utterance has finished speaking.

Link copied to clipboard
abstract fun setMuted(muted: Boolean)

Sets if playback should be muted. When called with false, the synthesizer should unmute and use the playback volume last set by setVolume.

Link copied to clipboard
abstract fun setPlaybackRate(playbackRate: Double)

Will be called by the SyncMediaPlayer when its playbackRate has been changed.

Link copied to clipboard
abstract fun setVolume(volume: Double)

Will be called by the SyncMediaPlayer when its volume has been changed.

Inheritors

Link copied to clipboard