public void DrawAudioFilterGUI(MonoBehaviour behaviour) { int customFilterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour); if (customFilterChannelCount > 0) { if (this.dataOut == null) { this.dataOut = new EditorGUI.VUMeter.SmoothingData[customFilterChannelCount]; } double num2 = ((double)AudioUtil.GetCustomFilterProcessTime(behaviour)) / 1000000.0; float r = ((float)num2) / ((((float)AudioSettings.outputSampleRate) / 1024f) / ((float)customFilterChannelCount)); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.Space(13f); GUILayout.BeginVertical(new GUILayoutOption[0]); EditorGUILayout.Space(); for (int i = 0; i < customFilterChannelCount; i++) { GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.MinWidth(50f), GUILayout.Height(5f) }; EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, i), ref this.dataOut[i], optionArray1); } GUILayout.EndVertical(); Color color = GUI.color; GUI.color = new Color(r, 1f - r, 0f, 1f); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f), GUILayout.Height(20f) }; GUILayout.Box($"{num2:00.00}ms", options); GUI.color = color; GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUIView.current.Repaint(); } }
public void DrawAudioFilterGUI(MonoBehaviour behaviour) { int channelCount = AudioUtil.GetCustomFilterChannelCount(behaviour); if (channelCount > 0) { if (dataOut == null) { dataOut = new EditorGUI.VUMeter.SmoothingData[channelCount]; } double ms = (double)AudioUtil.GetCustomFilterProcessTime(behaviour) / 1000000.0; // ms float limit = (float)ms / ((float)AudioSettings.outputSampleRate / 1024.0f / (float)channelCount); GUILayout.BeginHorizontal(); GUILayout.Space(13); GUILayout.BeginVertical(); EditorGUILayout.Space(); for (int c = 0; c < channelCount; ++c) { EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, c), ref dataOut[c], GUILayout.MinWidth(50), GUILayout.Height(5)); } GUILayout.EndVertical(); Color old = GUI.color; GUI.color = new Color(limit, 1.0f - limit, 0.0f, 1.0f); GUILayout.Box(UnityString.Format("{0:00.00}ms", ms), GUILayout.MinWidth(40), GUILayout.Height(20)); GUI.color = old; GUILayout.EndHorizontal(); EditorGUILayout.Space(); // force repaint GUIView.current.Repaint(); } }
public void DrawAudioFilterGUI(MonoBehaviour behaviour) { int filterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour); if (filterChannelCount <= 0) { return; } if (this.dataOut == null) { this.dataOut = new EditorGUI.VUMeter.SmoothingData[filterChannelCount]; } double num = (double)AudioUtil.GetCustomFilterProcessTime(behaviour) / 1000000.0; float r = (float)num / ((float)AudioSettings.outputSampleRate / 1024f / (float)filterChannelCount); GUILayout.BeginHorizontal(); GUILayout.Space(13f); GUILayout.BeginVertical(); EditorGUILayout.Space(); for (int channel = 0; channel < filterChannelCount; ++channel) { EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, channel), ref this.dataOut[channel], GUILayout.MinWidth(50f), GUILayout.Height(5f)); } GUILayout.EndVertical(); Color color = GUI.color; GUI.color = new Color(r, 1f - r, 0.0f, 1f); GUILayout.Box(string.Format("{0:00.00}ms", (object)num), new GUILayoutOption[2] { GUILayout.MinWidth(40f), GUILayout.Height(20f) }); GUI.color = color; GUILayout.EndHorizontal(); EditorGUILayout.Space(); GUIView.current.Repaint(); }