当前位置: 首页>>代码示例>>Java>>正文


Java SinVoiceRecognition类代码示例

本文整理汇总了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);
}
 
开发者ID:Flame-Team,项目名称:FastOmiai,代码行数:50,代码来源:MeetingActivity.java


注:本文中的com.libra.sinvoice.SinVoiceRecognition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。