/// /// HybridTextToSpeechSpec.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo /// package com.margelo.nitro.nitrotexttospeech import android.util.Log import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip import com.margelo.nitro.core.* /** * A Kotlin class representing the TextToSpeech HybridObject. * Implement this abstract class to create Kotlin-based instances of TextToSpeech. */ @DoNotStrip @Keep @Suppress("RedundantSuppression", "KotlinJniMissingFunction", "PropertyName", "RedundantUnitReturnType", "unused") abstract class HybridTextToSpeechSpec: HybridObject() { @DoNotStrip private var mHybridData: HybridData = initHybrid() init { // Pass this `HybridData` through to it's base class, // to represent inheritance to JHybridObject on C++ side super.updateNative(mHybridData) } /** * Call from a child class to initialize HybridData with a child. */ override fun updateNative(hybridData: HybridData) { mHybridData = hybridData } // Properties // Methods @DoNotStrip @Keep abstract fun speak(text: String, options: TextToSpeechOptions?): Promise @DoNotStrip @Keep abstract fun stop(): Promise @DoNotStrip @Keep abstract fun pause(): Promise @DoNotStrip @Keep abstract fun resume(): Promise @DoNotStrip @Keep abstract fun getVoices(): Promise> @DoNotStrip @Keep abstract fun addEventListener(event: EventName, listener: (word: String?) -> Unit): () -> Unit @DoNotStrip @Keep private fun addEventListener(event: EventName, listener: Func_void_std__optional_std__string_): () -> Unit { val __result = addEventListener(event, listener.toLambda()) return __result } private external fun initHybrid(): HybridData companion object { private const val TAG = "HybridTextToSpeechSpec" init { try { Log.i(TAG, "Loading NitroTextToSpeech C++ library...") System.loadLibrary("NitroTextToSpeech") Log.i(TAG, "Successfully loaded NitroTextToSpeech C++ library!") } catch (e: Error) { Log.e(TAG, "Failed to load NitroTextToSpeech C++ library! Is it properly installed and linked? " + "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e) throw e } } } }