Package com.znize.platform.test.api
Interface TextToSpeech
-
public interface TextToSpeechTextToSpeech: text to speech. One instance for one PageLoader.- Since:
- 5.21
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTextToSpeech.LevelTTS levels, which are ordered by their ordinal values.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TextToSpeech.LevelgetLevel()Get the minimum level for speech to go through.voidhideCaption()Hide caption.booleanisLevelEnabled(TextToSpeech.Level level)Is the level enabled for speech to go through?voidsetCaptionOn(boolean on)Turn on/off caption.voidsetLevel(TextToSpeech.Level level)Set the minimum level for speech to go through.voidsetVoice(java.lang.String voice)Set voice.voidsetVoiceOn(boolean on)Turn on/off voice.voidshowCaption(java.lang.String text)Show the caption text if caption is on.voidspeak(ParameterizedMessage message, TextToSpeech.Level level)Speak the message at the level.voidspeak(java.lang.String text, java.lang.String language, java.lang.String caption, TextToSpeech.Level level)Speak the text of the specified language.voidwaitUntilQueueEmpty()Wait until all queued messages(texts) of the latest TextToSpeech have been spoken.TextToSpeechwith(java.util.Locale locale, java.util.ResourceBundle bundle, boolean demoOnly)Set locale, resource bundle, demoOnly flag for the language to speak.
-
-
-
Method Detail
-
with
TextToSpeech with(java.util.Locale locale, java.util.ResourceBundle bundle, boolean demoOnly)
Set locale, resource bundle, demoOnly flag for the language to speak. The script and variant of the locale will be removed for TTS(Text to Speech) language.- Parameters:
locale- localebundle- resource bundledemoOnly- whether to speak for demo only- Returns:
- this TextToSpeech object for chaining method calls
-
setVoice
void setVoice(java.lang.String voice)
Set voice. Default voice can be specified by system property "tts.voice".- Parameters:
voice- voice name. If the voice is not available, TTS will pick one voice.
-
getLevel
TextToSpeech.Level getLevel()
Get the minimum level for speech to go through. default is TextToSpeech.Level.INFO, or overridden by system property "tts.level".- Returns:
- minimum level
-
setLevel
void setLevel(TextToSpeech.Level level)
Set the minimum level for speech to go through. default is TextToSpeech.Level.INFO, or overridden by system property "tts.level".- Parameters:
level- minimum level.
-
isLevelEnabled
boolean isLevelEnabled(TextToSpeech.Level level)
Is the level enabled for speech to go through?- Parameters:
level- the level to speak- Returns:
- true if enabled, false otherwise
-
setCaptionOn
void setCaptionOn(boolean on)
Turn on/off caption.- Parameters:
on- whether to generate caption on screen. default is true.
-
setVoiceOn
void setVoiceOn(boolean on)
Turn on/off voice.- Parameters:
on- whether to generate voice. default is true.
-
speak
void speak(java.lang.String text, java.lang.String language, java.lang.String caption, TextToSpeech.Level level)Speak the text of the specified language. If the level is not below the TTS minimum level getLevel(), the text will be spoken.- Parameters:
text- the text to speak. resource bundle is not used.language- the language of the text such as en, en-US, zh, zh-CN. If not null, override existing language setting.caption- if not null, override the caption that is the same as the text to speak by defaultlevel- the level to speak
-
speak
void speak(ParameterizedMessage message, TextToSpeech.Level level)
Speak the message at the level. If the level is not below the TTS minimum level getLevel(), the message will be spoken.- Parameters:
message- the message to speaklevel- the level to speak.
-
waitUntilQueueEmpty
void waitUntilQueueEmpty()
Wait until all queued messages(texts) of the latest TextToSpeech have been spoken. The latest TextToSpeech is the one that called one speak() method most recently.
-
showCaption
void showCaption(java.lang.String text)
Show the caption text if caption is on.- Parameters:
text- the caption text
-
hideCaption
void hideCaption()
Hide caption.
-
-