private void CalibrateButtonOnClick() { if (rec && !rec.VoiceDetectorCalibrating) { rec.VoiceDetectorCalibrate(calibrationMilliSeconds); } }
// Update is called once per frame void OnGUI() { // TODO: better way to ref recorder PhotonVoiceRecorder rec = null; foreach (var r in FindObjectsOfType <PhotonVoiceRecorder>()) { if (r.photonView.isMine) { rec = r; break; } } var lStyle = new GUIStyle("label"); lStyle.fontSize = 24 * Screen.height / 600; lStyle.wordWrap = false; var lStyleSmall = new GUIStyle("label"); lStyleSmall.fontSize = 16 * Screen.height / 600; lStyleSmall.wordWrap = false; var bStyle = new GUIStyle("button"); bStyle.fontSize = 28 * Screen.height / 600; var bStyleSmall = new GUIStyle("button"); bStyleSmall.fontSize = 16 * Screen.height / 600; var roomName = ""; if (PhotonNetwork.inRoom) { roomName = PhotonNetwork.room.Name; } string rttString = String.Format( "RTT/Var/Que: {0}/{1}/{2}", PhotonNetwork.networkingPeer.RoundTripTime.ToString(), PhotonNetwork.networkingPeer.RoundTripTimeVariance, PhotonNetwork.networkingPeer.QueuedIncomingCommands); GUILayout.Label("PUN: " + PhotonNetwork.connectionStateDetailed.ToString() + " " + roomName + " " + rttString, lStyle); GUILayout.BeginHorizontal(); if (GUILayout.Button("Connect", bStyle)) { PhotonNetwork.ConnectUsingSettings(string.Format("1.{0}", SceneManagerHelper.ActiveSceneBuildIndex)); } if (GUILayout.Button("Disconnect", bStyle)) { PhotonNetwork.Disconnect(); } GUILayout.EndHorizontal(); roomName = ""; if (PhotonVoiceNetwork.ClientState == ExitGames.Client.Photon.LoadBalancing.ClientState.Joined) { roomName = PhotonVoiceNetwork.CurrentRoomName; } if (dataRateNextTime < Time.time) { dataRateNextTime = Time.time + 1; dataRateIn = (PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes - prevInBytes) / 1; dataRateOut = (PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes - prevOutBytes) / 1; prevInBytes = PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes; prevOutBytes = PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes; } rttString = String.Format( "RTT/Var/Que: {0}/{1}/{2}", PhotonVoiceNetwork.Client.loadBalancingPeer.RoundTripTime.ToString(), PhotonVoiceNetwork.Client.loadBalancingPeer.RoundTripTimeVariance, PhotonVoiceNetwork.Client.loadBalancingPeer.QueuedIncomingCommands); GUILayout.Label("PhotonVoice: " + PhotonVoiceNetwork.ClientState.ToString() + " " + roomName + " " + rttString, lStyle); GUILayout.BeginHorizontal(); GUILayout.Label("Data rate in/out bytes/sec: " + dataRateIn + "/" + dataRateOut, lStyleSmall); if (PhotonVoiceNetwork.Client.loadBalancingPeer != null) { GUILayout.Label("Traffic bytes: " + PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes + "/" + PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes, lStyleSmall); } GUILayout.Label("Frames Sent/Rcvd/Lost: " + PhotonVoiceNetwork.VoiceClient.FramesSent + "/" + PhotonVoiceNetwork.VoiceClient.FramesReceived + "/" + PhotonVoiceNetwork.VoiceClient.FramesLost, lStyleSmall); GUILayout.Label("Voice RTT/Var: " + PhotonVoiceNetwork.VoiceClient.RoundTripTime + "/" + PhotonVoiceNetwork.VoiceClient.RoundTripTimeVariance, lStyleSmall); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Speakers:", lStyleSmall); foreach (var s in FindObjectsOfType <PhotonVoiceSpeaker>()) { if (s.IsVoiceLinked) { GUILayout.Label("lag=" + s.CurrentBufferLag, lStyleSmall); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Connect", bStyle)) { PhotonVoiceNetwork.Connect(); } if (GUILayout.Button("Disconnect", bStyle)) { PhotonVoiceNetwork.Disconnect(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (rec != null && rec.photonView.isMine) { if (GUILayout.Button((rec.DebugEchoMode ? "[X] " : "[ ] ") + "Debug Echo", bStyle)) { rec.DebugEchoMode = !rec.DebugEchoMode; } if (GUILayout.Button((rec.Transmit ? "[X] ": "[ ] ") + "Transmit", bStyle)) { rec.Transmit = !rec.Transmit; } if (GUILayout.Button((rec.VoiceDetector.On ? "[X] " : "[ ] ") + "Detect", bStyle)) { rec.Detect = !rec.Detect; } if (GUILayout.Button((rec.VoiceDetectorCalibrating ? "[X] " : "[ ] ") + "Calibrate Detector", bStyle)) { rec.VoiceDetectorCalibrate(2000); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Transmitting: " + rec.IsTransmitting, lStyleSmall); GUILayout.Label("Avg Amp: " + (rec.LevelMeter == null ? "" : rec.LevelMeter.CurrentAvgAmp.ToString("0.000000") + "/" + rec.LevelMeter.AccumAvgPeakAmp.ToString("0.000000")), lStyleSmall); GUILayout.Label("Peak Amp: " + (rec.LevelMeter == null ? "" : rec.LevelMeter.CurrentPeakAmp.ToString("0.000000")), lStyleSmall); GUILayout.Label("Detector Threshold: " + (rec.VoiceDetector == null ? "" : rec.VoiceDetector.Threshold.ToString("0.000000")), lStyleSmall); GUILayout.Label("Audio group (rec): " + rec.AudioGroup.ToString(), lStyleSmall); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var speexDSP = rec.GetComponent <SpeexDSP>(); if (speexDSP != null) { if (GUILayout.Button((speexDSP.AEC ? "[X] AEC" : "[ ] AEC"), bStyle)) { speexDSP.AEC = !speexDSP.AEC; } if (GUILayout.Button("Reset", bStyle)) { speexDSP.ResetAEC(); } GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); GUILayout.Label("delay:", lStyle); var x = speexDSP.AECPlaybackDelayMs.ToString(); var tStyle = new GUIStyle("textfield"); tStyle.fontSize = bStyle.fontSize; speexDSP.AECPlaybackDelayMs = Int32.Parse(GUILayout.TextField(x, tStyle)); GUILayout.EndHorizontal(); if (GUILayout.Button((speexDSP.AECLatencyDetect ? "[X] Latency Detect:" : "[ ] Latency Detect"), bStyle)) { speexDSP.AECLatencyDetect = !speexDSP.AECLatencyDetect; } if (speexDSP.AECLatencyDetect) { var l = speexDSP.Processor.AECLatencyResult; GUILayout.Label(l.LatencyMs + "/" + l.LatencyDelayedMs + " ms", lStyle); GUILayout.Label( (l.PlayDetected ? "!" : ".") + (l.PlayDelayedDetected ? "!" : ".") + (l.RecDetected ? "!" : "."), lStyle); } } GUILayout.EndHorizontal(); } else { GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); GUILayout.Label("Set Group (offs Debug Echo): ", lStyleSmall); for (byte i = 0; i < 5; i++) { if (GUILayout.Button((PhotonVoiceNetwork.Client.GlobalAudioGroup == i ? "[X] " : "[ ] ") + (i == 0 ? "No" : i.ToString()), bStyleSmall)) { PhotonVoiceNetwork.Client.GlobalAudioGroup = i; } } GUILayout.EndHorizontal(); var pvs = PhotonVoiceSettings.Instance; GUILayout.BeginHorizontal(); GUILayout.Label("Unity Mic: ", lStyleSmall); foreach (var x in Microphone.devices) { if (GUILayout.Button((pvs.MicrophoneType == PhotonVoiceSettings.MicAudioSourceType.Unity && PhotonVoiceNetwork.MicrophoneDevice == x ? "[X] " : "[ ] ") + x, bStyleSmall)) { pvs.MicrophoneType = PhotonVoiceSettings.MicAudioSourceType.Unity; PhotonVoiceNetwork.MicrophoneDevice = x; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Photon Mic: ", lStyleSmall); if (PhotonVoiceNetwork.PhotonMicrophoneEnumerator.IsSupported) { for (int i = 0; i < PhotonVoiceNetwork.PhotonMicrophoneEnumerator.Count; i++) { if (GUILayout.Button((pvs.MicrophoneType == PhotonVoiceSettings.MicAudioSourceType.Photon && PhotonVoiceNetwork.PhotonMicrophoneDeviceID == PhotonVoiceNetwork.PhotonMicrophoneEnumerator.IDAtIndex(i) ? "[X] " : "[ ] ") + PhotonVoiceNetwork.PhotonMicrophoneEnumerator.NameAtIndex(i), bStyleSmall)) { pvs.MicrophoneType = PhotonVoiceSettings.MicAudioSourceType.Photon; PhotonVoiceNetwork.PhotonMicrophoneDeviceID = PhotonVoiceNetwork.PhotonMicrophoneEnumerator.IDAtIndex(i); } } if (GUILayout.Button("Refresh", bStyleSmall)) { PhotonVoiceNetwork.PhotonMicrophoneEnumerator.Refresh(); } } else { // use 1st device in Unity device enumeration to display default device name (this may be wrong of course) if (Microphone.devices.Length > 0) { if (GUILayout.Button((pvs.MicrophoneType == PhotonVoiceSettings.MicAudioSourceType.Photon ? "[X] " : "[ ] ") + Microphone.devices[0], bStyleSmall)) { pvs.MicrophoneType = PhotonVoiceSettings.MicAudioSourceType.Photon; PhotonVoiceNetwork.PhotonMicrophoneDeviceID = -1; } } } GUILayout.EndHorizontal(); GUI.enabled = true; #if !UNITY_EDITOR && UNITY_PS4 UserProfiles.LocalUsers localUsers = new UserProfiles.LocalUsers(); UserProfiles.GetLocalUsers(localUsers); int userID = localUsers.LocalUsersIds[0].UserId.Id; pvs.PS4UserID = userID; #endif }
// Update is called once per frame void OnGUI() { // TODO: better way to ref recorder PhotonVoiceRecorder rec = null; foreach (var r in FindObjectsOfType <PhotonVoiceRecorder>()) { if (r.photonView.isMine) { rec = r; break; } } var lStyle = new GUIStyle("label"); lStyle.fontSize = 24 * Screen.height / 600; lStyle.wordWrap = false; var lStyleSmall = new GUIStyle("label"); lStyleSmall.fontSize = 16 * Screen.height / 600; lStyleSmall.wordWrap = false; var bStyle = new GUIStyle("button"); bStyle.fontSize = 28 * Screen.height / 600; var bStyleSmall = new GUIStyle("button"); bStyleSmall.fontSize = 16 * Screen.height / 600; var roomName = ""; if (PhotonNetwork.inRoom) { roomName = PhotonNetwork.room.Name; } string rttString = String.Format( "RTT/Var/Que: {0}/{1}/{2}", PhotonNetwork.networkingPeer.RoundTripTime.ToString(), PhotonNetwork.networkingPeer.RoundTripTimeVariance, PhotonNetwork.networkingPeer.QueuedIncomingCommands); GUILayout.Label("PUN: " + PhotonNetwork.connectionStateDetailed.ToString() + " " + roomName + " " + rttString, lStyle); GUILayout.BeginHorizontal(); if (GUILayout.Button("Connect", bStyle)) { #if UNITY_5_3_OR_NEWER PhotonNetwork.ConnectUsingSettings(string.Format("1.{0}", UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex)); #else PhotonNetwork.ConnectUsingSettings(string.Format("1.{0}", Application.loadedLevel)); #endif } if (GUILayout.Button("Disconnect", bStyle)) { PhotonNetwork.Disconnect(); } GUILayout.EndHorizontal(); roomName = ""; if (PhotonVoiceNetwork.ClientState == ExitGames.Client.Photon.LoadBalancing.ClientState.Joined) { roomName = PhotonVoiceNetwork.CurrentRoomName; } if (dataRateNextTime < Time.time) { dataRateNextTime = Time.time + 1; dataRateIn = (PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes - prevInBytes) / 1; dataRateOut = (PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes - prevOutBytes) / 1; prevInBytes = PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes; prevOutBytes = PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes; } rttString = String.Format( "RTT/Var/Que: {0}/{1}/{2}", PhotonVoiceNetwork.Client.loadBalancingPeer.RoundTripTime.ToString(), PhotonVoiceNetwork.Client.loadBalancingPeer.RoundTripTimeVariance, PhotonVoiceNetwork.Client.loadBalancingPeer.QueuedIncomingCommands); GUILayout.Label("PhotonVoice: " + PhotonVoiceNetwork.ClientState.ToString() + " " + roomName + " " + rttString, lStyle); GUILayout.BeginHorizontal(); GUILayout.Label("Data rate in/out bytes/sec: " + dataRateIn + "/" + dataRateOut, lStyleSmall); if (PhotonVoiceNetwork.Client.loadBalancingPeer != null) { GUILayout.Label("Traffic bytes: " + PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes + "/" + PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes, lStyleSmall); } GUILayout.Label("Frames Sent/Rcvd/Lost: " + PhotonVoiceNetwork.VoiceClient.FramesSent + "/" + PhotonVoiceNetwork.VoiceClient.FramesReceived + "/" + PhotonVoiceNetwork.VoiceClient.FramesLost, lStyleSmall); GUILayout.Label("Voice RTT/Var: " + PhotonVoiceNetwork.VoiceClient.RoundTripTime + "/" + PhotonVoiceNetwork.VoiceClient.RoundTripTimeVariance, lStyleSmall); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Speakers:", lStyleSmall); foreach (var s in FindObjectsOfType <PhotonVoiceSpeaker>()) { if (s.IsVoiceLinked) { GUILayout.Label("lag=" + s.CurrentBufferLag, lStyleSmall); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Connect", bStyle)) { PhotonVoiceNetwork.Connect(); } if (GUILayout.Button("Disconnect", bStyle)) { PhotonVoiceNetwork.Disconnect(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (rec != null && rec.photonView.isMine) { if (GUILayout.Button((rec.DebugEchoMode ? "[X] " : "[ ] ") + "Debug Echo", bStyle)) { rec.DebugEchoMode = !rec.DebugEchoMode; } if (GUILayout.Button((rec.Transmit ? "[X] ": "[ ] ") + "Transmit", bStyle)) { rec.Transmit = !rec.Transmit; } if (GUILayout.Button((rec.VoiceDetector.On ? "[X] " : "[ ] ") + "Detect", bStyle)) { rec.Detect = !rec.Detect; } if (GUILayout.Button((rec.VoiceDetectorCalibrating ? "[X] " : "[ ] ") + "Calibrate Detector", bStyle)) { rec.VoiceDetectorCalibrate(2000); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Transmitting: " + rec.IsTransmitting, lStyleSmall); GUILayout.Label("Avg Amp: " + (rec.LevelMeter == null ? "" : rec.LevelMeter.CurrentAvgAmp.ToString("0.000000") + "/" + rec.LevelMeter.AccumAvgPeakAmp.ToString("0.000000")), lStyleSmall); GUILayout.Label("Peak Amp: " + (rec.LevelMeter == null ? "" : rec.LevelMeter.CurrentPeakAmp.ToString("0.000000")), lStyleSmall); GUILayout.Label("Detector Threshold: " + (rec.VoiceDetector == null ? "" : rec.VoiceDetector.Threshold.ToString("0.000000")), lStyleSmall); GUILayout.Label("Audio group (rec): " + rec.AudioGroup.ToString(), lStyleSmall); GUILayout.EndHorizontal(); } else { GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); GUILayout.Label("Set Group (offs Debug Echo): ", lStyleSmall); for (byte i = 0; i < 5; i++) { if (GUILayout.Button((PhotonVoiceNetwork.Client.GlobalAudioGroup == i ? "[X] " : "[ ] ") + (i == 0 ? "No" : i.ToString()), bStyleSmall)) { PhotonVoiceNetwork.Client.GlobalAudioGroup = i; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Mic: ", lStyleSmall); foreach (var x in Microphone.devices) { if (GUILayout.Button((PhotonVoiceNetwork.MicrophoneDevice == x ? "[X] " : "[ ] ") + x, bStyleSmall)) { PhotonVoiceNetwork.MicrophoneDevice = x; } } GUILayout.EndHorizontal(); GUI.enabled = true; }
// Token: 0x06000092 RID: 146 RVA: 0x000043F4 File Offset: 0x000025F4 private void OnGUI() { PhotonVoiceRecorder photonVoiceRecorder = null; foreach (PhotonVoiceRecorder photonVoiceRecorder2 in Object.FindObjectsOfType <PhotonVoiceRecorder>()) { if (photonVoiceRecorder2.photonView.isMine) { photonVoiceRecorder = photonVoiceRecorder2; break; } } GUIStyle guistyle = new GUIStyle("label"); guistyle.fontSize = 24 * Screen.height / 600; guistyle.wordWrap = false; GUIStyle guistyle2 = new GUIStyle("label"); guistyle2.fontSize = 16 * Screen.height / 600; guistyle2.wordWrap = false; GUIStyle guistyle3 = new GUIStyle("button"); guistyle3.fontSize = 28 * Screen.height / 600; GUIStyle guistyle4 = new GUIStyle("button"); guistyle4.fontSize = 16 * Screen.height / 600; string text = ""; if (PhotonNetwork.inRoom) { text = PhotonNetwork.room.Name; } string text2 = string.Format("RTT/Var/Que: {0}/{1}/{2}", PhotonNetwork.networkingPeer.RoundTripTime.ToString(), PhotonNetwork.networkingPeer.RoundTripTimeVariance, PhotonNetwork.networkingPeer.QueuedIncomingCommands); GUILayout.Label(string.Concat(new string[] { "PUN: ", PhotonNetwork.connectionStateDetailed.ToString(), " ", text, " ", text2 }), guistyle, Array.Empty <GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); if (GUILayout.Button("Connect", guistyle3, Array.Empty <GUILayoutOption>())) { PhotonNetwork.ConnectUsingSettings(string.Format("1.{0}", SceneManagerHelper.ActiveSceneBuildIndex)); } if (GUILayout.Button("Disconnect", guistyle3, Array.Empty <GUILayoutOption>())) { PhotonNetwork.Disconnect(); } GUILayout.EndHorizontal(); text = ""; if (PhotonVoiceNetwork.ClientState == ExitGames.Client.Photon.LoadBalancing.ClientState.Joined) { text = PhotonVoiceNetwork.CurrentRoomName; } if (this.dataRateNextTime < Time.time) { this.dataRateNextTime = Time.time + 1f; this.dataRateIn = (PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes - this.prevInBytes) / 1; this.dataRateOut = (PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes - this.prevOutBytes) / 1; this.prevInBytes = PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes; this.prevOutBytes = PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes; } text2 = string.Format("RTT/Var/Que: {0}/{1}/{2}", PhotonVoiceNetwork.Client.loadBalancingPeer.RoundTripTime.ToString(), PhotonVoiceNetwork.Client.loadBalancingPeer.RoundTripTimeVariance, PhotonVoiceNetwork.Client.loadBalancingPeer.QueuedIncomingCommands); GUILayout.Label(string.Concat(new string[] { "PhotonVoice: ", PhotonVoiceNetwork.ClientState.ToString(), " ", text, " ", text2 }), guistyle, Array.Empty <GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label(string.Concat(new object[] { "Data rate in/out bytes/sec: ", this.dataRateIn, "/", this.dataRateOut }), guistyle2, Array.Empty <GUILayoutOption>()); if (PhotonVoiceNetwork.Client.loadBalancingPeer != null) { GUILayout.Label(string.Concat(new object[] { "Traffic bytes: ", PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsIncoming.TotalPacketBytes, "/", PhotonVoiceNetwork.Client.loadBalancingPeer.TrafficStatsOutgoing.TotalPacketBytes }), guistyle2, Array.Empty <GUILayoutOption>()); } GUILayout.Label(string.Concat(new object[] { "Frames Sent/Rcvd/Lost: ", PhotonVoiceNetwork.VoiceClient.FramesSent, "/", PhotonVoiceNetwork.VoiceClient.FramesReceived, "/", PhotonVoiceNetwork.VoiceClient.FramesLost }), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.Label(string.Concat(new object[] { "Voice RTT/Var: ", PhotonVoiceNetwork.VoiceClient.RoundTripTime, "/", PhotonVoiceNetwork.VoiceClient.RoundTripTimeVariance }), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label("Speakers:", guistyle2, Array.Empty <GUILayoutOption>()); foreach (PhotonVoiceSpeaker photonVoiceSpeaker in Object.FindObjectsOfType <PhotonVoiceSpeaker>()) { if (photonVoiceSpeaker.IsVoiceLinked) { GUILayout.Label("lag=" + photonVoiceSpeaker.CurrentBufferLag, guistyle2, Array.Empty <GUILayoutOption>()); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); if (GUILayout.Button("Connect", guistyle3, Array.Empty <GUILayoutOption>())) { PhotonVoiceNetwork.Connect(); } if (GUILayout.Button("Disconnect", guistyle3, Array.Empty <GUILayoutOption>())) { PhotonVoiceNetwork.Disconnect(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); if (photonVoiceRecorder != null && photonVoiceRecorder.photonView.isMine) { if (GUILayout.Button((photonVoiceRecorder.DebugEchoMode ? "[X] " : "[ ] ") + "Debug Echo", guistyle3, Array.Empty <GUILayoutOption>())) { photonVoiceRecorder.DebugEchoMode = !photonVoiceRecorder.DebugEchoMode; } if (GUILayout.Button((photonVoiceRecorder.Transmit ? "[X] " : "[ ] ") + "Transmit", guistyle3, Array.Empty <GUILayoutOption>())) { photonVoiceRecorder.Transmit = !photonVoiceRecorder.Transmit; } if (GUILayout.Button((photonVoiceRecorder.VoiceDetector.On ? "[X] " : "[ ] ") + "Detect", guistyle3, Array.Empty <GUILayoutOption>())) { photonVoiceRecorder.Detect = !photonVoiceRecorder.Detect; } if (GUILayout.Button((photonVoiceRecorder.VoiceDetectorCalibrating ? "[X] " : "[ ] ") + "Calibrate Detector", guistyle3, Array.Empty <GUILayoutOption>())) { photonVoiceRecorder.VoiceDetectorCalibrate(2000); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label("Transmitting: " + photonVoiceRecorder.IsTransmitting.ToString(), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.Label("Avg Amp: " + ((photonVoiceRecorder.LevelMeter == null) ? "" : (photonVoiceRecorder.LevelMeter.CurrentAvgAmp.ToString("0.000000") + "/" + photonVoiceRecorder.LevelMeter.AccumAvgPeakAmp.ToString("0.000000"))), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.Label("Peak Amp: " + ((photonVoiceRecorder.LevelMeter == null) ? "" : photonVoiceRecorder.LevelMeter.CurrentPeakAmp.ToString("0.000000")), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.Label("Detector Threshold: " + ((photonVoiceRecorder.VoiceDetector == null) ? "" : photonVoiceRecorder.VoiceDetector.Threshold.ToString("0.000000")), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.Label("Audio group (rec): " + photonVoiceRecorder.AudioGroup.ToString(), guistyle2, Array.Empty <GUILayoutOption>()); GUILayout.EndHorizontal(); } else { GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label("Set Group (offs Debug Echo): ", guistyle2, Array.Empty <GUILayoutOption>()); for (byte b = 0; b < 5; b += 1) { if (GUILayout.Button(((PhotonVoiceNetwork.Client.GlobalAudioGroup == b) ? "[X] " : "[ ] ") + ((b == 0) ? "No" : b.ToString()), guistyle4, Array.Empty <GUILayoutOption>())) { PhotonVoiceNetwork.Client.GlobalAudioGroup = b; } } GUILayout.EndHorizontal(); PhotonVoiceSettings instance = PhotonVoiceSettings.Instance; GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label("Unity Mic: ", guistyle2, Array.Empty <GUILayoutOption>()); foreach (string text3 in Microphone.devices) { if (GUILayout.Button(((instance.MicrophoneType == PhotonVoiceSettings.MicAudioSourceType.Unity && PhotonVoiceNetwork.MicrophoneDevice == text3) ? "[X] " : "[ ] ") + text3, guistyle4, Array.Empty <GUILayoutOption>())) { instance.MicrophoneType = PhotonVoiceSettings.MicAudioSourceType.Unity; PhotonVoiceNetwork.MicrophoneDevice = text3; } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>()); GUILayout.Label("Photon Mic: ", guistyle2, Array.Empty <GUILayoutOption>()); if (PhotonVoiceNetwork.PhotonMicrophoneEnumerator.IsSupported) { for (int j = 0; j < PhotonVoiceNetwork.PhotonMicrophoneEnumerator.Count; j++) { if (GUILayout.Button(((instance.MicrophoneType == PhotonVoiceSettings.MicAudioSourceType.Photon && PhotonVoiceNetwork.PhotonMicrophoneDeviceID == PhotonVoiceNetwork.PhotonMicrophoneEnumerator.IDAtIndex(j)) ? "[X] " : "[ ] ") + PhotonVoiceNetwork.PhotonMicrophoneEnumerator.NameAtIndex(j), guistyle4, Array.Empty <GUILayoutOption>())) { instance.MicrophoneType = PhotonVoiceSettings.MicAudioSourceType.Photon; PhotonVoiceNetwork.PhotonMicrophoneDeviceID = PhotonVoiceNetwork.PhotonMicrophoneEnumerator.IDAtIndex(j); } } if (GUILayout.Button("Refresh", guistyle4, Array.Empty <GUILayoutOption>())) { PhotonVoiceNetwork.PhotonMicrophoneEnumerator.Refresh(); } } else if (Microphone.devices.Length != 0 && GUILayout.Button(((instance.MicrophoneType == PhotonVoiceSettings.MicAudioSourceType.Photon) ? "[X] " : "[ ] ") + Microphone.devices[0], guistyle4, Array.Empty <GUILayoutOption>())) { instance.MicrophoneType = PhotonVoiceSettings.MicAudioSourceType.Photon; PhotonVoiceNetwork.PhotonMicrophoneDeviceID = -1; } GUILayout.EndHorizontal(); GUI.enabled = true; }