com.crosstales.RTVoice.RTVoiceAndroidBridge Class Reference

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
appContextApplication context of the Unity application

Member Function Documentation

◆ GetEngines()

static String [] com.crosstales.RTVoice.RTVoiceAndroidBridge.GetEngines ( )
static

Returns the available TTS engines.

Returns
String[] with the available TTS engines, like the default "com.google.android.tts"

◆ GetVoices()

static String [] com.crosstales.RTVoice.RTVoiceAndroidBridge.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 boolean com.crosstales.RTVoice.RTVoiceAndroidBridge.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 boolean com.crosstales.RTVoice.RTVoiceAndroidBridge.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 void com.crosstales.RTVoice.RTVoiceAndroidBridge.SetupEngine ( String  engine)
static

Set a specific TTS engine.

Parameters
engineTTS engine to be used
Returns
String[] with the available TTS engines

◆ Shutdown()

static void com.crosstales.RTVoice.RTVoiceAndroidBridge.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 String com.crosstales.RTVoice.RTVoiceAndroidBridge.Speak ( String  speechText,
float  rate,
float  pitch,
String  voiceName,
String  outputFile 
)
static

Generates audio and starts the private task "generateAudio".

This method generates multiple logs in Log.d regarding its current state.

Parameters
speechTextthe text that is supposed to be read.
ratethe rate at which the text is supposed to be read.
pitchthe pitch that gets applied to the Locale/Voice reading the text.
voiceNamethe name of the Locale/Voice that is supposed to read the text.
outputFilethe target path
Returns
String with the .wav-File path

◆ SpeakNative()

static void com.crosstales.RTVoice.RTVoiceAndroidBridge.SpeakNative ( String  speechText,
float  rate,
float  pitch,
float  inpVolume,
String  voiceName 
)
static

Starts the private task "speakNative".

This method generates multiple logs in Log.d regarding its current state.

Parameters
speechTextthe text that is supposed to be read.
ratethe rate at which the text is supposed to be read.
pitchthe pitch that gets applied to the Locale/Voice reading the text.
inpVolumethe volume that gets applied to the Locale/Voice reading the text.
voiceNamethe name of the Locale/Voice reading the text.

◆ StopNative()

static void com.crosstales.RTVoice.RTVoiceAndroidBridge.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