ColibrioTtsSynthesizer

A TtsSynthesizer implementation based on the Android Text to speech API android.speech.tts.TextToSpeech.

Provided so that you can get default text-to-speech behaviour without writing your own TtsSynthesizer: construct it with a TextToSpeech instance and hand it to the reading system.

To customize the language and voice used, please use setColibrioTtsSynthesizerConfigurationListener. See ColibrioTtsSynthesizerConfigurationListener for further details.

Constructors

Link copied to clipboard
constructor(textToSpeech: TextToSpeech)

Creates a ColibrioTtsSynthesizer backed by the given Android TextToSpeech instance.

Functions

Link copied to clipboard
open override fun addUtterance(speechData: TtsUtteranceData)

Add the utterance to the queue of utterances to speak.

Link copied to clipboard
open override 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
open override 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
open override fun init(callbacks: TtsSynthesizerCallbacks)

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

Link copied to clipboard
open override fun pause()

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

Link copied to clipboard
open override 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
open override 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
open override fun setPlaybackRate(playbackRate: Double)

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

Link copied to clipboard
open override fun setVolume(volume: Double)

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