|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.speech.engine.BaseEngine
com.sun.speech.engine.synthesis.BaseSynthesizer
Supports the JSAPI 1.0 Synthesizer interface that
performs the core non-engine-specific functions.
An actual JSAPI synthesizer implementation needs to extend or modify this implementation.
| Field Summary | |
protected java.util.Collection |
speakableListeners
Set of speakable listeners belonging to the Synthesizer.
|
protected VoiceList |
voiceList
The set of voices available in this Synthesizer.
|
| Fields inherited from class com.sun.speech.engine.BaseEngine |
audioManager, CLEAR_ALL_STATE, engineListeners, engineModeDesc, engineProperties, engineState, engineStateLock |
| Fields inherited from interface javax.speech.synthesis.Synthesizer |
QUEUE_EMPTY, QUEUE_NOT_EMPTY |
| Fields inherited from interface javax.speech.Engine |
ALLOCATED, ALLOCATING_RESOURCES, DEALLOCATED, DEALLOCATING_RESOURCES, PAUSED, RESUMED |
| Constructor Summary | |
BaseSynthesizer(javax.speech.synthesis.SynthesizerModeDesc mode)
Creates a new Synthesizer in the DEALLOCATED state. |
|
| Method Summary | |
void |
addSpeakableListener(javax.speech.synthesis.SpeakableListener listener)
Adds a SpeakableListener to this Synthesizer. |
protected abstract void |
appendQueue(BaseSynthesizerQueueItem item)
Puts an item on the speaking queue and sends a queue updated event. |
abstract void |
cancel()
Cancels the item at the top of the queue. |
abstract void |
cancel(java.lang.Object source)
Cancels a specific object on the queue. |
abstract void |
cancelAll()
Cancels all items on the output queue. |
protected BaseEngineProperties |
createEngineProperties()
Factory constructor for EngineProperties object.
|
protected BaseSynthesizerQueueItem |
createQueueItem()
Factory method that creates a BaseSynthesizerQueueItem.
|
void |
dispatchSpeechEvent(javax.speech.SpeechEvent event)
Dispatches a SpeechEvent.
|
abstract java.util.Enumeration |
enumerateQueue()
Returns an enumeration of the queue. |
void |
fireQueueEmptied(javax.speech.synthesis.SynthesizerEvent event)
Utility function that sends a QUEUE_EMPTIED
event to all SynthesizerListeners. |
void |
fireQueueUpdated(javax.speech.synthesis.SynthesizerEvent event)
Utility function that sends a QUEUE_UPDATED
event to all SynthesizerListeners. |
javax.speech.synthesis.SynthesizerProperties |
getSynthesizerProperties()
Returns the SynthesizerProperties object (a JavaBean).
|
protected VoiceList |
getVoiceList()
Returns the list of voices for this Synthesizer. |
java.lang.String |
phoneme(java.lang.String text)
Optional method that converts a text string to a phoneme string. |
void |
postQueueEmptied(long oldState,
long newState)
Utility function that generates QUEUE_EMPTIED
event and posts it to the event queue. |
void |
postQueueUpdated(boolean topOfQueueChanged,
long oldState,
long newState)
Utility function that generates QUEUE_UPDATED
event and posts it to the event queue. |
void |
removeSpeakableListener(javax.speech.synthesis.SpeakableListener listener)
Removes a SpeakableListener from this
Synthesizer. |
void |
speak(javax.speech.synthesis.Speakable jsmlText,
javax.speech.synthesis.SpeakableListener listener)
Speaks JSML text provided as a Speakable object. |
void |
speak(java.lang.String jsmlText,
javax.speech.synthesis.SpeakableListener listener)
Speaks JSML text provided as a String. |
void |
speak(java.net.URL jsmlURL,
javax.speech.synthesis.SpeakableListener listener)
Speaks JSML text provided as a URL. |
void |
speakPlainText(java.lang.String text,
javax.speech.synthesis.SpeakableListener listener)
Speaks a plain text String. |
protected java.lang.String |
stateToString(long state)
Returns a String of the names of all the states implied in the given bit pattern. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.speech.Engine |
addEngineListener, allocate, deallocate, getAudioManager, getEngineModeDesc, getEngineProperties, getEngineState, getVocabManager, pause, removeEngineListener, resume, testEngineState, waitEngineState |
| Field Detail |
protected java.util.Collection speakableListeners
Synthesizer.
Each item on queue may have an individual listener too.
SpeakableListenerprotected VoiceList voiceList
Synthesizer.
The list can be created in the constructor methods.
| Constructor Detail |
public BaseSynthesizer(javax.speech.synthesis.SynthesizerModeDesc mode)
DEALLOCATED state.
mode - the operating mode of this Synthesizer| Method Detail |
public void speak(javax.speech.synthesis.Speakable jsmlText,
javax.speech.synthesis.SpeakableListener listener)
throws javax.speech.synthesis.JSMLException,
javax.speech.EngineStateError
Speakable object.
speak in interface javax.speech.synthesis.SynthesizerjsmlText - the JSML text to speaklistener - the listener to be notified as the
jsmlText is processed
javax.speech.synthesis.JSMLException - if the JSML text contains errors
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
public void speak(java.net.URL jsmlURL,
javax.speech.synthesis.SpeakableListener listener)
throws javax.speech.synthesis.JSMLException,
java.net.MalformedURLException,
java.io.IOException,
javax.speech.EngineStateError
URL.
speak in interface javax.speech.synthesis.SynthesizerjsmlURL - the URL containing JSML textlistener - the listener to be notified as the
JSML text is processed
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
java.io.IOException - if errors are encountered with the JSMLurl
javax.speech.synthesis.JSMLException - if the JSML text contains errors
java.net.MalformedURLException - if errors are encountered with the JSMLurl
public void speak(java.lang.String jsmlText,
javax.speech.synthesis.SpeakableListener listener)
throws javax.speech.synthesis.JSMLException,
javax.speech.EngineStateError
String.
speak in interface javax.speech.synthesis.SynthesizerjsmlText - a String containing JSML.listener - the listener to be notified as the
JSML text is processed
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
javax.speech.synthesis.JSMLException - if the JSML text contains errors
public void speakPlainText(java.lang.String text,
javax.speech.synthesis.SpeakableListener listener)
throws javax.speech.EngineStateError
String. No JSML parsing is
performed.
speakPlainText in interface javax.speech.synthesis.Synthesizertext - a String containing plain text.listener - the listener to be notified as the
text is processed
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES statesprotected java.lang.String stateToString(long state)
stateToString in class BaseEnginestate - the bit pattern of states
protected abstract void appendQueue(BaseSynthesizerQueueItem item)
item - the item to add to the queue
public java.lang.String phoneme(java.lang.String text)
throws javax.speech.EngineStateError
phoneme in interface javax.speech.synthesis.Synthesizertext - plain text to be converted to phonemes
null
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
public abstract java.util.Enumeration enumerateQueue()
throws javax.speech.EngineStateError
enumerateQueue in interface javax.speech.synthesis.SynthesizerEnumeration of the speech output queue or
null.
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
public abstract void cancel()
throws javax.speech.EngineStateError
cancel in interface javax.speech.synthesis.Synthesizerjavax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
public abstract void cancel(java.lang.Object source)
throws java.lang.IllegalArgumentException,
javax.speech.EngineStateError
cancel in interface javax.speech.synthesis.Synthesizersource - object to be removed from the speech output queue
java.lang.IllegalArgumentException - if the source object is not found in the speech output queue.
javax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES states
public abstract void cancelAll()
throws javax.speech.EngineStateError
cancelAll in interface javax.speech.synthesis.Synthesizerjavax.speech.EngineStateError - if this Synthesizer in the DEALLOCATED or
DEALLOCATING_RESOURCES statespublic javax.speech.synthesis.SynthesizerProperties getSynthesizerProperties()
SynthesizerProperties object (a JavaBean).
The method returns exactly the same object as the
getEngineProperties method in the Engine
interface. However, with the getSynthesizerProperties
method, an application does not need to cast the return value.
getSynthesizerProperties in interface javax.speech.synthesis.SynthesizerSynthesizerProperties object for this
Synthesizerpublic void addSpeakableListener(javax.speech.synthesis.SpeakableListener listener)
SpeakableListener to this Synthesizer.
addSpeakableListener in interface javax.speech.synthesis.Synthesizerlistener - the listener to addremoveSpeakableListener(javax.speech.synthesis.SpeakableListener)public void removeSpeakableListener(javax.speech.synthesis.SpeakableListener listener)
SpeakableListener from this
Synthesizer.
removeSpeakableListener in interface javax.speech.synthesis.Synthesizerlistener - the listener to removeaddSpeakableListener(javax.speech.synthesis.SpeakableListener)protected BaseEngineProperties createEngineProperties()
EngineProperties object.
Gets the default speaking voice from the
SynthesizerModeDesc.
Takes the default prosody values (pitch, range, volume, rate)
from the default voice. Override to set engine-specific defaults.
createEngineProperties in class BaseEngineBaseEngineProperties object specific to
a subclass.protected BaseSynthesizerQueueItem createQueueItem()
BaseSynthesizerQueueItem.
Override if the synthesizer specializes the
BaseSynthesizerQueueItem class.
protected VoiceList getVoiceList()
Synthesizer.
Synthesizer.
public void postQueueUpdated(boolean topOfQueueChanged,
long oldState,
long newState)
QUEUE_UPDATED
event and posts it to the event queue. Eventually
fireQueueUpdated will be called
by dispatchSpeechEvent as a result of this action.
topOfQueueChanged - true if the top of the
queue has changedoldState - the old state of this SynthesizernewState - the new state of this SynthesizerfireQueueUpdated(javax.speech.synthesis.SynthesizerEvent),
dispatchSpeechEvent(javax.speech.SpeechEvent)public void fireQueueUpdated(javax.speech.synthesis.SynthesizerEvent event)
QUEUE_UPDATED
event to all SynthesizerListeners.
event - the QUEUE_UPDATED eventpostQueueUpdated(boolean, long, long),
dispatchSpeechEvent(javax.speech.SpeechEvent)
public void postQueueEmptied(long oldState,
long newState)
QUEUE_EMPTIED
event and posts it to the event queue. Eventually
fireQueueEmptied will be called
by dispatchSpeechEvent as a result of this action.
oldState - the old state of this SynthesizernewState - the new state of this SynthesizerfireQueueEmptied(javax.speech.synthesis.SynthesizerEvent),
dispatchSpeechEvent(javax.speech.SpeechEvent)public void fireQueueEmptied(javax.speech.synthesis.SynthesizerEvent event)
QUEUE_EMPTIED
event to all SynthesizerListeners.
event - the QUEUE_EMPTIED eventpostQueueEmptied(long, long),
dispatchSpeechEvent(javax.speech.SpeechEvent)public void dispatchSpeechEvent(javax.speech.SpeechEvent event)
SpeechEvent.
The dispatcher should notify all SynthesizerListeners
from this method. The SpeechEvent was added
via the various post methods of this class.
dispatchSpeechEvent in interface SpeechEventDispatcherdispatchSpeechEvent in class BaseEngineevent - the SpeechEvent to dispatchpostQueueUpdated(boolean, long, long),
postQueueEmptied(long, long)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||