當前位置: 首頁>>代碼示例>>Java>>正文


Java Utilities類代碼示例

本文整理匯總了Java中com.sun.speech.freetts.util.Utilities的典型用法代碼示例。如果您正苦於以下問題:Java Utilities類的具體用法?Java Utilities怎麽用?Java Utilities使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Utilities類屬於com.sun.speech.freetts.util包,在下文中一共展示了Utilities類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadVoice

import com.sun.speech.freetts.util.Utilities; //導入依賴的package包/類
public void loadVoice() {
    try {
        //File mbrola = new File(Info.PATH_DEVICES_FOLDER + "/freetts/data/voices/");
        //if ((mbrola.exists())) {
        //System.setProperty("mbrola.base", mbrola.getAbsolutePath().toString());
        //voice = VoiceManager.getInstance().getVoice(configuration.getProperty("mbrola-voice"));
        //} else {
        //use default basic voices
        System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
        voice = VoiceManager.getInstance().getVoice(Utilities.getProperty("voice16kName", "kevin16"));
        voice = VoiceManager.getInstance().getVoice("kevin16");
        //}
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice[] voices = voiceManager.getVoices();
        if (voices.length <= 0) {
            LOG.error("Cannot use text to speech, no voice found");
            setDescription("Cannot use text to speech, no voice found");
            stop();
        } else {
            voice.allocate();
        }
    } catch (Exception e) {
        LOG.error(Freedomotic.getStackTraceInfo(e));
    }
}
 
開發者ID:freedomotic,項目名稱:freedomotic,代碼行數:26,代碼來源:TextToSpeech.java


注:本文中的com.sun.speech.freetts.util.Utilities類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。