All Downloads are FREE. Search and download functionalities are using the official Maven repository.

desktopMain.nl.marc_apps.tts.TextToSpeech.kt Maven / Gradle / Ivy

package nl.marc_apps.tts

import androidx.compose.runtime.*
import nl.marc_apps.tts.experimental.ExperimentalDesktopTarget

@ExperimentalDesktopTarget
@Composable
actual fun rememberTextToSpeechOrNull(requestedEngine: TextToSpeechEngine): TextToSpeechInstance? {
    var textToSpeech by remember { mutableStateOf(null) }

    LaunchedEffect(Unit) {
        textToSpeech = TextToSpeechFactory().createOrNull()
    }

    DisposableEffect(Unit) {
        onDispose {
            textToSpeech?.close()
            textToSpeech = null
        }
    }

    return textToSpeech
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy