本文整理汇总了Java中com.iflytek.cloud.InitListener类的典型用法代码示例。如果您正苦于以下问题:Java InitListener类的具体用法?Java InitListener怎么用?Java InitListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InitListener类属于com.iflytek.cloud包,在下文中一共展示了InitListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.iflytek.cloud.InitListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.isvdemo);
initUi();
mIdVerifier = IdentityVerifier.createVerifier(VocalVerifyDemo.this, new InitListener() {
@Override
public void onInit(int errorCode) {
if (ErrorCode.SUCCESS == errorCode) {
showTip("引擎初始化成功");
} else {
showTip("引擎初始化失败,错误码:" + errorCode);
}
}
});
}
示例2: createSynthesizer
import com.iflytek.cloud.InitListener; //导入依赖的package包/类
private void createSynthesizer() {
mTts = SpeechSynthesizer.createSynthesizer(mContext,
new InitListener() {
@Override
public void onInit(int errorcode) {
if (ErrorCode.SUCCESS == errorcode) {
} else {
Toast.makeText(mContext, "语音合成初始化失败!", Toast.LENGTH_SHORT);
}
}
});
}
示例3: VoiceAwakener
import com.iflytek.cloud.InitListener; //导入依赖的package包/类
private VoiceAwakener(Context context, SystemVoiceMediator mediator) {
super.mContext = context;
super.mediator = mediator;
at = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, wBufferSize, AudioTrack.MODE_STREAM);
//processor= AudioProcessor_old.createInstance(threadPool);
// 加载识唤醒地资源,resPath为本地识别资源路径
StringBuffer param = new StringBuffer();
String resPath = ResourceUtil.generateResourcePath(this.mContext,
ResourceUtil.RESOURCE_TYPE.assets, "ivw/" + this.mContext.getString(R.string.app_id) + ".jet");
param.append(SpeechConstant.IVW_RES_PATH + "=" + resPath);
param.append("," + ResourceUtil.ENGINE_START + "=" + SpeechConstant.ENG_IVW);
boolean ret = SpeechUtility.getUtility().setParameter(
ResourceUtil.ENGINE_START, param.toString());
if (!ret) {
Log.d(TAG, "启动本地引擎失败!");
}
System.out.println(mIvw);
// 初始化唤醒对象
if (mIvw == null)
mIvw = VoiceWakeuper.createWakeuper(this.mContext, new InitListener() {
@Override
public void onInit(int i) {
if (mIvw != null) {
// 清空参数
mIvw.setParameter(SpeechConstant.PARAMS, null);
mIvw.setParameter(SpeechConstant.IVW_RES_PATH, ResourceUtil.generateResourcePath(mContext,
ResourceUtil.RESOURCE_TYPE.assets, "ivw/" + mContext.getString(R.string.app_id) + ".jet"));
mIvw.setParameter(SpeechConstant.IVW_NET_MODE, "0");
/**
* 唤醒门限值,根据资源携带的唤醒词个数按照“id:门限;id:门限”的格式传入
* 示例demo默认设置第一个唤醒词,建议开发者根据定制资源中唤醒词个数进行设置
*/
mIvw.setParameter(SpeechConstant.IVW_THRESHOLD, "0:" + curThresh + ",1:" + curThresh + ",2:" + curThresh);
// 设置唤醒模式
mIvw.setParameter(SpeechConstant.IVW_SST, "wakeup");
// 不持续进行唤醒
mIvw.setParameter(SpeechConstant.KEEP_ALIVE, "0");
} else {
Log.i(TAG, "唤醒未初始化11111111111111");
}
}
});
if (mIvw != null) {
// 清空参数
mIvw.setParameter(SpeechConstant.PARAMS, null);
mIvw.setParameter(SpeechConstant.IVW_RES_PATH, resPath);
mIvw.setParameter(SpeechConstant.IVW_NET_MODE, "0");
/**
* 唤醒门限值,根据资源携带的唤醒词个数按照“id:门限;id:门限”的格式传入
* 示例demo默认设置第一个唤醒词,建议开发者根据定制资源中唤醒词个数进行设置
*/
mIvw.setParameter(SpeechConstant.IVW_THRESHOLD, "0:" + curThresh + ",1:" + curThresh + ",2:" + curThresh);
// 设置唤醒模式
mIvw.setParameter(SpeechConstant.IVW_SST, "wakeup");
// 不持续进行唤醒
mIvw.setParameter(SpeechConstant.KEEP_ALIVE, "0");
} else {
Log.i(TAG, "唤醒未初始化");
}
}
示例4: onCreate
import com.iflytek.cloud.InitListener; //导入依赖的package包/类
@SuppressLint("ShowToast")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.online_facedemo);
// 在程序入口处传入appid,初始化SDK
SpeechUtility.createUtility(this, "appid=" + getString(R.string.app_id));
findViewById(R.id.online_pick).setOnClickListener(OnlineFaceDemo.this);
findViewById(R.id.online_reg).setOnClickListener(OnlineFaceDemo.this);
findViewById(R.id.online_verify).setOnClickListener(OnlineFaceDemo.this);
findViewById(R.id.online_camera).setOnClickListener(OnlineFaceDemo.this);
findViewById(R.id.btn_modle_delete).setOnClickListener(OnlineFaceDemo.this);
findViewById(R.id.btn_identity).setOnClickListener(OnlineFaceDemo.this);
mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT);
mProDialog = new ProgressDialog(this);
mProDialog.setCancelable(true);
mProDialog.setTitle("请稍后");
mProDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
// cancel进度框时,取消正在进行的操作
if (null != mIdVerifier) {
mIdVerifier.cancel();
}
}
});
//mFaceRequest = new FaceRequest(this);
mIdVerifier = IdentityVerifier.createVerifier(OnlineFaceDemo.this, new InitListener() {
@Override
public void onInit(int errorCode) {
if (ErrorCode.SUCCESS == errorCode) {
showTip("引擎初始化成功");
} else {
showTip("引擎初始化失败,错误码:" + errorCode);
}
}
});
}