Class TextSynthesizer
- java.lang.Object
-
- com.sun.speech.engine.BaseEngine
-
- com.sun.speech.engine.synthesis.BaseSynthesizer
-
- com.sun.speech.engine.synthesis.text.TextSynthesizer
-
- All Implemented Interfaces:
SpeechEventDispatcher
public class TextSynthesizer extends BaseSynthesizer
Supports a simple text-output-only JSAPI 1.0Synthesizer. Intended for demonstration purposes for those developing JSAPI implementations. It may also be useful to developers who want a JSAPI synthesizer that doesn't produce any noise.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classTextSynthesizer.OutputHandlerThe output device for aTextSynthesizer.
-
Field Summary
-
Fields inherited from class com.sun.speech.engine.synthesis.BaseSynthesizer
speakableListeners, voiceList
-
Fields inherited from class com.sun.speech.engine.BaseEngine
audioManager, CLEAR_ALL_STATE, engineListeners, engineModeDesc, engineProperties, engineState, engineStateLock
-
-
Constructor Summary
Constructors Constructor Description TextSynthesizer(SynthesizerModeDesc desc)Creates a new Synthesizer in the DEALLOCATED state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendQueue(BaseSynthesizerQueueItem item)Puts an item on the speaking queue and sends a queue updated event.voidcancel()Cancels the item at the top of the queue.voidcancel(java.lang.Object source)Cancels a specific object on the queue.voidcancelAll()Cancels all items on the output queue.protected BaseSynthesizerQueueItemcreateQueueItem()Creates a TextSynthesizerQueueItem.java.util.EnumerationenumerateQueue()Returns an enumeration of the queue.protected voidhandleAllocate()Starts the output thread.protected voidhandleDeallocate()Stops the output thread.protected voidhandlePause()Pauses the output.protected voidhandleResume()Resumes the output.-
Methods inherited from class com.sun.speech.engine.synthesis.BaseSynthesizer
addSpeakableListener, createEngineProperties, dispatchSpeechEvent, fireQueueEmptied, fireQueueUpdated, getSynthesizerProperties, getVoiceList, phoneme, postQueueEmptied, postQueueUpdated, removeSpeakableListener, speak, speak, speak, speakPlainText, stateToString
-
Methods inherited from class com.sun.speech.engine.BaseEngine
addEngineListener, allocate, checkEngineState, deallocate, fireEngineAllocated, fireEngineAllocatingResources, fireEngineDeallocated, fireEngineDeallocatingResources, fireEnginePaused, fireEngineResumed, getAudioManager, getEngineModeDesc, getEngineProperties, getEngineState, getVocabManager, pause, postEngineAllocated, postEngineAllocatingResources, postEngineDeallocated, postEngineDeallocatingResources, postEnginePaused, postEngineResumed, removeEngineListener, resume, setEngineModeDesc, setEngineState, testEngineState, toString, waitEngineState
-
-
-
-
Method Detail
-
handleAllocate
protected void handleAllocate()
Starts the output thread.- Specified by:
handleAllocatein classBaseEngine- See Also:
BaseEngine.allocate()
-
handleDeallocate
protected void handleDeallocate()
Stops the output thread.- Specified by:
handleDeallocatein classBaseEngine
-
createQueueItem
protected BaseSynthesizerQueueItem createQueueItem()
Creates a TextSynthesizerQueueItem.- Overrides:
createQueueItemin classBaseSynthesizer- Returns:
- a TextSynthesizerQueueItem
-
enumerateQueue
public java.util.Enumeration enumerateQueue() throws EngineStateErrorReturns an enumeration of the queue.- Specified by:
enumerateQueuein classBaseSynthesizer- Returns:
- an
Enumerationof the speech output queue ornull. - Throws:
EngineStateError- if thisSynthesizerin theDEALLOCATEDorDEALLOCATING_RESOURCESstates
-
appendQueue
protected void appendQueue(BaseSynthesizerQueueItem item)
Puts an item on the speaking queue and sends a queue updated event. Expects onlyTextSynthesizerQueueItems.- Specified by:
appendQueuein classBaseSynthesizer- Parameters:
item- the item to add to the queue
-
cancel
public void cancel() throws EngineStateErrorCancels the item at the top of the queue.- Specified by:
cancelin classBaseSynthesizer- Throws:
EngineStateError- if thisSynthesizerin theDEALLOCATEDorDEALLOCATING_RESOURCESstates
-
cancel
public void cancel(java.lang.Object source) throws java.lang.IllegalArgumentException, EngineStateErrorCancels a specific object on the queue.- Specified by:
cancelin classBaseSynthesizer- Parameters:
source- object to be removed from the speech output queue- Throws:
java.lang.IllegalArgumentException- if the source object is not found in the speech output queue.EngineStateError- if thisSynthesizerin theDEALLOCATEDorDEALLOCATING_RESOURCESstates
-
cancelAll
public void cancelAll() throws EngineStateErrorCancels all items on the output queue.- Specified by:
cancelAllin classBaseSynthesizer- Throws:
EngineStateError- if thisSynthesizerin theDEALLOCATEDorDEALLOCATING_RESOURCESstates
-
handlePause
protected void handlePause()
Pauses the output.- Specified by:
handlePausein classBaseEngine
-
handleResume
protected void handleResume()
Resumes the output.- Specified by:
handleResumein classBaseEngine
-
-