Package trclib.archive
Class TrcEmic2TextToSpeech
java.lang.Object
trclib.archive.TrcEmic2TextToSpeech
This class implements a platform independent Emic2 text to speech device that is connected to a Serial Port.
This class should be extended by a platform dependent Emic2 device class that provides the asynchronous access
to the serial port the device is connected to.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
static enum
static enum
This is used identify the request type.static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private String
private final String
static final int
static final int
private final TrcDbgTrace
private String
-
Constructor Summary
ConstructorsConstructorDescriptionTrcEmic2TextToSpeech
(String instanceName) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
asyncReadString
(TrcEmic2TextToSpeech.RequestId requestId) This method issues an asynchronous read of a text string from the device.abstract void
asyncWriteString
(String text, boolean preemptive) This method writes the string to the device asynchronously.getCurrentConfig
(boolean wait) This method returns the current text-to-speech configuration.getHelpMessage
(boolean wait) This method returns the help message.getVersion
(boolean wait) This method returns the firmware version.protected void
This method is called when the read request is completed.void
This method plays the specified demo message.void
This method sets the text-to-speech back to default configuration.void
This method selects the parser that parses the sentence.void
This method selects the spoken voice.void
This method sets the spoken language.void
setSpeakingRate
(int rate) This method sets the speaking rate in words per minute.void
setVolume
(double vol) This method sets the speaking volume.void
setVolume
(int vol) This method sets the speaking volume.void
This method speaks the specified message.void
start()
This method is called to start the device in which it would send a read request for the prompt string.void
This method aborts the spoken sentence in progress.void
This method is called to pause/resume the spoken sentence in progress.toString()
This method returns the instance name.
-
Field Details
-
MIN_VOLUME
public static final int MIN_VOLUME- See Also:
-
MAX_VOLUME
public static final int MAX_VOLUME- See Also:
-
tracer
-
instanceName
-
configMsg
-
versionMsg
-
helpMsg
-
-
Constructor Details
-
TrcEmic2TextToSpeech
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.
-
-
Method Details
-
asyncReadString
This method issues an asynchronous read of a text string from the device.- Parameters:
requestId
- specifies the ID to identify the request. Can be null if none was provided.
-
asyncWriteString
This method writes the string to the device asynchronously.- Parameters:
text
- specifies the text string to be written to the device.preemptive
- specifies true for immediate write without queuing, false otherwise.
-
toString
This method returns the instance name. -
start
public void start()This method is called to start the device in which it would send a read request for the prompt string. -
speak
This method speaks the specified message.- Parameters:
msg
- specifies the message to be spoken.
-
playDemoMessage
This method plays the specified demo message.- Parameters:
msg
- specifies the demo message.
-
stopPlayback
public void stopPlayback()This method aborts the spoken sentence in progress. -
togglePlayback
public void togglePlayback()This method is called to pause/resume the spoken sentence in progress. -
selectVoice
This method selects the spoken voice.- Parameters:
voice
- specifies the voice to be used.
-
setVolume
public void setVolume(int vol) This method sets the speaking volume. Valid value is between -48 to 18.- Parameters:
vol
- specifies the speaking volume.
-
setVolume
public void setVolume(double vol) This method sets the speaking volume. Valid value is between 0 and 1.0. 0 for mute and 1.0 for full volume.- Parameters:
vol
- specifies the speaking volume.
-
setSpeakingRate
public void setSpeakingRate(int rate) This method sets the speaking rate in words per minute.- Parameters:
rate
- specifies the speaking rate.
-
setLanguage
This method sets the spoken language.- Parameters:
lang
- specifies the spoken language.
-
selectParser
This method selects the parser that parses the sentence.- Parameters:
parser
- specifies the parser to use.
-
revertDefaultConfig
public void revertDefaultConfig()This method sets the text-to-speech back to default configuration. -
getCurrentConfig
This method returns the current text-to-speech configuration.- Parameters:
wait
- specifies true for synchronous access.- Returns:
- current configuration string if wait is true, null otherwise.
-
getVersion
This method returns the firmware version.- Parameters:
wait
- specifies true for synchronous access.- Returns:
- firmware version string if wait is true, null otherwise.
-
getHelpMessage
This method returns the help message.- Parameters:
wait
- specifies true for synchronous access.- Returns:
- help message string if wait is true, null otherwise.
-
notify
This method is called when the read request is completed.- Parameters:
context
- specifies the read request.
-