示例#1
0
    public void StartListening()
    {
        bool isSupported = speechPlugin.CheckSpeechRecognizerSupport();

        if (isSupported)
        {
            //number of possible results
            //Note: sometimes even you put 5 numberOfResults, there's a chance that it will be only 3 or 2
            //it is not constant.

            // unmute beep
            utilsPlugin.UnMuteBeep();

            // enable offline
            //speechPlugin.EnableOffline(true);

            // enable partial Results
            speechPlugin.EnablePartialResult(true);

            int numberOfResults = 5;
            speechPlugin.StartListening(numberOfResults);

            //by activating this, the Speech Recognizer will start and you can start Speaking or saying something
            //speech listener will stop automatically especially when you stop speaking or when you are speaking
            //for a long time
        }
        else
        {
            Debug.Log(TAG + "Speech Recognizer not supported by this Android device ");
        }
    }
示例#2
0
    private void CancelSpeech()
    {
        if (speechPlugin != null)
        {
            bool isSupported = speechPlugin.CheckSpeechRecognizerSupport();

            if (isSupported)
            {
                speechPlugin.Cancel();
            }
        }

        Debug.Log(TAG + " call CancelSpeech..  ");
    }
示例#3
0
    public void StartListeningWithExtraLanguage()
    {
        bool isSupported = speechPlugin.CheckSpeechRecognizerSupport();

        if (isSupported)
        {
            // disable beep
            speechPlugin.EnableBeep(false);

            // enable offline
            //speechPlugin.EnableOffline(true);

            // enable partial Results
            speechPlugin.EnablePartialResult(true);

            int numberOfResults = 5;
            speechPlugin.StartListeningWithHackExtraLanguage(numberOfResults, currentExtraLocale.GetDescription());
        }
        else
        {
            Debug.Log("Speech Recognizer not supported by this Android device ");
        }
    }