| Overview | Package | Class | Tree | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
java.lang.Object
|
+--java.util.EventObject
|
+--javax.speech.SpeechEvent
|
+--javax.speech.synthesis.SpeakableEvent
SpeakableEvents are issued to SpeakableListeners.
A single SpeakableListener can be provided to any of the
speak and speakPlainText methods of
a Synthesizer to monitor progress of a single
item on the speech output queue. Any number of
SpeakableListener objects can be attached to a
Synthesizer with the addSpeakableListener
method. These listeners receive every SpeakableEvent
for every item on the speech output queue of the Synthesizer.
The SpeakableListener attached to an individual
item on the speech output queue is notified before the
SpeakableListeners attached to the Synthesizer.
The source for a SpeakableEvent is the object
from which the JSML text was obtained: a Speakable object,
a URL, or a String.
The normal sequence of events during output of the item of the top of the synthesizer's speech output is:
TOP_OF_QUEUE
SPEAKABLE_STARTED
WORD_STARTED and MARKER_REACHED events
SPEAKABLE_ENDED
A SPEAKABLE_PAUSED may occur any time after the
TOP_OF_QUEUE but before the SPEAKABLE_ENDED
event. A SPEAKABLE_PAUSED event can only be
followed by a SPEAKABLE_RESUMED or SPEAKABLE_CANCELLED.
A SPEAKABLE_CANCELLED event can occur at any time before
an SPEAKABLE_ENDED (including before a TOP_OF_QUEUE
event). No other events can follow the SPEAKABLE_CANCELLED event
since the item has been removed from the speech output queue.
A SPEAKABLE_CANCELLED event can be issued for items
that are not at the top of the speech output queue. The other events
are only issued for the top-of-queue item.
| Field Summary | |
| static int | ELEMENT_CLOSE
The type of MARKER_REACHED event issued at the close
of a JSML container element that has a MARK attribute on
the matching openning tag. |
| static int | ELEMENT_EMPTY
The type of MARKER_REACHED event issued when an empty
JSML element with a MARK attribute is reached.
|
| static int | ELEMENT_OPEN
The type of MARKER_REACHED event issued at the openning
of a JSML container element with a MARK attribute.
|
| static int | MARKER_REACHED
Issued when audio output reaches a marker contained in the JSML text of a speech output queue item. |
| int | markerType
Marker type for a MARKER_REACHED event.
|
| static int | SPEAKABLE_CANCELLED
Issued when an item on the synthesizer's speech output queue is cancelled and removed from the queue. |
| static int | SPEAKABLE_ENDED
Issued with the completion of audio output of an object on the speech output queue as the object is removed from the queue. |
| static int | SPEAKABLE_PAUSED
Issued when audio output of the item at the top of a synthesizer's speech output queue is paused. |
| static int | SPEAKABLE_RESUMED
Issued when audio output of the item at the top of a synthesizer's speech output queue is resumed after a previous pause. |
| static int | SPEAKABLE_STARTED
Issued at the start of audio output of an item on the speech output queue. |
| String | text
The text associated with the SpeakableEvent. |
| static int | TOP_OF_QUEUE
Issued when an item on the synthesizer's speech output queue reaches the top of the queue. |
| static int | WORD_STARTED
Issued when a synthesis engine starts the audio output of a word in the speech output queue item. |
| int | wordEnd
Index of last character of of word in JSML text for a WORD_STARTED event.
|
| int | wordStart
Index of first character of of word in JSML text for a WORD_STARTED event.
|
| Fields inherited from class javax.speech.SpeechEvent | |
| id | |
| Fields inherited from class java.util.EventObject | |
| source | |
| Constructor Summary | |
| SpeakableEvent(Object source,
int id)
Constructs an SpeakableEvent with a specified source and identifier. |
|
| SpeakableEvent(Object source,
int id,
String text,
int markerType)
Constructs an SpeakableEvent with a specified source, identifier,
text and marker type (used for a MARKER_REACHED event). |
|
| SpeakableEvent(Object source,
int id,
String text,
int wordStart,
int wordEnd)
Constructor for a specified source, identifier, text, wordStart and wordEnd (called for a WORD_STARTED event). |
|
| Method Summary | |
| int | getMarkerType()
Return the type of a MARKER_REACHED event.
|
| String | getText()
Get the text associated with the event. |
| int | getWordEnd()
For a WORD_STARTED event, return the index
of the last character of the word in the JSML text. |
| int | getWordStart()
For a WORD_STARTED event, return the index
of the first character of the word in the JSML text. |
| String | paramString()
Returns a parameter string identifying this event. |
| Methods inherited from class javax.speech.SpeechEvent | |
| getId, paramString, toString | |
| Methods inherited from class java.util.EventObject | |
| getSource, toString | |
| Methods inherited from class java.lang.Object | |
| clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait | |
| Field Detail |
public static final int TOP_OF_QUEUE
Synthesizer
is not paused, the TOP_OF_QUEUE event will be followed
immediately by the SPEAKABLE_STARTED event. If the
Synthesizer is paused, the SPEAKABLE_STARTED
event will be delayed until the Synthesizer is resumed.
A QUEUE_UPDATED is also issued when the speech
output queue changes (e.g. a new item at the top of the queue).
The SpeakableEvent is issued prior to the
SynthesizerEvent.
public static final int SPEAKABLE_STARTED
TOP_OF_QUEUE
unless the Synthesizer is paused when the speakable
text is promoted to the top of the output queue.
public static final int SPEAKABLE_ENDED
A QUEUE_UPDATED or QUEUE_EMPTIED event is also
issued when the speech output queue changes because the speech output
of the item at the top of queue is completed.
The SpeakableEvent is issued prior to the
SynthesizerEvent.
public static final int SPEAKABLE_PAUSED
SPEAKABLE_PAUSED SpeakableEvent
is issued prior to the ENGINE_PAUSED event
that is issued to the SynthesizerListener.
public static final int SPEAKABLE_RESUMED
SPEAKABLE_RESUMED SpeakableEvent
is issued prior to the ENGINE_RESUMED event
that is issued to the SynthesizerListener.
public static final int SPEAKABLE_CANCELLED
speak.
An item can be cancelled even if it is not at the top of the
speech output queue (other SpeakableEvents are
issued only to the top-of-queue item).
Once cancelled, the listener for the cancelled object receives
no further SpeakableEvents.
The SPEAKABLE_CANCELLED SpeakableEvent
is issued prior to the QUEUE_UPDATED or
QUEUE_EMPTIED event that is issued to the
SynthesizerListener.
public static final int WORD_STARTED
text,
wordStart and wordEnd parameters
defines the segment of the speakable's string which is now being spoken.
public static final int MARKER_REACHED
MARK attribute.
The markerType indicates whether the mark is
at the openning or close of a JSML element or
is an attribute of an empty element (no close).
public static final int ELEMENT_OPEN
MARKER_REACHED event issued at the openning
of a JSML container element with a MARK attribute.
An ELEMENT_OPEN event is followed by an ELEMENT_CLOSE
event for the closing of the element (unless the Speakable
is cancelled).
Example: the event for the MARK attribute on the
openning SENT tag will be issued before the start
of the word "Testing" in:
<SENT MARK="open">Testing one, <MARKER MARK="here"/> two, three.</SENT>
public static final int ELEMENT_CLOSE
MARKER_REACHED event issued at the close
of a JSML container element that has a MARK attribute on
the matching openning tag. The ELEMENT_CLOSE event
always follows a matching ELEMENT_OPEN event for the
matching openning tag.
Example: the event for the closing SENT tag for the
MARK attribute at the openning of the SENT
element. The event will be issued after the word "three" is spoken.
<SENT MARK="open">Testing one, <MARKER MARK="here"/> two, three.</SENT>
public static final int ELEMENT_EMPTY
MARKER_REACHED event issued when an empty
JSML element with a MARK attribute is reached.
(An empty JSML has no closing tag and is
indicated by a slash ('/') before the '>' character.)
Example: the MARKER tag below is empty event so
an ELEMENT_EMPTY type of MARKER_REACHED event
is issued before the word "two" is spoken in:
<SENT MARK="open">Testing one, <MARKER MARK="here"/> two, three.</SENT>
protected String text
SpeakableEvent.protected int markerType
MARKER_REACHED event.
protected int wordStart
WORD_STARTED event.
protected int wordEnd
WORD_STARTED event.
| Constructor Detail |
public SpeakableEvent(Object source,
int id)
SpeakableEvent with a specified source and identifier.
public SpeakableEvent(Object source,
int id,
String text,
int markerType)
SpeakableEvent with a specified source, identifier,
text and marker type (used for a MARKER_REACHED event).
public SpeakableEvent(Object source,
int id,
String text,
int wordStart,
int wordEnd)
WORD_STARTED event).| Method Detail |
public int getMarkerType()
MARKER_REACHED event.
public String getText()
For WORD_STARTED, the text is the next word to be spoken.
This text may differ from the text between the wordStart
and wordEnd points is the original JSML text.
For MARKER_REACHED, the text is the MARK
attribute in the JSML text.
public int getWordStart()
WORD_STARTED event, return the index
of the first character of the word in the JSML text.public int getWordEnd()
WORD_STARTED event, return the index
of the last character of the word in the JSML text.public String paramString()
| Overview | Package | Class | Tree | Index | Help | |||
| PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||
JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com