UpdateAudioInput (Unity)

- Declaration

public static void UpdateAudioInput(CavrnusInputDevice device)

- Description

Sets which microphone the user wishes to use. Note that the CavrnusInputDevice provided to this function can only be acquired by calling FetchAudioInputs to search for available microphones.

- Sample

public class AudioInputSelector : MonoBehaviour { private List<CavrnusInputDevice> audioDevices; private int currentDeviceIndex = 0; private void Start() { CavrnusFunctionLibrary.AwaitAnySpaceConnection(spaceConn => { CavrnusFunctionLibrary.FetchAudioInputs(devices => { audioDevices = devices; }); }); } public void SelectNextDevice() { currentDeviceIndex = (currentDeviceIndex + 1) % audioDevices.Count; CavrnusFunctionLibrary.UpdateAudioInput(audioDevices[currentDeviceIndex]); } public void SelectPreviousDevice() { currentDeviceIndex = (currentDeviceIndex - 1 + audioDevices.Count) % audioDevices.Count; CavrnusFunctionLibrary.UpdateAudioInput(audioDevices[currentDeviceIndex]); } }