JSAPI 2.0

javax.speech.synthesis
Class SynthesizerMode

Object
  extended by EngineMode
      extended by SynthesizerMode

public class SynthesizerMode
extends EngineMode

Provides information about a specific operating mode of a Synthesizer. SynthesizerMode extends EngineMode with features specific to speech synthesizers.

Like EngineMode, there are two types of SynthesizerMode objects: those created by the EngineManager or returned by a Synthesizer instance and those created by an application. Engine-created SynthesizerMode objects are obtained from the EngineManager through the availableEngines method. They are also returned from a Synthesizer instance with the getEngineMode method. For Engine-created SynthesizerMode objects, all features will be set to non-null values.

Applications can create SynthesizerMode objects using the appropriate constructor. Applications may leave any or all of the feature values null to indicate "don't care". Typically, application-created SynthesizerModes are used to test the Engine-created SynthesizerModes to select an appropriate synthesizer for creation.

The EngineMode class describes additional detail on Engine selection.

Engine creation is described in the documentation for the EngineManager class.

See Also:
Engine, Synthesizer, getEngineMode, EngineMode, EngineManager, availableEngines, createEngine

Field Summary
static SynthesizerMode DEFAULT
          SynthesizerMode with all mode features set to "don't care" values.
 
Constructor Summary
SynthesizerMode()
          Constructs a SynthesizerMode with all mode features set to don't care values.
SynthesizerMode(SpeechLocale locale)
          Constructs a SynthesizerMode with a given SpeechLocale and other features set to don't care values.
SynthesizerMode(String engineName, String modeName, Boolean running, Boolean supportsLetterToSound, Boolean supportsMarkup, Voice[] voices)
          Constructs a SynthesizerMode with the specified mode features.
 
Method Summary
 boolean equals(Object mode)
          Returns true if and only if the mode parameter is not null and has equal values of all mode features with this EngineMode.
 Boolean getSupportsMarkup()
          Gets the supports markup feature.
 Voice[] getVoices()
          Returns the list of Voices specified in this SynthesizerMode.
 int hashCode()
          Returns a hash code value for the object.
 boolean match(EngineMode require)
          Determines whether a SynthesizerMode has all the features specified by the require object.
 String toString()
          Returns a String representation of this SynthesizerMode.
 
Methods inherited from class EngineMode
getEngineName, getModeName, getRunning, getSupportsLetterToSound
 
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT

public static final SynthesizerMode DEFAULT
SynthesizerMode with all mode features set to "don't care" values. This can be used to select a default Synthesizer with EngineManager.createEngine. The documentation for the Synthesizer interface includes an example of this.

See Also:
Synthesizer, EngineManager, createEngine
Constructor Detail

SynthesizerMode

public SynthesizerMode()
Constructs a SynthesizerMode with all mode features set to don't care values.

See Also:
SynthesizerMode(String, String, Boolean, Boolean, Boolean, Voice[])

SynthesizerMode

public SynthesizerMode(SpeechLocale locale)
Constructs a SynthesizerMode with a given SpeechLocale and other features set to don't care values.

This is a convenience constructor where the locale is used to construct a Voice list of length one where the Voice contains the locale and other features are null.

Parameters:
locale - the desired SpeechLocale
See Also:
Voice, SynthesizerMode(String, String, Boolean, Boolean, Boolean, Voice[])

SynthesizerMode

public SynthesizerMode(String engineName,
                       String modeName,
                       Boolean running,
                       Boolean supportsLetterToSound,
                       Boolean supportsMarkup,
                       Voice[] voices)
Constructs a SynthesizerMode with the specified mode features.

Sets engineName, modeName, running, supportsLetterToSound, and supportsMarkup all to the specified values. Any parameter may be null to signify "don't care".

The order of the Voices determines their preference order.

Parameters:
engineName - the desired engine name
modeName - the desired mode name
running - a flag specifying a running engine
supportsLetterToSound - a flag specifying letter to sound support
supportsMarkup - a flag specifying markup support
voices - the desired set of Voices
See Also:
getEngineName, getModeName, getRunning, getSupportsLetterToSound, getSupportsMarkup, getVoices, Voice, match
Method Detail

equals

public boolean equals(Object mode)
Returns true if and only if the mode parameter is not null and has equal values of all mode features with this EngineMode.

Overrides:
equals in class EngineMode
Parameters:
mode - an EngineMode to compare
Returns:
true if mode equals this EngineMode

getSupportsMarkup

public Boolean getSupportsMarkup()
Gets the supports markup feature. An Engine that supports markup can properly interpret markup passed to the Engine (true). Some Engines do not expect to receive markup at all (false).

In an application-generated EngineMode, a null value means "don't care". An Engine-generated EngineMode never returns null.

The class description describes how features may be used to select an Engine or request information about a specific Engine.

When this feature is false for a Synthesizer, the speakMarkup and speak methods that accept markup will ignore the markup when called and render the associated text as plain text.

Overrides:
getSupportsMarkup in class EngineMode
Returns:
the value of the supports markup feature
See Also:
speak, speakMarkup

getVoices

public Voice[] getVoices()
Returns the list of Voices specified in this SynthesizerMode.

Synthesizers use the order of the list as a preference order to select Voices.

In application generated EngineModes, a null value means "don't care". Engine generated EngineModes never return null values.

The EngineManager class describes how features may be used to select an Engine or request information about a specific Engine.

Returns:
list of available Voices

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables.

Overrides:
hashCode in class EngineMode
Returns:
a hash code value for the object

match

public boolean match(EngineMode require)
Determines whether a SynthesizerMode has all the features specified by the require object. Features in require which are null are not tested. All String comparisons are exact (case-sensitive).

The parameters are used as follows:

Note that it is possible to compare an EngineMode against a SynthesizerMode and vice versa.

Overrides:
match in class EngineMode
Parameters:
require - the SynthesizerMode to match against
Returns:
true if all the specified features in require match
See Also:
Voice, Voice.match

toString

public String toString()
Returns a String representation of this SynthesizerMode.

The exact details of the representation are unspecified and subject to change.

Overrides:
toString in class EngineMode
Returns:
a String representation of this SynthesizerMode

JSAPI 2.0

JavaTM Speech API 2.0, Final Release v2.0.6.
© 2008, Conversay and Sun Microsystems.

Free Web Hosting