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 interface
TextSpeaker.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 void
close()
Close the speaker and free its resourcesstatic void
destroy()
Destroy an instance of text speakerstatic ITextSpeaker
getInstance()
Get a singleton instance of speakerTextSpeaker.SpeechProgressListener
getListener()
void
onInit(int i)
Called to signal the completion of the TextToSpeech engine initialization.void
setListener(TextSpeaker.SpeechProgressListener listener)
static void
setup(android.content.Context context)
Set up an instance of text speakervoid
speak(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:
speak
in 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:
close
in interfacejava.lang.AutoCloseable
- Since:
- 1.21.0
-
onInit
public void onInit(int i)
Description copied from interface:android.speech.tts.TextToSpeech.OnInitListener
Called to signal the completion of the TextToSpeech engine initialization.- Specified by:
onInit
in interfaceandroid.speech.tts.TextToSpeech.OnInitListener
- Parameters:
i
-TextToSpeech.SUCCESS
orTextToSpeech.ERROR
.
-
-