Class TextSynthesizer

All Implemented Interfaces:
SpeechEventDispatcher

public class TextSynthesizer extends BaseSynthesizer
Supports a simple text-output-only JSAPI 1.0 Synthesizer. 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.
  • Constructor Details

    • TextSynthesizer

      public TextSynthesizer(SynthesizerModeDesc desc)
      Creates a new Synthesizer in the DEALLOCATED state.
      Parameters:
      desc - the operating mode
  • Method Details

    • handleAllocate

      protected void handleAllocate()
      Starts the output thread.
      Specified by:
      handleAllocate in class BaseEngine
      See Also:
    • handleDeallocate

      protected void handleDeallocate()
      Stops the output thread.
      Specified by:
      handleDeallocate in class BaseEngine
    • createQueueItem

      protected BaseSynthesizerQueueItem createQueueItem()
      Creates a TextSynthesizerQueueItem.
      Overrides:
      createQueueItem in class BaseSynthesizer
      Returns:
      a TextSynthesizerQueueItem
    • enumerateQueue

      public Enumeration enumerateQueue() throws EngineStateError
      Returns an enumeration of the queue.
      Specified by:
      enumerateQueue in class BaseSynthesizer
      Returns:
      an Enumeration of the speech output queue or null.
      Throws:
      EngineStateError - if this Synthesizer in the DEALLOCATED or DEALLOCATING_RESOURCES states
    • appendQueue

      protected void appendQueue(BaseSynthesizerQueueItem item)
      Puts an item on the speaking queue and sends a queue updated event. Expects only TextSynthesizerQueueItems.
      Specified by:
      appendQueue in class BaseSynthesizer
      Parameters:
      item - the item to add to the queue
    • cancel

      public void cancel() throws EngineStateError
      Cancels the item at the top of the queue.
      Specified by:
      cancel in class BaseSynthesizer
      Throws:
      EngineStateError - if this Synthesizer in the DEALLOCATED or DEALLOCATING_RESOURCES states
    • cancel

      public void cancel(Object source) throws IllegalArgumentException, EngineStateError
      Cancels a specific object on the queue.
      Specified by:
      cancel in class BaseSynthesizer
      Parameters:
      source - object to be removed from the speech output queue
      Throws:
      IllegalArgumentException - if the source object is not found in the speech output queue.
      EngineStateError - if this Synthesizer in the DEALLOCATED or DEALLOCATING_RESOURCES states
    • cancelAll

      public void cancelAll() throws EngineStateError
      Cancels all items on the output queue.
      Specified by:
      cancelAll in class BaseSynthesizer
      Throws:
      EngineStateError - if this Synthesizer in the DEALLOCATED or DEALLOCATING_RESOURCES states
    • handlePause

      protected void handlePause()
      Pauses the output.
      Specified by:
      handlePause in class BaseEngine
    • handleResume

      protected void handleResume()
      Resumes the output.
      Specified by:
      handleResume in class BaseEngine