Skip to content

//readium-navigator/org.readium.r2.navigator.media3.tts/TtsEngine

TtsEngine

[androidJvm]\ interface TtsEngine<S : TtsEngine.Settings, P : TtsEngine.Preferences<P>, E : TtsEngine.Error, V : TtsEngine.Voice> : Configurable<S, P> , Closeable

A text-to-speech engine synthesizes text utterances (e.g. sentence).

Types

Name Summary
Error [androidJvm]
interface Error
Marker interface for the errors that the TtsEngine returns.
Listener [androidJvm]
interface Listener<E : TtsEngine.Error>
TTS engine callbacks.
Preferences [androidJvm]
interface Preferences<P : Configurable.Preferences<P>> : Configurable.Preferences<P>
RequestId [androidJvm]
@JvmInline
value class RequestId(val id: String)
An id to identify a request to speak.
Settings [androidJvm]
interface Settings : Configurable.Settings
Voice [androidJvm]
interface Voice

Functions

Name Summary
close [androidJvm]
abstract fun close()
setListener [androidJvm]
abstract fun setListener(listener: TtsEngine.Listener<E>?)
Sets a new listener or removes the current one.
speak [androidJvm]
abstract fun speak(requestId: TtsEngine.RequestId, text: String, language: Language?)
Enqueues a new speak request.
stop [androidJvm]
abstract fun stop()
Stops the TtsEngine.
submitPreferences [androidJvm]
abstract fun submitPreferences(preferences: P)
Submits a new set of Preferences to update the current Settings.

Properties

Name Summary
settings [androidJvm]
abstract val settings: StateFlow<S>
Current Settings values.
voices [androidJvm]
abstract val voices: Set<V>
Sets of voices available with this TtsEngine.

Inheritors

Name
AndroidTtsEngine