本文整理匯總了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));
}
}