麦克风启动功能冻结统一应用程序

时间:2017-11-21 11:58:55

标签: c# unity3d audio audio-recording microphone

启动麦克风完全冻结整个应用程序5秒钟(总是5秒)。 Unity 5.6.0f3

代码:

public void StartRecording()
    {
        System.Diagnostics.Stopwatch sw1 = new System.Diagnostics.Stopwatch();
        sw1.Start();
        if (!Microphone.IsRecording(null))
        {
            m_ForcedStopRecording = false;
            m_RecordingStartTime = Time.time;
            Debug.Log("ms before start microphone 2: " + sw1.ElapsedMilliseconds);
            m_RecordedAudio = Microphone.Start(null, false, m_MaxRecordingLengthInSeconds, m_RecordingFrequency);
            Debug.Log("ms after start microphone: " + sw1.ElapsedMilliseconds);
            StartCoroutine(WaitForRecordingTimeout());
        }
        Debug.Log("total StartRecording: " + sw1.ElapsedMilliseconds);
    }
开始麦克风前的

ms 2结果为0 开始后麦克风说5011 有什么建议吗?

1 个答案:

答案 0 :(得分:1)

你应该尝试将麦克风连接到不同的端口,这可能是你的电脑在找到麦克风时遇到麻烦的问题