/// <summary> /// Change the microphone to the default microphone. Will fail if user authorisation has not /// been obtained or there are no microphones. /// </summary> public void UseDefaultDevice() { if (Application.HasUserAuthorization(UserAuthorization.Microphone)) { if (Microphone.devices.Length > 0) { microphoneDeviceName = ""; microphoneDeviceSet = true; SetSamplingRate(); LogMT.Log("MicrophoneController: Using default microphone"); } else { LogMT.LogError("MicrophoneController: Cannot set device: No devices available", this); } } else { LogMT.LogError("MicrophoneController: Cannot set device: User Authorization required", this); } }
/// <summary> /// Change the microphone to the given ID. Will fail if user authorisation has not been obtained /// or device doesn't exist. /// </summary> public void SetDevice(int id) { if (Application.HasUserAuthorization(UserAuthorization.Microphone)) { if ((id >= 0) && (Microphone.devices.Length > 0)) { microphoneDeviceName = Microphone.devices[id]; LogMT.Log("MicrophoneController: Using microphone: " + microphoneDeviceName); microphoneDeviceSet = true; SetSamplingRate(); } else { LogMT.LogError("MicrophoneController: Cannot set device: Device not available", this); } } else { LogMT.LogError("MicrophoneController: Cannot set device: User Authorization required", this); } }