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