Public Member Functions | |
RTVoiceAndroidBridge (Object appContext) | |
Static Public Member Functions | |
static boolean | isSSMLSupported () |
static boolean | isWorking () |
static boolean | isInitialized () |
static void | Shutdown () |
static void | SpeakNative (String speechText, float rate, float pitch, float inpVolume, String voiceName) |
static void | StopNative () |
static String | Speak (String speechText, float rate, float pitch, String voiceName, String outputFile) |
static String[] | GetVoices () |
static String[] | GetEngines () |
static void | SetupEngine (String engine) |
Detailed Description
RTVoiceAndroidBridge.java Version 2022.2.1
Acts as a handler for all TTS functions called by RT-Voice on Android.
© 2016-2022 crosstales LLC (https://www.crosstales.com)
Constructor & Destructor Documentation
◆ RTVoiceAndroidBridge()
com.crosstales.RTVoice.RTVoiceAndroidBridge.RTVoiceAndroidBridge | ( | Object | appContext | ) |
Constructor for the RTVoiceAndroidBridge class. The appContext must contain the application context so we can initialize the TTS engine.
- Parameters
-
appContext Application context of the Unity application
Member Function Documentation
◆ GetEngines()
|
static |
Returns the available TTS engines.
- Returns
- String[] with the available TTS engines, like the default "com.google.android.tts"
◆ GetVoices()
|
static |
Checks if the TTS engine is initialized:
- if SDK >= M: Looks for installed voices on the Android device and use their names to generate a for RTVoice readable list.
- if SDK < M: Looks for installed locales on the Android device, check each if they have an available voice to them and use their names and languages to generate a for RTVoice readable list.
It returns a String array when the tasks are done, not immediately.
- Returns
- String[] with the available voices/locales
◆ isInitialized()
|
static |
Checks if the engine has been instantiated by calling the boolean "initialized".
Returns immediately
- Returns
- the boolean signifying if the engine has been instantiated or not
◆ isWorking()
|
static |
Checks if the TTS engine is currently busy by calling the boolean "working".
Returns immediately
- Returns
- the boolean signifying if the engine is busy or not
◆ SetupEngine()
|
static |
Set a specific TTS engine.
- Parameters
-
engine TTS engine to be used
- Returns
- String[] with the available TTS engines
◆ Shutdown()
|
static |
If the TTS engine is instantiated, shut it down and set boolean "initialized" to false. Log the result.
Logs after the TTS engine has been shut down or immediately, if the TTS engine is not instantiated.
◆ Speak()
|
static |
Generates audio and starts the private task "generateAudio".
This method generates multiple logs in Log.d regarding its current state.
- Parameters
-
speechText the text that is supposed to be read. rate the rate at which the text is supposed to be read. pitch the pitch that gets applied to the Locale/Voice reading the text. voiceName the name of the Locale/Voice that is supposed to read the text. outputFile the target path
- Returns
- String with the .wav-File path
◆ SpeakNative()
|
static |
Starts the private task "speakNative".
This method generates multiple logs in Log.d regarding its current state.
- Parameters
-
speechText the text that is supposed to be read. rate the rate at which the text is supposed to be read. pitch the pitch that gets applied to the Locale/Voice reading the text. inpVolume the volume that gets applied to the Locale/Voice reading the text. voiceName the name of the Locale/Voice reading the text.
◆ StopNative()
|
static |
Checks if the TTS engine is busy. If it's busy, stop the engine.
This method generates a log in Log.d on call and on exit.
The documentation for this class was generated from the following file:
- C:/Users/slaub/Unity/assets/RTVoice/RTVoicePro/Assets/Plugins/crosstales/RTVoice/Libraries/Android/RTVoiceAndroidBridge.java