Package com.sun.speech.engine.synthesis
Class BaseSynthesizerQueueItem
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 intGlobal count of queue items used for debug.protected BaseSynthesizerSynthesizerthat has queued this item.protected intCount for this item used for debug. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidindicate that this item has been canceledvoidindicate that this item has been completedvoiddispatchSpeechEvent(SpeechEvent event) Dispatches aSpeechEvent.voidfireMarkerReached(SpeakableEvent event) Utility function that sends aMARKER_REACHEDevent to all speakable listeners.voidfireSpeakableCancelled(SpeakableEvent event) Utility function that sends aSPEAKABLE_CANCELLEDevent to all speakable listeners.voidfireSpeakableEnded(SpeakableEvent event) Utility function that sends aSPEAKABLE_ENDEDevent to all speakable listeners.voidfireSpeakablePaused(SpeakableEvent event) Utility function that sends aSPEAKABLE_PAUSEDevent to all speakable listeners.voidfireSpeakableResumed(SpeakableEvent event) Utility function that sends aSPEAKABLE_RESUMEDevent to all speakable listeners.voidfireSpeakableStarted(SpeakableEvent event) Utility function that sends aSPEAKABLE_STARTEDevent to all speakable listeners.voidfireTopOfQueue(SpeakableEvent event) Utility function that sends aTOP_OF_QUEUEevent to all speakable listeners.voidfireWordStarted(SpeakableEvent event) Utility function that sends aWORD_STARTEDevent to all speakable listeners.protected DocumentGets the DOM document for this object.intGets the item number for debug purposes only.protected booleandetermines if this queue item has been canceledbooleanreturns true if this queue item has been processed.voidpostMarkerReached(String text, int markerType) Utility function that generates aMARKER_REACHEDevent and posts it to the event queue.voidUtility function that generates aSPEAKABLE_CANCELLEDevent and posts it to the event queue.voidUtility function that generates aSPEAKABLE_ENDEDevent and posts it to the event queue.voidUtility function that generates aSPEAKABLE_PAUSEDevent and posts it to the event queue.voidUtility function that generates aSPEAKABLE_RESUMEDevent and posts it to the event queue.voidUtility function that generates aSPEAKABLE_STARTEDevent and posts it to the event queue.voidUtility function that generates aTOP_OF_QUEUEevent and posts it to the event queue.voidpostWordStarted(String text, int wordStart, int wordEnd) Utility function that generates aWORD_STARTEDevent and posts it to the event queue.protected voidsetData(BaseSynthesizer synth, String source, boolean plainText, SpeakableListener listener) Sets queue item data with aStringsource that is either plain text or JSML.protected voidsetData(BaseSynthesizer synth, URL source, SpeakableListener listener) Sets queue item data with aURLsource.protected voidsetData(BaseSynthesizer synth, Speakable source, SpeakableListener listener) Sets queue item data with aSpeakablesource.voidstarted()indicate that this item has been startedbooleanwait 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
Synthesizerthat 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 aSpeakablesource.- Parameters:
synth- the synthesizersource- theSpeakablelistener- theSpeakableListenerto be notified as this object is processed
-
setData
protected void setData(BaseSynthesizer synth, String source, boolean plainText, SpeakableListener listener) throws JSMLException Sets queue item data with aStringsource that is either plain text or JSML.- Parameters:
synth- the synthesizersource- the textplainText-trueonly if thesourceis plain textlistener- theSpeakableListenerto be notified as this object is processed
-
setData
protected void setData(BaseSynthesizer synth, URL source, SpeakableListener listener) throws JSMLException, IOException Sets queue item data with aURLsource.- Parameters:
synth- the synthesizersource- theURLcontaining JSML textlistener- theSpeakableListenerto be notified as this object is processed
-
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:
trueif 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_REACHEDevent and posts it to the event queue. EventuallyfireMarkerReachedwill be called bydispatchSpeechEventas a result of this action.- Parameters:
text- the text of the markermarkerType- the type of marker- See Also:
-
fireMarkerReached
public void fireMarkerReached(SpeakableEvent event) Utility function that sends aMARKER_REACHEDevent to all speakable listeners.- Parameters:
event- theMARKER_REACHEDevent- See Also:
-
postSpeakableCancelled
public void postSpeakableCancelled()Utility function that generates aSPEAKABLE_CANCELLEDevent and posts it to the event queue. EventuallyfireSpeakableCancelledwill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireSpeakableCancelled
public void fireSpeakableCancelled(SpeakableEvent event) Utility function that sends aSPEAKABLE_CANCELLEDevent to all speakable listeners.- Parameters:
event- theSPEAKABLE_CANCELLEDevent- See Also:
-
postSpeakableEnded
public void postSpeakableEnded()Utility function that generates aSPEAKABLE_ENDEDevent and posts it to the event queue. EventuallyfireSpeakableEndedwill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireSpeakableEnded
public void fireSpeakableEnded(SpeakableEvent event) Utility function that sends aSPEAKABLE_ENDEDevent to all speakable listeners.- Parameters:
event- theSPEAKABLE_ENDEDevent- See Also:
-
postSpeakablePaused
public void postSpeakablePaused()Utility function that generates aSPEAKABLE_PAUSEDevent and posts it to the event queue. EventuallyfireSpeakablePausedwill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireSpeakablePaused
public void fireSpeakablePaused(SpeakableEvent event) Utility function that sends aSPEAKABLE_PAUSEDevent to all speakable listeners.- Parameters:
event- theSPEAKABLE_PAUSEDevent- See Also:
-
postSpeakableResumed
public void postSpeakableResumed()Utility function that generates aSPEAKABLE_RESUMEDevent and posts it to the event queue. EventuallyfireSpeakableResumedwill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireSpeakableResumed
public void fireSpeakableResumed(SpeakableEvent event) Utility function that sends aSPEAKABLE_RESUMEDevent to all speakable listeners.- Parameters:
event- theSPEAKABLE_RESUMEDevent- See Also:
-
postSpeakableStarted
public void postSpeakableStarted()Utility function that generates aSPEAKABLE_STARTEDevent and posts it to the event queue. EventuallyfireSpeakableStartedwill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireSpeakableStarted
public void fireSpeakableStarted(SpeakableEvent event) Utility function that sends aSPEAKABLE_STARTEDevent to all speakable listeners.- Parameters:
event- theSPEAKABLE_STARTEDevent- See Also:
-
postTopOfQueue
public void postTopOfQueue()Utility function that generates aTOP_OF_QUEUEevent and posts it to the event queue. EventuallyfireTopOfQueuewill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireTopOfQueue
public void fireTopOfQueue(SpeakableEvent event) Utility function that sends aTOP_OF_QUEUEevent to all speakable listeners.- Parameters:
event- theTOP_OF_QUEUEevent- See Also:
-
postWordStarted
Utility function that generates aWORD_STARTEDevent and posts it to the event queue. EventuallyfireWordStartedwill be called bydispatchSpeechEventas a result of this action.- See Also:
-
fireWordStarted
public void fireWordStarted(SpeakableEvent event) Utility function that sends aWORD_STARTEDevent to all speakable listeners.- Parameters:
event- theWORD_STARTEDevent- See Also:
-
dispatchSpeechEvent
public void dispatchSpeechEvent(SpeechEvent event) Dispatches aSpeechEvent. The dispatcher should notify allEngineListenersfrom this method. TheSpeechEventwas added via the various post methods of this class.- Specified by:
dispatchSpeechEventin interfaceSpeechEventDispatcher- Parameters:
event- theSpeechEventto dispatch- See Also:
-