示例#1
0
        //return true if a word is detected
        static bool CheckVoiceCommand()
        {
            switch (detectedVoiceParams.detectedPhrase)
            {
            case "":
                EndOfaVoiceControlCommand();
                return(false);

            case "I MuSe":
                voiceControlEnabled = true;
                if (viewControlHelper.getCurrentView() == views.view_home)
                {
                    viewControlHelper.gotoVoiceViewDirectly();
                }
                //toSearch = false;
                break;

            case "go to home":
            case "back to home":
                if (voiceControlEnabled)
                {
                    viewControlHelper.gotoHomeView();
                }
                EndOfaVoiceControlCommand();
                break;

            case "search":
                toSearch = true;
                break;

            //all other words defined om VoicePipeline
            default:
                if (voiceControlEnabled && toSearch)
                {
                    MatchingHelper.matchedClass = detectedVoiceParams.detectedPhrase;
                    if (viewControlHelper.getCurrentView() == views.view_result)
                    {
                        viewControlHelper.gotoHomeView();
                    }
                    viewControlHelper.gotoView(views.view_result);
                    //commandSentence += detectedVoiceParams.detectedPhrase;
                }
                if (toSearch)
                {
                    EndOfaVoiceControlCommand();
                }
                break;
            }
            keywordDetected = true;
            return(true);
        }