Package com.appliedrec.verid.ui2
Class TextSpeaker
- java.lang.Object
-
- com.appliedrec.verid.ui2.TextSpeaker
-
- All Implemented Interfaces:
android.speech.tts.TextToSpeech.OnInitListener,ITextSpeaker,java.lang.AutoCloseable
public class TextSpeaker extends java.lang.Object implements ITextSpeaker, java.lang.AutoCloseable, android.speech.tts.TextToSpeech.OnInitListener
Speaks text- Since:
- 1.21.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTextSpeaker.SpeechProgressListener
-
Constructor Summary
Constructors Constructor Description TextSpeaker(android.content.Context context)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the speaker and free its resourcesstatic voiddestroy()Destroy an instance of text speakerstatic ITextSpeakergetInstance()Get a singleton instance of speakerTextSpeaker.SpeechProgressListenergetListener()voidonInit(int i)Called to signal the completion of the TextToSpeech engine initialization.voidsetListener(TextSpeaker.SpeechProgressListener listener)static voidsetup(android.content.Context context)Set up an instance of text speakervoidspeak(java.lang.String text, java.util.Locale locale, boolean interrupt)Speak text
-
-
-
Method Detail
-
setup
public static void setup(android.content.Context context)
Set up an instance of text speaker- Parameters:
context- Speaker context- Since:
- 1.21.0
-
destroy
public static void destroy()
Destroy an instance of text speaker- Since:
- 1.21.0
-
getInstance
public static ITextSpeaker getInstance()
Get a singleton instance of speaker- Returns:
- Speaker instance
- Since:
- 1.21.0
-
speak
public void speak(java.lang.String text, java.util.Locale locale, boolean interrupt)Speak text- Specified by:
speakin interfaceITextSpeaker- Parameters:
text- Text to be spokenlocale- Locale of the spoken textinterrupt- true to interrupt current speech- Since:
- 1.21.0
-
getListener
public TextSpeaker.SpeechProgressListener getListener()
-
setListener
public void setListener(TextSpeaker.SpeechProgressListener listener)
-
close
public void close()
Close the speaker and free its resources- Specified by:
closein interfacejava.lang.AutoCloseable- Since:
- 1.21.0
-
onInit
public void onInit(int i)
Description copied from interface:android.speech.tts.TextToSpeech.OnInitListenerCalled to signal the completion of the TextToSpeech engine initialization.- Specified by:
onInitin interfaceandroid.speech.tts.TextToSpeech.OnInitListener- Parameters:
i-TextToSpeech.SUCCESSorTextToSpeech.ERROR.
-
-