Yokan / rebuild
Course 1 8624561

TextToSpeechService.kt

composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/services/tts/TextToSpeechService.kt

implementation22 lines
1package eu.friedcutlet.yokan.services.tts23data class TextToSpeechRequest(4    val language: String? = null,5    val voice: String? = null,6    val speechRate: Double = 0.5,7    val pitch: Double = 1.0,8)910interface TextToSpeechService {11    suspend fun voices(language: String? = null): List<String>12    suspend fun speak(13        text: String,14        request: TextToSpeechRequest = TextToSpeechRequest(),15        onProgress: (startOffset: Int, endOffset: Int) -> Unit = { _, _ -> },16    )17    suspend fun stop()18    /** Release native resources after joined calls; implementations may retry a failed release. */19    suspend fun closeAndJoin() = stop()20}2122expect fun createPlatformTextToSpeechService(): TextToSpeechService23

Search chapters, reference and source filenames.