如何检查用户是否对着麦克风说话?

时间:2013-06-27 05:17:15

标签: c#-4.0 audio unity3d microphone

我想检查用户是否对着麦克风说话。我试过但是没用。我怎样才能做到这一点?

我的代码是:

using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour 
{
    AudioClip sound;
    string dname;

    // Use this for initialization
    void Start ()
    {

    }

    // Update is called once per frame
    void Update () 
    {
        foreach(string device in Microphone.devices)
        {
            dname=device;
        }
        sound=Microphone.Start(dname,true,10, 44100);
        //here check user speak to microphone or not.
    }
}

0 个答案:

没有答案