Package javax.speech

Examples of javax.speech.EngineList


//    }
   
    //-----------
     FreeTTSEngineCentral central = new FreeTTSEngineCentral();
    
     EngineList list = central.createEngineList(unlimitedDesc);

     if (list.size() > 0) {
     EngineCreate creator = (EngineCreate) list.get(0);
     synthesizer1 = (Synthesizer) creator.createEngine();
     }

     if (synthesizer1 == null) {
       throw new InstantiationException(noSynthesizerMessage("unlimited domain synthesizer"));
View Full Code Here


    /**
     * Creates a FreeTTS synthesizer.
     */
    public void createSynthesizers() {
  try {
      EngineList list = Central.availableSynthesizers(null);
      Enumeration e = list.elements();

      while (e.hasMoreElements()) {
    MySynthesizerModeDesc myModeDesc =
        new MySynthesizerModeDesc
        ((SynthesizerModeDesc) e.nextElement(), this);
View Full Code Here

                                        Locale.US,
                                        Boolean.FALSE,
                                        null);

            FreeTTSEngineCentral central = new FreeTTSEngineCentral();
            EngineList list = central.createEngineList(desc);
           
            if (list.size() > 0) {
                EngineCreate creator = (EngineCreate) list.get(0);
                synthesizer = (Synthesizer) creator.createEngine();
            }
            if (synthesizer == null) {
                System.err.println("Cannot create synthesizer");
                System.exit(1);
View Full Code Here

     * @param require the required characteristics; <code>null</code>
     *   always matches      
     */
    public EngineList createEngineList(EngineModeDesc require) {
        if (require == null || textModeDesc.match(require)) {
            EngineList el = new EngineList();
            el.addElement(textModeDesc);
            return el;
        }
        return null;
    }
View Full Code Here

     *
     * @return an engineList containing matching engines, or null if
     *    no matching engines are found
     */
    public EngineList createEngineList(EngineModeDesc require) {
  EngineList el = new EngineList();

        com.sun.speech.freetts.VoiceManager voiceManager =
            com.sun.speech.freetts.VoiceManager.getInstance();
       
        com.sun.speech.freetts.Voice[] voices = voiceManager.getVoices();

        // We want to get all combinations of domains and locales
        Vector domainLocaleVector = new Vector();
        for (int i = 0; i < voices.length; i++) {
            DomainLocale dl =
                new DomainLocale(voices[i].getDomain(), voices[i].getLocale());
            DomainLocale dlentry = (DomainLocale)
                getItem(domainLocaleVector, dl);
            if (dlentry == null) {
                domainLocaleVector.add(dl);
                dlentry = dl;
            }
            dlentry.addVoice(voices[i]);
        }

        // build list of SynthesizerModeDesc's for each domain/locale
        // combination
        for (int i = 0; i < domainLocaleVector.size(); i++) {
            DomainLocale dl = (DomainLocale) domainLocaleVector.get(i);

            FreeTTSSynthesizerModeDesc desc = new
                FreeTTSSynthesizerModeDesc("FreeTTS "
                        + dl.getLocale().toString() + " " + dl.getDomain()
                        + " synthesizer", dl.getDomain(), dl.getLocale());

            // iterate through the voices in a different order
            voices = dl.getVoices();
            for (int j = 0; j < voices.length; j++) {
                FreeTTSVoice jsapiVoice = new FreeTTSVoice(voices[j], null);
                desc.addVoice(jsapiVoice);
            }

            if (require == null || desc.match(require)) {
                try {
                    desc.validate();
                    el.addElement(desc);
                } catch (ValidationException ve) {
                    System.err.println(ve.getMessage());
                }
            }
        }

        if (el.size() == 0) {
            el = null;
        }
        return el;
    }
View Full Code Here

        /* Contact the primary entry point for JSAPI, which is
         * the Central class, to discover what synthesizers are
         * available that match the template we defined above.
         */
        EngineList engineList = Central.availableSynthesizers(required);
        for (int i = 0; i < engineList.size(); i++) {
           
            SynthesizerModeDesc desc = (SynthesizerModeDesc) engineList.get(i);
            System.out.println("    " + desc.getEngineName()
                               + " (mode=" + desc.getModeName()
                               + ", locale=" + desc.getLocale() + "):");
            Voice[] voices = desc.getVoices();
            for (int j = 0; j < voices.length; j++) {
View Full Code Here

    static public SynthesizerModeDesc getSynthesizerModeDesc(
        Component component,
  String appName) {
  List synths = new java.util.ArrayList();
  List synthNames = new java.util.ArrayList();
  EngineList list = Central.availableSynthesizers(null);
  Enumeration e = list.elements();
  while (e.hasMoreElements()) {
            synths.add(((SynthesizerModeDesc) e.nextElement()));
            synthNames.add(
                ((SynthesizerModeDesc)
                 synths.get(synths.size() - 1)).getEngineName());
View Full Code Here

    }

    public static void listAllVoices(String modeName) {
        System.out.println("All " + modeName + " Mode JSAPI Synthesizers and Voices:");
        SynthesizerModeDesc required = new SynthesizerModeDesc(null, modeName, Locale.US, null, null);
        EngineList engineList = Central.availableSynthesizers(required);
        for (int i = 0; i < engineList.size(); i++) {
            SynthesizerModeDesc desc = (SynthesizerModeDesc) engineList.get(i);
            System.out.println("    " + desc.getEngineName() + " (mode=" + desc.getModeName() + ", locale="
                    + desc.getLocale() + "):");
            Voice voices[] = desc.getVoices();
            for (int j = 0; j < voices.length; j++)
                System.out.println("        " + voices[j].getName());
View Full Code Here

    /**
     * Creates a FreeTTS synthesizer.
     */
    public void createSynthesizers() {
  try {
      EngineList list = Central.availableSynthesizers(null);
      Enumeration e = list.elements();

      while (e.hasMoreElements()) {
    MySynthesizerModeDesc myModeDesc =
        new MySynthesizerModeDesc
        ((SynthesizerModeDesc) e.nextElement(), this);
View Full Code Here

TOP

Related Classes of javax.speech.EngineList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.