Package com.sun.speech.engine.synthesis

# Class VoiceList

java.lang.Object
com.sun.speech.engine.synthesis.VoiceList

public class VoiceList extends Object
Maintains a list of JSAPI 1.0 `Voices`.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final List`
`voiceList`
The list of `Voices`.

## Constructor Summary

Constructors
Constructor
Description
`VoiceList()`
Class constructor.
`VoiceList(SynthesizerModeDesc desc)`
Constructs from the voice list in `desc`.

## Method Summary

Modifier and Type
Method
Description
`void`
`addVoice(BaseVoice voice)`
Adds a voice to the list.
`BaseVoice`
`getVoiceById(String id)`
Gets a voice by its identifier.
`String`
`getVoiceId(String name, int gender, int age, int variant)`
Gets id for voice based on parameters provided in JSML.
`String`
`getVoiceId(Voice voice, int variant)`
Gets the id of a voice.
`void`
`removeVoice(BaseVoice voice)`
Removes a voice from the list.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### voiceList

protected final List voiceList
The list of `Voices`.

## Constructor Details

### VoiceList

public VoiceList()
Class constructor.

### VoiceList

public VoiceList(SynthesizerModeDesc desc)
Constructs from the voice list in `desc`. Requires that all voices in mode desc be instances of `BaseVoice`.

Parameters:
  `desc` - the `SynthesizerModeDesc` to get voices from

## Method Details

### addVoice

public void addVoice(BaseVoice voice)
Adds a voice to the list.

Parameters:
  `voice` - the voice to add
See Also:
  - `removeVoice(com.sun.speech.engine.synthesis.BaseVoice)`

### removeVoice

public void removeVoice(BaseVoice voice)
Removes a voice from the list.

Parameters:
  `voice` - the voice to remove
See Also:
  - `addVoice(com.sun.speech.engine.synthesis.BaseVoice)`

### getVoiceById

public BaseVoice getVoiceById(String id)
Gets a voice by its identifier.

Parameters:
  `id` - the voice id
Returns:
  the voice if it exists; otherwise `null`
See Also:
  - `BaseVoice.getId()`

### getVoiceId

public String getVoiceId(Voice voice, int variant)
Gets the id of a voice.

Parameters:
  `voice` - the voice
  `variant` - the voice variant
Returns:
  the id of the voice

### getVoiceId

public String getVoiceId(String name, int gender, int age, int variant)
Gets id for voice based on parameters provided in JSML. Priority to voice name. Then try to match age and gender plus variant.

Parameters:
  `name` - the voice name
  `gender` - the gender
  `age` - the age
  `variant` - the variant
Returns:
  the voice id
See Also:
  - `BaseVoice`
  - invalid reference

        Voice