本文整理汇总了Java中com.libra.sinvoice.SinVoiceRecognition类的典型用法代码示例。如果您正苦于以下问题:Java SinVoiceRecognition类的具体用法?Java SinVoiceRecognition怎么用?Java SinVoiceRecognition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SinVoiceRecognition类属于com.libra.sinvoice包,在下文中一共展示了SinVoiceRecognition类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.libra.sinvoice.SinVoiceRecognition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_meeting);
mSinVoicePlayer = new SinVoicePlayer(CODEBOOK);
mSinVoicePlayer.setListener(this);
mRecognition = new SinVoiceRecognition(CODEBOOK);
mRecognition.setListener(this);
mRecognition.start();
mText = genText(7);
mSinVoicePlayer.play(mText, true, 1000);
mHandler = new Handler() {
private StringBuilder mTextBuilder = new StringBuilder();
private boolean isOneMoreTime = false;
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_SET_RECG_TEXT:
char ch = (char) msg.arg1;
mTextBuilder.append(ch);
break;
case MSG_RECG_START:
mTextBuilder.delete(0, mTextBuilder.length());
break;
case MSG_RECG_END:
mCountDown--;
if (mCountDown <= 0) {
meetingSuccess();
} else {
//Toast.makeText(getApplicationContext(), mTextBuilder.toString(), Toast.LENGTH_SHORT).show();
}
LogHelper.d(TAG, "recognition end");
break;
}
super.handleMessage(msg);
}
};
mTextTip = (TextView)findViewById(R.id.meeting_tip);
mTextGift = (TextView)findViewById(R.id.meeting_gift);
}