SpeechEventDispatcher
FreeTTSSynthesizerQueueItem
, TextSynthesizerQueueItem
public class BaseSynthesizerQueueItem extends SynthesizerQueueItem implements SpeechEventDispatcher
SynthesizerQueueItem
with handling
for JSML, generation of engine-specific text, and other features.Modifier and Type | Field | Description |
---|---|---|
protected static int |
itemNumber |
Global count of queue items used for debug.
|
protected BaseSynthesizer |
synth |
Synthesizer that has queued this item. |
protected int |
thisItemNumber |
Count for this item used for debug.
|
Constructor | Description |
---|---|
BaseSynthesizerQueueItem() |
Class constructor.
|
Modifier and Type | Method | Description |
---|---|---|
void |
cancelled() |
indicate that this item has been canceled
|
void |
completed() |
indicate that this item has been completed
|
void |
dispatchSpeechEvent(SpeechEvent event) |
Dispatches a
SpeechEvent . |
void |
fireMarkerReached(SpeakableEvent event) |
Utility function that sends a
MARKER_REACHED event
to all speakable listeners. |
void |
fireSpeakableCancelled(SpeakableEvent event) |
Utility function that sends a
SPEAKABLE_CANCELLED event
to all speakable listeners. |
void |
fireSpeakableEnded(SpeakableEvent event) |
Utility function that sends a
SPEAKABLE_ENDED event
to all speakable listeners. |
void |
fireSpeakablePaused(SpeakableEvent event) |
Utility function that sends a
SPEAKABLE_PAUSED event
to all speakable listeners. |
void |
fireSpeakableResumed(SpeakableEvent event) |
Utility function that sends a
SPEAKABLE_RESUMED event
to all speakable listeners. |
void |
fireSpeakableStarted(SpeakableEvent event) |
Utility function that sends a
SPEAKABLE_STARTED event
to all speakable listeners. |
void |
fireTopOfQueue(SpeakableEvent event) |
Utility function that sends a
TOP_OF_QUEUE event
to all speakable listeners. |
void |
fireWordStarted(SpeakableEvent event) |
Utility function that sends a
WORD_STARTED event
to all speakable listeners. |
protected org.w3c.dom.Document |
getDocument() |
Gets the DOM document for this object.
|
int |
getItemNumber() |
Gets the item number for debug purposes only.
|
protected boolean |
isCancelled() |
determines if this queue item has been canceled
|
boolean |
isCompleted() |
returns true if this queue item has been
processed.
|
void |
postMarkerReached(java.lang.String text,
int markerType) |
Utility function that generates a
MARKER_REACHED event and posts it
to the event queue. |
void |
postSpeakableCancelled() |
Utility function that generates a
SPEAKABLE_CANCELLED event and posts it
to the event queue. |
void |
postSpeakableEnded() |
Utility function that generates a
SPEAKABLE_ENDED event and posts it
to the event queue. |
void |
postSpeakablePaused() |
Utility function that generates a
SPEAKABLE_PAUSED event and posts it
to the event queue. |
void |
postSpeakableResumed() |
Utility function that generates a
SPEAKABLE_RESUMED event and posts it
to the event queue. |
void |
postSpeakableStarted() |
Utility function that generates a
SPEAKABLE_STARTED event and posts it
to the event queue. |
void |
postTopOfQueue() |
Utility function that generates a
TOP_OF_QUEUE event and posts it
to the event queue. |
void |
postWordStarted(java.lang.String text,
int wordStart,
int wordEnd) |
Utility function that generates a
WORD_STARTED event and posts it
to the event queue. |
protected void |
setData(BaseSynthesizer synth,
java.lang.String source,
boolean plainText,
SpeakableListener listener) |
Sets queue item data with a
String source that is
either plain text or JSML. |
protected void |
setData(BaseSynthesizer synth,
java.net.URL source,
SpeakableListener listener) |
Sets queue item data with a
URL source. |
protected void |
setData(BaseSynthesizer synth,
Speakable source,
SpeakableListener listener) |
Sets queue item data with a
Speakable source. |
void |
started() |
indicate that this item has been started
|
boolean |
waitCompleted() |
wait for this queue item to be completed
|
protected static int itemNumber
protected int thisItemNumber
protected BaseSynthesizer synth
Synthesizer
that has queued this item.protected void setData(BaseSynthesizer synth, Speakable source, SpeakableListener listener) throws JSMLException
Speakable
source.synth
- the synthesizersource
- the Speakable
listener
- the SpeakableListener
to be
notified as this object is processedJSMLException
- if the source
contains JSML errorsprotected void setData(BaseSynthesizer synth, java.lang.String source, boolean plainText, SpeakableListener listener) throws JSMLException
String
source that is
either plain text or JSML.synth
- the synthesizersource
- the textplainText
- true
only if the
source
is plain textlistener
- the SpeakableListener
to be
notified as this object is processedJSMLException
- if the source
contains JSML errorsprotected void setData(BaseSynthesizer synth, java.net.URL source, SpeakableListener listener) throws JSMLException, java.io.IOException
URL
source.synth
- the synthesizersource
- the URL
containing JSML textlistener
- the SpeakableListener
to be
notified as this object is processedJSMLException
- if the source
contains JSML errorsjava.io.IOException
- if there are problems working with the URL.protected org.w3c.dom.Document getDocument()
protected boolean isCancelled()
true
if this item has been canceled;
otherwise false
public boolean isCompleted()
public boolean waitCompleted()
public void cancelled()
public void completed()
public void started()
public int getItemNumber()
public void postMarkerReached(java.lang.String text, int markerType)
MARKER_REACHED
event and posts it
to the event queue. Eventually
fireMarkerReached
will be called
by dispatchSpeechEvent
as a result
of this action.text
- the text of the markermarkerType
- the type of markerSpeakableEvent#getMarkerType
,
fireMarkerReached(SpeakableEvent)
,
dispatchSpeechEvent(SpeechEvent)
public void fireMarkerReached(SpeakableEvent event)
MARKER_REACHED
event
to all speakable listeners.event
- the MARKER_REACHED
eventpostMarkerReached(java.lang.String, int)
public void postSpeakableCancelled()
SPEAKABLE_CANCELLED
event and posts it
to the event queue. Eventually
fireSpeakableCancelled
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireSpeakableCancelled(SpeakableEvent event)
SPEAKABLE_CANCELLED
event
to all speakable listeners.event
- the SPEAKABLE_CANCELLED
eventpostSpeakableCancelled()
public void postSpeakableEnded()
SPEAKABLE_ENDED
event and posts it
to the event queue. Eventually
fireSpeakableEnded
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireSpeakableEnded(SpeakableEvent event)
SPEAKABLE_ENDED
event
to all speakable listeners.event
- the SPEAKABLE_ENDED
eventpostSpeakableEnded()
public void postSpeakablePaused()
SPEAKABLE_PAUSED
event and posts it
to the event queue. Eventually
fireSpeakablePaused
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireSpeakablePaused(SpeakableEvent event)
SPEAKABLE_PAUSED
event
to all speakable listeners.event
- the SPEAKABLE_PAUSED
eventpostSpeakablePaused()
public void postSpeakableResumed()
SPEAKABLE_RESUMED
event and posts it
to the event queue. Eventually
fireSpeakableResumed
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireSpeakableResumed(SpeakableEvent event)
SPEAKABLE_RESUMED
event
to all speakable listeners.event
- the SPEAKABLE_RESUMED
eventpostSpeakableResumed()
public void postSpeakableStarted()
SPEAKABLE_STARTED
event and posts it
to the event queue. Eventually
fireSpeakableStarted
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireSpeakableStarted(SpeakableEvent event)
SPEAKABLE_STARTED
event
to all speakable listeners.event
- the SPEAKABLE_STARTED
eventpostSpeakableStarted()
public void postTopOfQueue()
TOP_OF_QUEUE
event and posts it
to the event queue. Eventually
fireTopOfQueue
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireTopOfQueue(SpeakableEvent event)
TOP_OF_QUEUE
event
to all speakable listeners.event
- the TOP_OF_QUEUE
eventpostTopOfQueue()
public void postWordStarted(java.lang.String text, int wordStart, int wordEnd)
WORD_STARTED
event and posts it
to the event queue. Eventually
fireWordStarted
will be called
by dispatchSpeechEvent
as a result
of this action.public void fireWordStarted(SpeakableEvent event)
WORD_STARTED
event
to all speakable listeners.event
- the WORD_STARTED
eventpostWordStarted(java.lang.String, int, int)
public void dispatchSpeechEvent(SpeechEvent event)
SpeechEvent
.
The dispatcher should notify all EngineListeners
from this method. The SpeechEvent
was added
via the various post methods of this class.dispatchSpeechEvent
in interface SpeechEventDispatcher
event
- the SpeechEvent
to dispatchpostMarkerReached(java.lang.String, int)
,
postSpeakableCancelled()
,
postSpeakableEnded()
,
postSpeakablePaused()
,
postSpeakableResumed()
,
postSpeakableStarted()
,
postTopOfQueue()
,
postWordStarted(java.lang.String, int, int)