Package com.sun.speech.engine.synthesis
Class BaseSynthesizerQueueItem
java.lang.Object
SynthesizerQueueItem
com.sun.speech.engine.synthesis.BaseSynthesizerQueueItem
- All Implemented Interfaces:
SpeechEventDispatcher
- Direct Known Subclasses:
FreeTTSSynthesizerQueueItem
,TextSynthesizerQueueItem
Extends the JSAPI 1.0
SynthesizerQueueItem
with handling
for JSML, generation of engine-specific text, and other features.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static int
Global count of queue items used for debug.protected BaseSynthesizer
Synthesizer
that has queued this item.protected int
Count for this item used for debug. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
indicate that this item has been canceledvoid
indicate that this item has been completedvoid
dispatchSpeechEvent
(SpeechEvent event) Dispatches aSpeechEvent
.void
fireMarkerReached
(SpeakableEvent event) Utility function that sends aMARKER_REACHED
event to all speakable listeners.void
fireSpeakableCancelled
(SpeakableEvent event) Utility function that sends aSPEAKABLE_CANCELLED
event to all speakable listeners.void
fireSpeakableEnded
(SpeakableEvent event) Utility function that sends aSPEAKABLE_ENDED
event to all speakable listeners.void
fireSpeakablePaused
(SpeakableEvent event) Utility function that sends aSPEAKABLE_PAUSED
event to all speakable listeners.void
fireSpeakableResumed
(SpeakableEvent event) Utility function that sends aSPEAKABLE_RESUMED
event to all speakable listeners.void
fireSpeakableStarted
(SpeakableEvent event) Utility function that sends aSPEAKABLE_STARTED
event to all speakable listeners.void
fireTopOfQueue
(SpeakableEvent event) Utility function that sends aTOP_OF_QUEUE
event to all speakable listeners.void
fireWordStarted
(SpeakableEvent event) Utility function that sends aWORD_STARTED
event to all speakable listeners.protected Document
Gets the DOM document for this object.int
Gets the item number for debug purposes only.protected boolean
determines if this queue item has been canceledboolean
returns true if this queue item has been processed.void
postMarkerReached
(String text, int markerType) Utility function that generates aMARKER_REACHED
event and posts it to the event queue.void
Utility function that generates aSPEAKABLE_CANCELLED
event and posts it to the event queue.void
Utility function that generates aSPEAKABLE_ENDED
event and posts it to the event queue.void
Utility function that generates aSPEAKABLE_PAUSED
event and posts it to the event queue.void
Utility function that generates aSPEAKABLE_RESUMED
event and posts it to the event queue.void
Utility function that generates aSPEAKABLE_STARTED
event and posts it to the event queue.void
Utility function that generates aTOP_OF_QUEUE
event and posts it to the event queue.void
postWordStarted
(String text, int wordStart, int wordEnd) Utility function that generates aWORD_STARTED
event and posts it to the event queue.protected void
setData
(BaseSynthesizer synth, String source, boolean plainText, SpeakableListener listener) Sets queue item data with aString
source that is either plain text or JSML.protected void
setData
(BaseSynthesizer synth, URL source, SpeakableListener listener) Sets queue item data with aURL
source.protected void
setData
(BaseSynthesizer synth, Speakable source, SpeakableListener listener) Sets queue item data with aSpeakable
source.void
started()
indicate that this item has been startedboolean
wait for this queue item to be completed
-
Field Details
-
itemNumber
protected static int itemNumberGlobal count of queue items used for debug. -
thisItemNumber
protected int thisItemNumberCount for this item used for debug. -
synth
Synthesizer
that has queued this item.
-
-
Constructor Details
-
BaseSynthesizerQueueItem
public BaseSynthesizerQueueItem()Class constructor.
-
-
Method Details
-
setData
protected void setData(BaseSynthesizer synth, Speakable source, SpeakableListener listener) throws JSMLException Sets queue item data with aSpeakable
source.- Parameters:
synth
- the synthesizersource
- theSpeakable
listener
- theSpeakableListener
to be notified as this object is processed- Throws:
JSMLException
- if thesource
contains JSML errors
-
setData
protected void setData(BaseSynthesizer synth, String source, boolean plainText, SpeakableListener listener) throws JSMLException Sets queue item data with aString
source that is either plain text or JSML.- Parameters:
synth
- the synthesizersource
- the textplainText
-true
only if thesource
is plain textlistener
- theSpeakableListener
to be notified as this object is processed- Throws:
JSMLException
- if thesource
contains JSML errors
-
setData
protected void setData(BaseSynthesizer synth, URL source, SpeakableListener listener) throws JSMLException, IOException Sets queue item data with aURL
source.- Parameters:
synth
- the synthesizersource
- theURL
containing JSML textlistener
- theSpeakableListener
to be notified as this object is processed- Throws:
JSMLException
- if thesource
contains JSML errorsIOException
- if there are problems working with the URL.
-
getDocument
Gets the DOM document for this object.- Returns:
- the DOM document for this object.
-
isCancelled
protected boolean isCancelled()determines if this queue item has been canceled- Returns:
true
if this item has been canceled; otherwisefalse
-
isCompleted
public boolean isCompleted()returns true if this queue item has been processed.- Returns:
- true if it has been processed
-
waitCompleted
public boolean waitCompleted()wait for this queue item to be completed- Returns:
- true if the item was completed successfully, false if the item was canceled or an error occurred.
-
cancelled
public void cancelled()indicate that this item has been canceled -
completed
public void completed()indicate that this item has been completed -
started
public void started()indicate that this item has been started -
getItemNumber
public int getItemNumber()Gets the item number for debug purposes only. Each queue item is given a unique ID.- Returns:
- the unique ID for this queue item
-
postMarkerReached
Utility function that generates aMARKER_REACHED
event and posts it to the event queue. EventuallyfireMarkerReached
will be called bydispatchSpeechEvent
as a result of this action.- Parameters:
text
- the text of the markermarkerType
- the type of marker- See Also:
-
SpeakableEvent#getMarkerType
fireMarkerReached(SpeakableEvent)
dispatchSpeechEvent(SpeechEvent)
-
fireMarkerReached
public void fireMarkerReached(SpeakableEvent event) Utility function that sends aMARKER_REACHED
event to all speakable listeners.- Parameters:
event
- theMARKER_REACHED
event- See Also:
-
postSpeakableCancelled
public void postSpeakableCancelled()Utility function that generates aSPEAKABLE_CANCELLED
event and posts it to the event queue. EventuallyfireSpeakableCancelled
will be called bydispatchSpeechEvent
as a result of this action. -
fireSpeakableCancelled
public void fireSpeakableCancelled(SpeakableEvent event) Utility function that sends aSPEAKABLE_CANCELLED
event to all speakable listeners.- Parameters:
event
- theSPEAKABLE_CANCELLED
event- See Also:
-
postSpeakableEnded
public void postSpeakableEnded()Utility function that generates aSPEAKABLE_ENDED
event and posts it to the event queue. EventuallyfireSpeakableEnded
will be called bydispatchSpeechEvent
as a result of this action. -
fireSpeakableEnded
public void fireSpeakableEnded(SpeakableEvent event) Utility function that sends aSPEAKABLE_ENDED
event to all speakable listeners.- Parameters:
event
- theSPEAKABLE_ENDED
event- See Also:
-
postSpeakablePaused
public void postSpeakablePaused()Utility function that generates aSPEAKABLE_PAUSED
event and posts it to the event queue. EventuallyfireSpeakablePaused
will be called bydispatchSpeechEvent
as a result of this action. -
fireSpeakablePaused
public void fireSpeakablePaused(SpeakableEvent event) Utility function that sends aSPEAKABLE_PAUSED
event to all speakable listeners.- Parameters:
event
- theSPEAKABLE_PAUSED
event- See Also:
-
postSpeakableResumed
public void postSpeakableResumed()Utility function that generates aSPEAKABLE_RESUMED
event and posts it to the event queue. EventuallyfireSpeakableResumed
will be called bydispatchSpeechEvent
as a result of this action. -
fireSpeakableResumed
public void fireSpeakableResumed(SpeakableEvent event) Utility function that sends aSPEAKABLE_RESUMED
event to all speakable listeners.- Parameters:
event
- theSPEAKABLE_RESUMED
event- See Also:
-
postSpeakableStarted
public void postSpeakableStarted()Utility function that generates aSPEAKABLE_STARTED
event and posts it to the event queue. EventuallyfireSpeakableStarted
will be called bydispatchSpeechEvent
as a result of this action. -
fireSpeakableStarted
public void fireSpeakableStarted(SpeakableEvent event) Utility function that sends aSPEAKABLE_STARTED
event to all speakable listeners.- Parameters:
event
- theSPEAKABLE_STARTED
event- See Also:
-
postTopOfQueue
public void postTopOfQueue()Utility function that generates aTOP_OF_QUEUE
event and posts it to the event queue. EventuallyfireTopOfQueue
will be called bydispatchSpeechEvent
as a result of this action. -
fireTopOfQueue
public void fireTopOfQueue(SpeakableEvent event) Utility function that sends aTOP_OF_QUEUE
event to all speakable listeners.- Parameters:
event
- theTOP_OF_QUEUE
event- See Also:
-
postWordStarted
Utility function that generates aWORD_STARTED
event and posts it to the event queue. EventuallyfireWordStarted
will be called bydispatchSpeechEvent
as a result of this action. -
fireWordStarted
public void fireWordStarted(SpeakableEvent event) Utility function that sends aWORD_STARTED
event to all speakable listeners.- Parameters:
event
- theWORD_STARTED
event- See Also:
-
dispatchSpeechEvent
public void dispatchSpeechEvent(SpeechEvent event) Dispatches aSpeechEvent
. The dispatcher should notify allEngineListeners
from this method. TheSpeechEvent
was added via the various post methods of this class.- Specified by:
dispatchSpeechEvent
in interfaceSpeechEventDispatcher
- Parameters:
event
- theSpeechEvent
to dispatch- See Also:
-