Class BaseSynthesizerQueueItem

SynthesizerQueueItem
com.sun.speech.engine.synthesis.BaseSynthesizerQueueItem
All Implemented Interfaces:
SpeechEventDispatcher
Direct Known Subclasses:
FreeTTSSynthesizerQueueItem, TextSynthesizerQueueItem

public class BaseSynthesizerQueueItem extends SynthesizerQueueItem implements SpeechEventDispatcher
Extends the JSAPI 1.0 SynthesizerQueueItem with handling for JSML, generation of engine-specific text, and other features.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static int
    Global count of queue items used for debug.
    protected BaseSynthesizer
    Synthesizer that has queued this item.
    protected int
    Count for this item used for debug.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Class constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    indicate that this item has been canceled
    void
    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 Document
    Gets the DOM document for this object.
    int
    Gets the item number for debug purposes only.
    protected boolean
    determines if this queue item has been canceled
    boolean
    returns true if this queue item has been processed.
    void
    postMarkerReached(String text, int markerType)
    Utility function that generates a MARKER_REACHED event and posts it to the event queue.
    void
    Utility function that generates a SPEAKABLE_CANCELLED event and posts it to the event queue.
    void
    Utility function that generates a SPEAKABLE_ENDED event and posts it to the event queue.
    void
    Utility function that generates a SPEAKABLE_PAUSED event and posts it to the event queue.
    void
    Utility function that generates a SPEAKABLE_RESUMED event and posts it to the event queue.
    void
    Utility function that generates a SPEAKABLE_STARTED event and posts it to the event queue.
    void
    Utility function that generates a TOP_OF_QUEUE event and posts it to the event queue.
    void
    postWordStarted(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, 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, 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
    indicate that this item has been started
    boolean
    wait for this queue item to be completed
  • Field Details

    • 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 Details

    • BaseSynthesizerQueueItem

      public BaseSynthesizerQueueItem()
      Class constructor.
  • Method Details

    • 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
    • setData

      protected void setData(BaseSynthesizer synth, 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
    • setData

      protected void setData(BaseSynthesizer synth, URL source, SpeakableListener listener) throws JSMLException, 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
    • getDocument

      protected 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(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:
    • 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:
    • postSpeakableCancelled

      public void postSpeakableCancelled()
      Utility function that generates a SPEAKABLE_CANCELLED event and posts it to the event queue. Eventually fireSpeakableCancelled will be called by dispatchSpeechEvent as a result of this action.
      See Also:
    • 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:
    • postSpeakableEnded

      public void postSpeakableEnded()
      Utility function that generates a SPEAKABLE_ENDED event and posts it to the event queue. Eventually fireSpeakableEnded will be called by dispatchSpeechEvent as a result of this action.
      See Also:
    • 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:
    • postSpeakablePaused

      public void postSpeakablePaused()
      Utility function that generates a SPEAKABLE_PAUSED event and posts it to the event queue. Eventually fireSpeakablePaused will be called by dispatchSpeechEvent as a result of this action.
      See Also:
    • 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:
    • postSpeakableResumed

      public void postSpeakableResumed()
      Utility function that generates a SPEAKABLE_RESUMED event and posts it to the event queue. Eventually fireSpeakableResumed will be called by dispatchSpeechEvent as a result of this action.
      See Also:
    • 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:
    • postSpeakableStarted

      public void postSpeakableStarted()
      Utility function that generates a SPEAKABLE_STARTED event and posts it to the event queue. Eventually fireSpeakableStarted will be called by dispatchSpeechEvent as a result of this action.
      See Also:
    • 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:
    • postTopOfQueue

      public void postTopOfQueue()
      Utility function that generates a TOP_OF_QUEUE event and posts it to the event queue. Eventually fireTopOfQueue will be called by dispatchSpeechEvent as a result of this action.
      See Also:
    • 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:
    • postWordStarted

      public void postWordStarted(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

      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:
    • dispatchSpeechEvent

      public void dispatchSpeechEvent(SpeechEvent event)
      Dispatches a SpeechEvent. The dispatcher should notify all EngineListeners from this method. The SpeechEvent was added via the various post methods of this class.
      Specified by:
      dispatchSpeechEvent in interface SpeechEventDispatcher
      Parameters:
      event - the SpeechEvent to dispatch
      See Also: