use of com.ichi2.bd.InitConfig in project AnkiChinaAndroid by ankichinateam.
the class AbstractFlashcardViewer method getInitConfig.
protected InitConfig getInitConfig(SpeechSynthesizerListener listener) {
Map<String, String> params = getParams();
// 添加你自己的参数
InitConfig initConfig;
// appId appKey secretKey 网站上您申请的应用获取。注意使用离线合成功能的话,需要应用中填写您app的包名。包名在build.gradle中获取。
if (sn == null) {
initConfig = new InitConfig(appId, appKey, secretKey, ttsMode, params, listener);
} else {
initConfig = new InitConfig(appId, appKey, secretKey, sn, ttsMode, params, listener);
}
return initConfig;
}
use of com.ichi2.bd.InitConfig in project AnkiChinaAndroid by ankichinateam.
the class AbstractFlashcardViewer method initBDTTs.
private void initBDTTs() {
appId = Auth.getInstance(this).getAppId();
appKey = Auth.getInstance(this).getAppKey();
secretKey = Auth.getInstance(this).getSecretKey();
// 离线合成SDK必须有此参数;在线合成SDK没有此参数
sn = Auth.getInstance(this).getSn();
// 日志打印在logcat中
LoggerProxy.printable(true);
String tmpDir = FileUtil.createTmpDir(this);
// 设置初始化参数
// 此处可以改为 含有您业务逻辑的SpeechSynthesizerListener的实现类
SpeechSynthesizerListener listener = new FileSaveListener(mainHandler, tmpDir);
InitConfig config = getInitConfig(listener);
// 此处可以改为MySyntherizer 了解调用过程
synthesizer = new NonBlockSyntherizer(this, config, mainHandler);
if (!isOnlineSDK) {
Timber.i("SynthActivity" + "so version:" + SynthesizerTool.getEngineInfo());
}
}
Aggregations