Example #1
0
    IEnumerator Start()
    {
        yield return(null);

        audioHandler   = (ISpeechDataHandler)FindSpeechHandler();
        talkController = (IUSpeakTalkController)FindInputHandler();

        if (audioHandler == null)
        {
            Debug.LogError("USpeaker requires a component which implements the ISpeechDataHandler interface");
            yield break;
        }

        if (SpeakerMode == SpeakerMode.Remote)
        {
            yield break;
        }

        if (AskPermission)
        {
            if (!Application.HasUserAuthorization(UserAuthorization.Microphone))
            {
                yield return(Application.RequestUserAuthorization(UserAuthorization.Microphone));
            }
        }

        if (!Application.HasUserAuthorization(UserAuthorization.Microphone))
        {
            Debug.LogError("Failed to start recording - user has denied microphone access");
            yield break;
        }

        if (Microphone.devices.Length == 0)
        {
            Debug.LogWarning("Failed to find a recording device");
            yield break;
        }

        UpdateSettings();

        sendt = 1.0f / (float)SendRate;

        recording = Microphone.Start(currentDeviceName, true, 5, audioFrequency);

        print(Microphone.devices[InputDeviceID]);
        currentDeviceName = Microphone.devices[InputDeviceID];

        micDeviceList = Microphone.devices;
    }
Example #2
0
 public void GetInputHandler()
 {
     this.talkController = (IUSpeakTalkController)this.FindInputHandler();
 }
Example #3
0
 public void GetInputHandler()
 {
     this.talkController = (IUSpeakTalkController)this.FindInputHandler();
 }