TTS引擎设置如何设置默认语音为德语
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
1.预置条件:
2.操作步骤:
设置->辅助功能->文字转语音(TTS)输出->查看语速和收听试例设置
3.实际结果:
语速和收听试例默认灰显不可选,要在Pico TTS设置下切换一下语言后才变成黑色可选
4.预期结果:
语速和收听试例默认应该是黑色可选
[SOLUTION]
在TextToSpeechSettings.java中添加
private void updateLanguageTo(String locale) {
int selectedLocaleIndex = -1;
mEnginesHelper.updateLocalePrefForEngine(getEngineName(), locale);
// if (getEngineName().equals(mTts.getCurrentEngine())) {
String[] localeArray = TtsEngines.parseLocalePref(locale);
if (localeArray != null) {
mTts.setLanguage(new Locale(localeArray[0], localeArray[1], localeArray[2]));
}
// }
}
private String getEngineName() {
return mCurrentEngine;
}
再修改
public void onInitEngine(int status) {
if (status == TextToSpeech.SUCCESS) {
if (DBG) Log.d(TAG, "TTS engine for settings screen initialized.");
updateLanguageTo("deu-DEU"); //设置默认为德语
checkDefaultLocale();
} else {
if (DBG) Log.d(TAG, "TTS engine for settings screen failed to initialize successfully.");
updateWidgetState(false);
}
}
1.预置条件:
2.操作步骤:
设置->辅助功能->文字转语音(TTS)输出->查看语速和收听试例设置
3.实际结果:
语速和收听试例默认灰显不可选,要在Pico TTS设置下切换一下语言后才变成黑色可选
4.预期结果:
语速和收听试例默认应该是黑色可选
[SOLUTION]
在TextToSpeechSettings.java中添加
private void updateLanguageTo(String locale) {
int selectedLocaleIndex = -1;
mEnginesHelper.updateLocalePrefForEngine(getEngineName(), locale);
// if (getEngineName().equals(mTts.getCurrentEngine())) {
String[] localeArray = TtsEngines.parseLocalePref(locale);
if (localeArray != null) {
mTts.setLanguage(new Locale(localeArray[0], localeArray[1], localeArray[2]));
}
// }
}
private String getEngineName() {
return mCurrentEngine;
}
再修改
public void onInitEngine(int status) {
if (status == TextToSpeech.SUCCESS) {
if (DBG) Log.d(TAG, "TTS engine for settings screen initialized.");
updateLanguageTo("deu-DEU"); //设置默认为德语
checkDefaultLocale();
} else {
if (DBG) Log.d(TAG, "TTS engine for settings screen failed to initialize successfully.");
updateWidgetState(false);
}
}
qiandao