I’m trying to get two microphone volumes at once in unity. Unity supports microphone by this Microphones class (Unity - Scripting API: Microphone), but seems this class can only handle one Microphone at same time.
This is how my code looks. I’m running like this in two different scripts attached to two different objects. However, only the microphone initialized second will run and the first one will die when the second one starts.
How can I get multiple microphone inputs simultaneously? If there are no way to do in standard library, is there any useful plugins?
Thank you
void Start ()
{
deviceName = Microphone.devices[0];
audio = this.gameObject.AddComponent<AudioSource>();
audio.clip =
Microphone.Start(deviceName, true, 999, 44100);
audio.loop = true;
audio.mute = true;
while (!(Microphone.GetPosition(deviceName) > 0))
{
}
volumes = new float[LAppDefine.MIC_FRAME_NUM];
audio.Play();
}