SpeechOutputState

Speech output on the platform text-to-speech engine (Android TextToSpeech): reads a message aloud, or a reply sentence by sentence while it streams (enqueue). One utterance group is active at a time, named by speakingId; stop ends it.

Properties

Link copied to clipboard
var engines: List<TextToSpeech.EngineInfo>

The text-to-speech engines installed on the device (for a settings screen).

Link copied to clipboard

False until the engine is ready, and when the device has none.

Link copied to clipboard

The id of what is being read (e.g. a message id), or null when silent.

Link copied to clipboard
var voices: List<Voice>

The voices of the engine in use, once it is ready (for a settings screen).

Functions

Link copied to clipboard
fun enqueue(id: String, text: String, locale: Locale? = null, onDone: () -> Unit? = null)

Add text after what id is already reading (a streaming reply, sentence by sentence).

Link copied to clipboard

Whether id still has text queued or playing.

Link copied to clipboard
fun speak(id: String, text: String, locale: Locale? = null, onDone: () -> Unit? = null)

Read text (plain text, see speakableText) as id, replacing whatever is being read.

Link copied to clipboard
fun stop()