Class VoiceManager
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if there is a voice provides with the given name.static VoiceManager
Gets the instance of the VoiceManagerGet a Voice with a given name.static URLClassLoader
Gets the class loader used for loading dynamically detected jars.Prints detailed information about all available voices.Voice[]
Provide an array of all voices available to FreeTTS.toString()
Provides a string representation of all voices available to FreeTTS.
-
Method Details
-
getInstance
Gets the instance of the VoiceManager- Returns:
- a VoiceManager
-
getVoices
Provide an array of all voices available to FreeTTS. First, if the "freetts.voices" property is set, it is assumed to be a comma-separated list of VoiceDirectory classnames (e.g., "-Dfreetts.voices=com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory" ). If this property exists, the VoiceManager will use only this property to find voices -- no other method described below will be used. The primary purpose for this property is testing and for use with WebStart.Second, the file internal_voices.txt is looked for in the same directory as VoiceManager.class. If the file does not exist, the VoiceManager moves on. Next, it looks for voices.txt in the same directory as freetts.jar. If the file does not exist, the VoiceManager moves on. Next, if the property "freetts.voicesfile" is defined, then that file is read in. If the property is defined and the file does not exist, then an error is raised.
Every voices file that is read in contains a list of VoiceDirectory class names.
Next, the voice manager looks for freetts voice jarfiles that may exist in well-known locations. The directory that contains freetts.jar is searched for voice jarfiles, then directories specified by the "freetts.voicespath" system property. Any jarfile whose Manifest contains "FreeTTSVoiceDefinition: true" is assumed to be a FreeTTS voice, and the Manifest's "Main-Class" entry is assumed to be the name of the voice directory. The dependencies of the voice jarfiles specified by the "Class-Path" Manifest entry are also loaded.
The VoiceManager instantiates each voice directory and calls getVoices() on each.
- Returns:
- the array of new instances of all available voices
-
getVoiceInfo
Prints detailed information about all available voices.- Returns:
- a String containing the information
-
toString
Provides a string representation of all voices available to FreeTTS. -
contains
Check if there is a voice provides with the given name.- Parameters:
voiceName
- the name of the voice to check- Returns:
- true if FreeTTS has a voice available with the name voiceName, else false.
-
getVoice
Get a Voice with a given name.- Parameters:
voiceName
- the name of the voice to get.- Returns:
- the Voice that has the same name as voiceName if one exists, else null
-
getVoiceClassLoader
Gets the class loader used for loading dynamically detected jars. This is useful to get resources out of jars that may be in the class path of this class loader but not in the class path of the system class loader.- Returns:
- the class loader
-