private void MicDropdownValueChanged(MicRef mic) { this.recorder.MicrophoneType = mic.MicType; switch (mic.MicType) { case Recorder.MicType.Unity: this.recorder.UnityMicrophoneDevice = mic.Name; break; case Recorder.MicType.Photon: this.recorder.PhotonMicrophoneDeviceId = mic.PhotonId; break; } if (this.recorder.RequiresRestart) { this.recorder.RestartRecording(); } }
private void SetCurrentValue() { if (this.micOptions == null) { Debug.LogWarning("micOptions list is null"); return; } #if PHOTON_MICROPHONE_ENUMERATOR bool photonMicEnumAvailable = Recorder.PhotonMicrophoneEnumerator.IsSupported; #else bool photonMicEnumAvailable = false; #endif this.photonToggle.onValueChanged.RemoveAllListeners(); this.photonToggle.isOn = this.recorder.MicrophoneType == Recorder.MicType.Photon; if (!photonMicEnumAvailable) { this.photonToggle.onValueChanged.AddListener(this.PhotonMicToggled); } this.micDropdown.gameObject.SetActive(photonMicEnumAvailable || this.recorder.MicrophoneType == Recorder.MicType.Unity); this.toggleButton.SetActive(!photonMicEnumAvailable); this.refreshButton.SetActive(photonMicEnumAvailable || this.recorder.MicrophoneType == Recorder.MicType.Unity); for (int valueIndex = 0; valueIndex < this.micOptions.Count; valueIndex++) { MicRef val = this.micOptions[valueIndex]; if (this.recorder.MicrophoneType == val.MicType) { if (this.recorder.MicrophoneType == Recorder.MicType.Unity && Recorder.CompareUnityMicNames(val.Name, this.recorder.UnityMicrophoneDevice)) { this.micDropdown.value = valueIndex; return; } if (this.recorder.MicrophoneType == Recorder.MicType.Photon && val.PhotonId == this.recorder.PhotonMicrophoneDeviceId) { this.micDropdown.value = valueIndex; return; } } } for (int valueIndex = 0; valueIndex < this.micOptions.Count; valueIndex++) { MicRef val = this.micOptions[valueIndex]; if (this.recorder.MicrophoneType == val.MicType) { if (this.recorder.MicrophoneType == Recorder.MicType.Unity) { this.micDropdown.value = valueIndex; this.recorder.UnityMicrophoneDevice = val.Name; break; } if (this.recorder.MicrophoneType == Recorder.MicType.Photon) { this.micDropdown.value = valueIndex; this.recorder.PhotonMicrophoneDeviceId = val.PhotonId; break; } } } if (this.recorder.RequiresRestart) { this.recorder.RestartRecording(); } }