package eu.friedcutlet.yokan.services.tts data class TextToSpeechRequest( val language: String? = null, val voice: String? = null, val speechRate: Double = 0.5, val pitch: Double = 1.0, ) interface TextToSpeechService { suspend fun voices(language: String? = null): List suspend fun speak( text: String, request: TextToSpeechRequest = TextToSpeechRequest(), onProgress: (startOffset: Int, endOffset: Int) -> Unit = { _, _ -> }, ) suspend fun stop() /** Release native resources after joined calls; implementations may retry a failed release. */ suspend fun closeAndJoin() = stop() } expect fun createPlatformTextToSpeechService(): TextToSpeechService