upstream version 1.2.2
[debian/freetts] / com / sun / speech / engine / synthesis / text / TextSynthesizerModeDesc.java
1 /**
2  * Copyright 2001 Sun Microsystems, Inc.
3  * 
4  * See the file "license.terms" for information on usage and
5  * redistribution of this file, and for a DISCLAIMER OF ALL 
6  * WARRANTIES.
7  */
8 package com.sun.speech.engine.synthesis.text;
9
10 import java.util.Locale;
11
12 import javax.speech.Engine;
13 import javax.speech.EngineCreate;
14 import javax.speech.EngineException;
15 import javax.speech.synthesis.SynthesizerModeDesc;
16 import javax.speech.synthesis.Voice;
17
18 import com.sun.speech.engine.synthesis.BaseVoice;
19
20 /**
21  * Describes the <code>TextSynthesizer</code>.   Builds up the
22  * voice list and other data.
23  */
24 public class TextSynthesizerModeDesc extends SynthesizerModeDesc 
25     implements EngineCreate {
26     
27     /**
28      * Class constructor.
29      */
30     public TextSynthesizerModeDesc() {
31         super("Text Synthesizer",               // engine name
32               "simple text output",             // mode name
33               Locale.getDefault(),
34               Boolean.FALSE,                    // running?
35               null);                            // voice[]
36
37         // Add voices known to this synthesizer.
38         addVoice(new BaseVoice("Mike-1", "Mike", Voice.GENDER_MALE, 
39                                Voice.AGE_MIDDLE_ADULT, "standard",
40                                120.0f, 50.0f, 150.0f, 1.0f));
41         addVoice(new BaseVoice("Peter-2", "Peter", Voice.GENDER_MALE,  
42                                Voice.AGE_YOUNGER_ADULT, "standard",
43                                135.0f, 34.0f, 165.0f, 1.0f));
44         addVoice(new BaseVoice("Paul-3", "Paul", Voice.GENDER_MALE,  
45                                Voice.AGE_MIDDLE_ADULT, "standard",
46                                90.0f, 30.0f, 120.0f, 1.0f));
47         addVoice(new BaseVoice("Mary-4", "Mary", Voice.GENDER_FEMALE,  
48                                Voice.AGE_OLDER_ADULT, "standard",
49                                200.0f, 80.0f, 190.0f, 1.0f));
50     }
51
52     /**
53      * Constructs a text synthesizer with the properties of this mode
54      * desc.
55      * 
56      * @throws IllegalArgumentException
57      * @throws EngineException
58      * @throws SecurityException
59      */
60     public Engine createEngine()
61         throws IllegalArgumentException, EngineException, SecurityException {
62         TextSynthesizer s = new TextSynthesizer(this);
63         if (s == null) {
64             throw new EngineException();
65         }
66         return s;
67     }
68 }