001/**
002 * Copyright 2001 Sun Microsystems, Inc.
003 * 
004 * See the file "license.terms" for information on usage and
005 * redistribution of this file, and for a DISCLAIMER OF ALL 
006 * WARRANTIES.
007 */
008package com.sun.speech.engine.synthesis.text;
009
010import java.util.Locale;
011
012import javax.speech.Engine;
013import javax.speech.EngineCreate;
014import javax.speech.EngineException;
015import javax.speech.synthesis.SynthesizerModeDesc;
016import javax.speech.synthesis.Voice;
017
018import com.sun.speech.engine.synthesis.BaseVoice;
019
020/**
021 * Describes the <code>TextSynthesizer</code>.   Builds up the
022 * voice list and other data.
023 */
024public class TextSynthesizerModeDesc extends SynthesizerModeDesc 
025    implements EngineCreate {
026    
027    /**
028     * Class constructor.
029     */
030    public TextSynthesizerModeDesc() {
031        super("Text Synthesizer",               // engine name
032              "simple text output",             // mode name
033              Locale.getDefault(),
034              Boolean.FALSE,                    // running?
035              null);                            // voice[]
036
037        // Add voices known to this synthesizer.
038        addVoice(new BaseVoice("Mike-1", "Mike", Voice.GENDER_MALE, 
039                               Voice.AGE_MIDDLE_ADULT, "standard",
040                               120.0f, 50.0f, 150.0f, 1.0f));
041        addVoice(new BaseVoice("Peter-2", "Peter", Voice.GENDER_MALE,  
042                               Voice.AGE_YOUNGER_ADULT, "standard",
043                               135.0f, 34.0f, 165.0f, 1.0f));
044        addVoice(new BaseVoice("Paul-3", "Paul", Voice.GENDER_MALE,  
045                               Voice.AGE_MIDDLE_ADULT, "standard",
046                               90.0f, 30.0f, 120.0f, 1.0f));
047        addVoice(new BaseVoice("Mary-4", "Mary", Voice.GENDER_FEMALE,  
048                               Voice.AGE_OLDER_ADULT, "standard",
049                               200.0f, 80.0f, 190.0f, 1.0f));
050    }
051
052    /**
053     * Constructs a text synthesizer with the properties of this mode
054     * desc.
055     * 
056     * @throws IllegalArgumentException
057     * @throws EngineException
058     * @throws SecurityException
059     */
060    public Engine createEngine()
061        throws IllegalArgumentException, EngineException, SecurityException {
062        TextSynthesizer s = new TextSynthesizer(this);
063        if (s == null) {
064            throw new EngineException();
065        }
066        return s;
067    }
068}