void Update()
    {
        // alternatively, use the keyboard
        //if(Input.GetButtonDown("Jump"))  // start or stop recording
        if (_Record)   // start or stop recording
        {
            _Record = false;

            if (saverPlayer)
            {
                if (!saverPlayer.IsRecording())
                {
                    saverPlayer.StartRecording();
                }
                else
                {
                    saverPlayer.StopRecordingOrPlaying();
                }
            }
        }

        //if (Input.GetButtonDown("Fire1"))  // start or stop playing
        if (_Play)   // start or stop playing
        {
            _Play = false;
            if (saverPlayer)
            {
                if (!saverPlayer.IsPlaying())
                {
                    saverPlayer.StartPlaying();
                }
                else
                {
                    saverPlayer.StopRecordingOrPlaying();
                }
            }
        }
    }
Пример #2
0
    void Update()
    {
        if (speechManager == null)
        {
            speechManager = SpeechManager.Instance;
        }

        if (speechManager != null && speechManager.IsSapiInitialized())
        {
            if (speechManager.IsPhraseRecognized())
            {
                string sPhraseTag = speechManager.GetPhraseTagRecognized();

                switch (sPhraseTag)
                {
                case "RECORD":
                    if (saverPlayer)
                    {
                        saverPlayer.StartRecording();
                    }
                    break;

                case "PLAY":
                    if (saverPlayer)
                    {
                        saverPlayer.StartPlaying();
                    }
                    break;

                case "STOP":
                    if (saverPlayer)
                    {
                        saverPlayer.StopRecordingOrPlaying();
                    }
                    break;
                }

                speechManager.ClearPhraseRecognized();
            }
        }

        // alternatively, use the keyboard
        if (Input.GetButtonDown("Jump"))         // start or stop recording
        {
            if (saverPlayer)
            {
                if (!saverPlayer.IsRecording())
                {
                    saverPlayer.StartRecording();
                }
                else
                {
                    saverPlayer.StopRecordingOrPlaying();
                }
            }
        }

        if (Input.GetButtonDown("Fire1"))         // start or stop playing
        {
            if (saverPlayer)
            {
                if (!saverPlayer.IsPlaying())
                {
                    saverPlayer.StartPlaying();
                }
                else
                {
                    saverPlayer.StopRecordingOrPlaying();
                }
            }
        }
    }