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 Detail

      • TextSynthesizer

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

      • handleDeallocate

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

        public java.util.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​(java.lang.Object source)
                    throws java.lang.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:
        java.lang.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