Class BaseSynthesizerQueueItem

    • Field Summary

      Fields 
      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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • itemNumber

        protected static int itemNumber
        Global count of queue items used for debug.
      • thisItemNumber

        protected int thisItemNumber
        Count for this item used for debug.
      • synth

        protected BaseSynthesizer synth
        Synthesizer that has queued this item.
    • Constructor Detail

      • BaseSynthesizerQueueItem

        public BaseSynthesizerQueueItem()
        Class constructor.
    • Method Detail

      • setData

        protected void setData​(BaseSynthesizer synth,
                               Speakable source,
                               SpeakableListener listener)
                        throws JSMLException
        Sets queue item data with a Speakable source.
        Parameters:
        synth - the synthesizer
        source - the Speakable
        listener - the SpeakableListener to be notified as this object is processed
        Throws:
        JSMLException - if the source contains JSML errors
      • setData

        protected void setData​(BaseSynthesizer synth,
                               java.lang.String source,
                               boolean plainText,
                               SpeakableListener listener)
                        throws JSMLException
        Sets queue item data with a String source that is either plain text or JSML.
        Parameters:
        synth - the synthesizer
        source - the text
        plainText - true only if the source is plain text
        listener - the SpeakableListener to be notified as this object is processed
        Throws:
        JSMLException - if the source contains JSML errors
      • setData

        protected void setData​(BaseSynthesizer synth,
                               java.net.URL source,
                               SpeakableListener listener)
                        throws JSMLException,
                               java.io.IOException
        Sets queue item data with a URL source.
        Parameters:
        synth - the synthesizer
        source - the URL containing JSML text
        listener - the SpeakableListener to be notified as this object is processed
        Throws:
        JSMLException - if the source contains JSML errors
        java.io.IOException - if there are problems working with the URL.
      • getDocument

        protected org.w3c.dom.Document getDocument()
        Gets the DOM document for this object.
        Returns:
        the DOM document for this object.
      • isCancelled

        protected boolean isCancelled()
        determines if this queue item has been canceled
        Returns:
        true if this item has been canceled; otherwise false
      • isCompleted

        public boolean isCompleted()
        returns true if this queue item has been processed.
        Returns:
        true if it has been processed
      • waitCompleted

        public boolean waitCompleted()
        wait for this queue item to be completed
        Returns:
        true if the item was completed successfully, false if the item was canceled or an error occurred.
      • cancelled

        public void cancelled()
        indicate that this item has been canceled
      • completed

        public void completed()
        indicate that this item has been completed
      • started

        public void started()
        indicate that this item has been started
      • getItemNumber

        public int getItemNumber()
        Gets the item number for debug purposes only. Each queue item is given a unique ID.
        Returns:
        the unique ID for this queue item
      • postMarkerReached

        public void postMarkerReached​(java.lang.String text,
                                      int markerType)
        Utility function that generates a MARKER_REACHED event and posts it to the event queue. Eventually fireMarkerReached will be called by dispatchSpeechEvent as a result of this action.
        Parameters:
        text - the text of the marker
        markerType - the type of marker
        See Also:
        SpeakableEvent#getMarkerType, fireMarkerReached(SpeakableEvent), dispatchSpeechEvent(SpeechEvent)
      • fireMarkerReached

        public void fireMarkerReached​(SpeakableEvent event)
        Utility function that sends a MARKER_REACHED event to all speakable listeners.
        Parameters:
        event - the MARKER_REACHED event
        See Also:
        postMarkerReached(java.lang.String, int)
      • fireSpeakableCancelled

        public void fireSpeakableCancelled​(SpeakableEvent event)
        Utility function that sends a SPEAKABLE_CANCELLED event to all speakable listeners.
        Parameters:
        event - the SPEAKABLE_CANCELLED event
        See Also:
        postSpeakableCancelled()
      • fireSpeakableEnded

        public void fireSpeakableEnded​(SpeakableEvent event)
        Utility function that sends a SPEAKABLE_ENDED event to all speakable listeners.
        Parameters:
        event - the SPEAKABLE_ENDED event
        See Also:
        postSpeakableEnded()
      • fireSpeakablePaused

        public void fireSpeakablePaused​(SpeakableEvent event)
        Utility function that sends a SPEAKABLE_PAUSED event to all speakable listeners.
        Parameters:
        event - the SPEAKABLE_PAUSED event
        See Also:
        postSpeakablePaused()
      • fireSpeakableResumed

        public void fireSpeakableResumed​(SpeakableEvent event)
        Utility function that sends a SPEAKABLE_RESUMED event to all speakable listeners.
        Parameters:
        event - the SPEAKABLE_RESUMED event
        See Also:
        postSpeakableResumed()
      • fireSpeakableStarted

        public void fireSpeakableStarted​(SpeakableEvent event)
        Utility function that sends a SPEAKABLE_STARTED event to all speakable listeners.
        Parameters:
        event - the SPEAKABLE_STARTED event
        See Also:
        postSpeakableStarted()
      • fireTopOfQueue

        public void fireTopOfQueue​(SpeakableEvent event)
        Utility function that sends a TOP_OF_QUEUE event to all speakable listeners.
        Parameters:
        event - the TOP_OF_QUEUE event
        See Also:
        postTopOfQueue()
      • postWordStarted

        public 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. Eventually fireWordStarted will be called by dispatchSpeechEvent as a result of this action.
        See Also:
        fireWordStarted(SpeakableEvent), dispatchSpeechEvent(SpeechEvent)
      • fireWordStarted

        public void fireWordStarted​(SpeakableEvent event)
        Utility function that sends a WORD_STARTED event to all speakable listeners.
        Parameters:
        event - the WORD_STARTED event
        See Also:
        postWordStarted(java.lang.String, int, int)