RepaintAudioMixerAndInspectors() public static méthode

public static RepaintAudioMixerAndInspectors ( ) : void
Résultat void
 public void UndoRedoPerformed()
 {
     if (!(this.m_Controller == null))
     {
         this.m_Controller.SanitizeGroupViews();
         this.m_Controller.OnUnitySelectionChanged();
         this.m_Controller.OnSubAssetChanged();
         if (this.m_GroupTree != null)
         {
             this.m_GroupTree.OnUndoRedoPerformed();
         }
         if (this.m_GroupViews != null)
         {
             this.m_GroupViews.OnUndoRedoPerformed();
         }
         if (this.m_SnapshotListView != null)
         {
             this.m_SnapshotListView.OnUndoRedoPerformed();
         }
         if (this.m_MixersTree != null)
         {
             this.m_MixersTree.OnUndoRedoPerformed();
         }
         AudioMixerUtility.RepaintAudioMixerAndInspectors();
     }
 }
 public static void UnexposePopupCallback(object obj)
 {
     AudioMixerEffectGUI.ExposedParamContext exposedParamContext = (AudioMixerEffectGUI.ExposedParamContext)obj;
     Undo.RecordObject(exposedParamContext.controller, "Unexpose Mixer Parameter");
     exposedParamContext.controller.RemoveExposedParameter(exposedParamContext.path.parameter);
     AudioMixerUtility.RepaintAudioMixerAndInspectors();
 }
 private void UpdateAfterAssetChange()
 {
     if (!(this.m_Controller == null))
     {
         this.m_Controller.SanitizeGroupViews();
         this.m_Controller.OnUnitySelectionChanged();
         if (this.m_GroupTree != null)
         {
             this.m_GroupTree.ReloadTreeData();
         }
         if (this.m_GroupViews != null)
         {
             this.m_GroupViews.RecreateListControl();
         }
         if (this.m_SnapshotListView != null)
         {
             this.m_SnapshotListView.LoadFromBackend();
         }
         if (this.m_MixersTree != null)
         {
             this.m_MixersTree.ReloadTree();
         }
         AudioMixerUtility.RepaintAudioMixerAndInspectors();
     }
 }
Exemple #4
0
        void UpdateAfterAssetChange()
        {
            if (m_Controller == null)
            {
                return;
            }

            m_AllControllers = FindAllAudioMixerControllers();

            m_Controller.SanitizeGroupViews();
            m_Controller.OnUnitySelectionChanged();

            if (m_GroupTree != null)
            {
                m_GroupTree.ReloadTreeData();
            }

            if (m_GroupViews != null)
            {
                m_GroupViews.RecreateListControl();
            }

            if (m_SnapshotListView != null)
            {
                m_SnapshotListView.LoadFromBackend();
            }

            if (m_MixersTree != null)
            {
                m_MixersTree.ReloadTree();
            }

            AudioMixerUtility.RepaintAudioMixerAndInspectors();
        }
Exemple #5
0
        public void UndoRedoPerformed()
        {
            if (m_Controller == null)
            {
                return;
            }

            // Undo may have deleted one of the selected groups
            m_Controller.OnSubAssetChanged();
            m_Controller.SanitizeGroupViews();
            m_Controller.OnUnitySelectionChanged();

            if (m_GroupTree != null)
            {
                m_GroupTree.OnUndoRedoPerformed();
            }

            if (m_GroupViews != null)
            {
                m_GroupViews.OnUndoRedoPerformed();
            }

            if (m_SnapshotListView != null)
            {
                m_SnapshotListView.OnUndoRedoPerformed();
            }

            if (m_MixersTree != null)
            {
                m_MixersTree.OnUndoRedoPerformed();
            }

            AudioMixerUtility.RepaintAudioMixerAndInspectors();
        }
Exemple #6
0
        public static void ExposePopupCallback(object obj)
        {
            ExposedParamContext context = (ExposedParamContext)obj;

            Undo.RecordObject(context.controller, "Expose Mixer Parameter");
            context.controller.AddExposedParameter(context.path);
            AudioMixerUtility.RepaintAudioMixerAndInspectors();
        }
Exemple #7
0
        private static void ShowEffectContextMenu(AudioMixerGroupController group, AudioMixerEffectController effect, int effectIndex, AudioMixerController controller, Rect buttonRect)
        {
            GenericMenu genericMenu = new GenericMenu();

            if (!effect.IsReceive())
            {
                if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsDuckVolume())
                {
                    genericMenu.AddItem(new GUIContent("Allow Wet Mixing (causes higher memory usage)"), effect.enableWetMix, delegate
                    {
                        effect.enableWetMix = !effect.enableWetMix;
                    });
                    genericMenu.AddItem(new GUIContent("Bypass"), effect.bypass, delegate
                    {
                        effect.bypass = !effect.bypass;
                        controller.UpdateBypass();
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    });
                    genericMenu.AddSeparator(string.Empty);
                }
                genericMenu.AddItem(new GUIContent("Copy effect settings to all snapshots"), false, delegate
                {
                    Undo.RecordObject(controller, "Copy effect settings to all snapshots");
                    if (effect.IsAttenuation())
                    {
                        controller.CopyAttenuationToAllSnapshots(group, controller.TargetSnapshot);
                    }
                    else
                    {
                        controller.CopyEffectSettingsToAllSnapshots(group, effectIndex, controller.TargetSnapshot, effect.IsSend());
                    }
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                });
                if (!effect.IsAttenuation() && !effect.IsSend() && !effect.IsDuckVolume() && effect.enableWetMix)
                {
                    genericMenu.AddItem(new GUIContent("Copy effect settings to all snapshots, including wet level"), false, delegate
                    {
                        Undo.RecordObject(controller, "Copy effect settings to all snapshots, including wet level");
                        controller.CopyEffectSettingsToAllSnapshots(group, effectIndex, controller.TargetSnapshot, true);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    });
                }
                genericMenu.AddSeparator(string.Empty);
            }
            AudioMixerChannelStripView.AddEffectItemsToMenu(controller, group, effectIndex, "Add effect before/", genericMenu);
            AudioMixerChannelStripView.AddEffectItemsToMenu(controller, group, effectIndex + 1, "Add effect after/", genericMenu);
            if (!effect.IsAttenuation())
            {
                genericMenu.AddSeparator(string.Empty);
                genericMenu.AddItem(new GUIContent("Remove this effect"), false, delegate
                {
                    controller.ClearSendConnectionsTo(effect);
                    controller.RemoveEffect(effect, group);
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                });
            }
            genericMenu.DropDown(buttonRect);
        }
 public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
 {
     if (this.isDragging)
     {
         Event     current        = Event.current;
         EventType typeForControl = current.GetTypeForControl(this.m_DragControlID);
         if (typeForControl != EventType.MouseDrag)
         {
             if (typeForControl != EventType.MouseUp)
             {
                 if (typeForControl == EventType.Repaint)
                 {
                     if (this.m_DragHighlightPos > 0f)
                     {
                         float width  = totalRect.width;
                         Color color  = (!this.m_MovingEffectAllowed) ? this.kMoveColorLoDisallowed : this.kMoveColorLoAllowed;
                         Color color2 = (!this.m_MovingEffectAllowed) ? this.kMoveColorHiDisallowed : this.kMoveColorHiAllowed;
                         Color color3 = (!this.m_MovingEffectAllowed) ? this.kMoveColorBorderDisallowed : this.kMoveColorBorderAllowed;
                         AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - 15f, width, 15f), color, color2);
                         AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos, width, 15f), color2, color);
                         AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - this.m_DragHighlightHeight / 2f, width, this.m_DragHighlightHeight), color3, color3);
                     }
                 }
             }
             else
             {
                 current.Use();
                 if (this.m_MovingSrcIndex != -1)
                 {
                     if (this.m_MovingDstIndex != -1 && this.m_MovingEffectAllowed)
                     {
                         List <AudioMixerEffectController> list = group.effects.ToList <AudioMixerEffectController>();
                         if (AudioMixerController.MoveEffect(ref list, this.m_MovingSrcIndex, ref list, this.m_MovingDstIndex))
                         {
                             group.effects = list.ToArray();
                         }
                     }
                     this.m_MovingSrcIndex             = -1;
                     this.m_MovingDstIndex             = -1;
                     controller.m_HighlightEffectIndex = -1;
                     if (GUIUtility.hotControl == this.m_DragControlID)
                     {
                         GUIUtility.hotControl = 0;
                     }
                     EditorGUIUtility.SetWantsMouseJumping(0);
                     AudioMixerUtility.RepaintAudioMixerAndInspectors();
                     GUIUtility.ExitGUI();
                 }
             }
         }
         else
         {
             this.m_MovingPos = current.mousePosition.y;
             current.Use();
         }
     }
 }
            public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
            {
                if (!this.isDragging)
                {
                    return;
                }
                Event     current        = Event.current;
                EventType typeForControl = current.GetTypeForControl(this.m_DragControlID);

                switch (typeForControl)
                {
                case EventType.MouseUp:
                    current.Use();
                    if (this.m_MovingSrcIndex == -1)
                    {
                        break;
                    }
                    if (this.m_MovingDstIndex != -1 && this.m_MovingEffectAllowed)
                    {
                        List <AudioMixerEffectController> list = ((IEnumerable <AudioMixerEffectController>)group.effects).ToList <AudioMixerEffectController>();
                        if (AudioMixerController.MoveEffect(ref list, this.m_MovingSrcIndex, ref list, this.m_MovingDstIndex))
                        {
                            group.effects = list.ToArray();
                        }
                    }
                    this.m_MovingSrcIndex             = -1;
                    this.m_MovingDstIndex             = -1;
                    controller.m_HighlightEffectIndex = -1;
                    if (GUIUtility.hotControl == this.m_DragControlID)
                    {
                        GUIUtility.hotControl = 0;
                    }
                    EditorGUIUtility.SetWantsMouseJumping(0);
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    GUIUtility.ExitGUI();
                    break;

                case EventType.MouseDrag:
                    this.m_MovingPos = current.mousePosition.y;
                    current.Use();
                    break;

                default:
                    if (typeForControl != EventType.Repaint || (double)this.m_DragHighlightPos <= 0.0)
                    {
                        break;
                    }
                    float width  = totalRect.width;
                    Color color1 = !this.m_MovingEffectAllowed ? this.kMoveColorLoDisallowed : this.kMoveColorLoAllowed;
                    Color color2 = !this.m_MovingEffectAllowed ? this.kMoveColorHiDisallowed : this.kMoveColorHiAllowed;
                    Color color3 = !this.m_MovingEffectAllowed ? this.kMoveColorBorderDisallowed : this.kMoveColorBorderAllowed;
                    AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - 15f, width, 15f), color1, color2);
                    AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos, width, 15f), color2, color1);
                    AudioMixerDrawUtils.DrawGradientRect(new Rect(this.m_MovingRect.x, this.m_DragHighlightPos - this.m_DragHighlightHeight / 2f, width, this.m_DragHighlightHeight), color3, color3);
                    break;
                }
            }
            // Called once per OnGUI
            public void HandleDragging(Rect totalRect, AudioMixerGroupController group, AudioMixerController controller)
            {
                // Early out if we are not dragging
                if (!isDragging)
                {
                    return;
                }

                Event       evt        = Event.current;
                const float kMoveRange = 15;

                switch (evt.GetTypeForControl(m_DragControlID))
                {
                case EventType.MouseDrag:
                    m_MovingPos = evt.mousePosition.y;
                    evt.Use();
                    break;

                case EventType.MouseUp:
                    evt.Use();
                    if (m_MovingSrcIndex != -1)
                    {
                        if (m_MovingDstIndex != -1 && m_MovingEffectAllowed)
                        {
                            var effects = group.effects.ToList();
                            if (AudioMixerController.MoveEffect(ref effects, m_MovingSrcIndex, ref effects, m_MovingDstIndex))
                            {
                                group.effects = effects.ToArray();
                            }
                        }
                        m_MovingSrcIndex = -1;
                        m_MovingDstIndex = -1;
                        controller.m_HighlightEffectIndex = -1;
                        if (GUIUtility.hotControl == m_DragControlID)
                        {
                            GUIUtility.hotControl = 0;
                        }
                        EditorGUIUtility.SetWantsMouseJumping(0);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                        EditorGUIUtility.ExitGUI();     // Exit because we changed order of effects
                    }
                    break;

                case EventType.Repaint:
                    if (m_DragHighlightPos > 0.0f)
                    {
                        float w               = totalRect.width;
                        Color moveColorLo     = (m_MovingEffectAllowed) ? kMoveColorLoAllowed : kMoveColorLoDisallowed;
                        Color moveColorHi     = (m_MovingEffectAllowed) ? kMoveColorHiAllowed : kMoveColorHiDisallowed;
                        Color moveColorBorder = (m_MovingEffectAllowed) ? kMoveColorBorderAllowed : kMoveColorBorderDisallowed;
                        AudioMixerDrawUtils.DrawGradientRect(new Rect(m_MovingRect.x, m_DragHighlightPos - kMoveRange, w, kMoveRange), moveColorLo, moveColorHi);
                        AudioMixerDrawUtils.DrawGradientRect(new Rect(m_MovingRect.x, m_DragHighlightPos, w, kMoveRange), moveColorHi, moveColorLo);
                        AudioMixerDrawUtils.DrawGradientRect(new Rect(m_MovingRect.x, m_DragHighlightPos - m_DragHighlightHeight / 2, w, m_DragHighlightHeight), moveColorBorder, moveColorBorder);
                    }
                    break;
                }
            }
        public void DoEffectGUI(int effectIndex, AudioMixerGroupController group, List <AudioMixerGroupController> allGroups, Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap, ref int highlightEffectIndex)
        {
            Event current = Event.current;
            AudioMixerController       controller = group.controller;
            AudioMixerEffectController audioMixerEffectController = group.effects[effectIndex];

            MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(audioMixerEffectController.effectName);
            Rect      effectRect     = EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            bool      flag           = effectRect.Contains(current.mousePosition);
            EventType typeForControl = current.GetTypeForControl(this.m_EffectDragging.dragControlID);

            if (typeForControl == EventType.MouseMove && flag && highlightEffectIndex != effectIndex)
            {
                highlightEffectIndex = effectIndex;
                AudioMixerUtility.RepaintAudioMixerAndInspectors();
            }
            Rect  rect     = GUILayoutUtility.GetRect(1f, 17f);
            Rect  rect2    = new Rect(rect.x + 6f, rect.y + 5f, 6f, 6f);
            Rect  position = new Rect(rect.x + 8f + 6f, rect.y, rect.width - 8f - 6f - 14f - 5f, rect.height);
            Rect  rect3    = new Rect(position.xMax, rect.y, 14f, 14f);
            Rect  rect4    = new Rect(rect.x, rect.y, rect.width - 14f - 5f, rect.height);
            bool  flag2    = EditorPrefs.GetBool(AudioMixerGroupEditor.kPrefKeyForShowCpuUsage, false) && EditorUtility.audioProfilingEnabled;
            float num      = (!EditorGUIUtility.isProSkin) ? 1f : 0.1f;
            Color color    = new Color(num, num, num, 0.2f);
            Color color2   = GUI.color;

            GUI.color = color;
            GUI.DrawTexture(rect, EditorGUIUtility.whiteTexture);
            GUI.color = color2;
            Color effectColor = AudioMixerDrawUtils.GetEffectColor(audioMixerEffectController);

            EditorGUI.DrawRect(rect2, effectColor);
            GUI.Label(position, (!flag2) ? audioMixerEffectController.effectName : (audioMixerEffectController.effectName + string.Format(AudioMixerEffectView.Texts.cpuFormatString, audioMixerEffectController.GetCPUUsage(controller))), EditorStyles.boldLabel);
            if (EditorGUI.ButtonMouseDown(rect3, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.inspectorTitlebarText))
            {
                AudioMixerEffectView.ShowEffectContextMenu(group, audioMixerEffectController, effectIndex, controller, rect3);
            }
            if (current.type == EventType.ContextClick && rect.Contains(current.mousePosition))
            {
                AudioMixerEffectView.ShowEffectContextMenu(group, audioMixerEffectController, effectIndex, controller, new Rect(current.mousePosition.x, rect.y, 1f, rect.height));
                current.Use();
            }
            if (typeForControl == EventType.Repaint)
            {
                EditorGUIUtility.AddCursorRect(rect4, MouseCursor.ResizeVertical, this.m_EffectDragging.dragControlID);
            }
            using (new EditorGUI.DisabledScope(audioMixerEffectController.bypass || group.bypassEffects))
            {
                EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins, new GUILayoutOption[0]);
                if (audioMixerEffectController.IsAttenuation())
                {
                    EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
                    float valueForVolume = group.GetValueForVolume(controller, controller.TargetSnapshot);
                    if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.volume, ref valueForVolume, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume(), controller, new AudioGroupParameterPath(group, group.GetGUIDForVolume()), new GUILayoutOption[0]))
                    {
                        Undo.RecordObject(controller.TargetSnapshot, "Change Volume Fader");
                        group.SetValueForVolume(controller, controller.TargetSnapshot, valueForVolume);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    }
                    float[] array  = new float[9];
                    float[] array2 = new float[9];
                    int     num2   = group.controller.GetGroupVUInfo(group.groupID, true, ref array, ref array2);
                    if (current.type == EventType.Layout)
                    {
                        this.m_LastNumChannels = num2;
                    }
                    else
                    {
                        if (num2 != this.m_LastNumChannels)
                        {
                            HandleUtility.Repaint();
                        }
                        num2 = this.m_LastNumChannels;
                    }
                    GUILayout.Space(4f);
                    for (int i = 0; i < num2; i++)
                    {
                        float value = 1f - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(array[i], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1f, true);
                        float num3  = 1f - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(array2[i], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1f, true);
                        EditorGUILayout.VUMeterHorizontal(value, num3, new GUILayoutOption[]
                        {
                            GUILayout.Height(10f)
                        });
                        if (!EditorApplication.isPlaying && num3 > 0f)
                        {
                            AudioMixerUtility.RepaintAudioMixerAndInspectors();
                        }
                    }
                    GUILayout.Space(4f);
                    EditorGUILayout.EndVertical();
                }
                if (audioMixerEffectController.IsSend())
                {
                    GUIContent buttonContent = (!(audioMixerEffectController.sendTarget == null)) ? GUIContent.Temp(audioMixerEffectController.GetSendTargetDisplayString(effectMap)) : AudioMixerEffectView.Texts.none;
                    Rect       buttonRect;
                    if (AudioMixerEffectGUI.PopupButton(AudioMixerEffectView.Texts.bus, buttonContent, EditorStyles.popup, out buttonRect, new GUILayoutOption[0]))
                    {
                        AudioMixerEffectView.ShowBusPopupMenu(effectIndex, group, allGroups, effectMap, audioMixerEffectController, buttonRect);
                    }
                    if (audioMixerEffectController.sendTarget != null)
                    {
                        float valueForMixLevel = audioMixerEffectController.GetValueForMixLevel(controller, controller.TargetSnapshot);
                        if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.sendLevel, ref valueForMixLevel, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, new AudioEffectParameterPath(group, audioMixerEffectController, audioMixerEffectController.GetGUIDForMixLevel()), new GUILayoutOption[0]))
                        {
                            Undo.RecordObject(controller.TargetSnapshot, "Change Send Level");
                            audioMixerEffectController.SetValueForMixLevel(controller, controller.TargetSnapshot, valueForMixLevel);
                            AudioMixerUtility.RepaintAudioMixerAndInspectors();
                        }
                    }
                }
                if (MixerEffectDefinitions.EffectCanBeSidechainTarget(audioMixerEffectController))
                {
                    bool flag3 = false;
                    foreach (AudioMixerGroupController current2 in allGroups)
                    {
                        AudioMixerEffectController[] effects = current2.effects;
                        for (int j = 0; j < effects.Length; j++)
                        {
                            AudioMixerEffectController audioMixerEffectController2 = effects[j];
                            if (audioMixerEffectController2.IsSend() && audioMixerEffectController2.sendTarget == audioMixerEffectController)
                            {
                                flag3 = true;
                                break;
                            }
                            if (flag3)
                            {
                                break;
                            }
                        }
                        if (flag3)
                        {
                            break;
                        }
                    }
                    if (!flag3)
                    {
                        GUILayout.Label(new GUIContent("No Send sources connected.", EditorGUIUtility.warningIcon), new GUILayoutOption[0]);
                    }
                }
                if (audioMixerEffectController.enableWetMix && !audioMixerEffectController.IsReceive() && !audioMixerEffectController.IsDuckVolume() && !audioMixerEffectController.IsAttenuation() && !audioMixerEffectController.IsSend())
                {
                    float valueForMixLevel2 = audioMixerEffectController.GetValueForMixLevel(controller, controller.TargetSnapshot);
                    if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.wet, ref valueForMixLevel2, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, new AudioEffectParameterPath(group, audioMixerEffectController, audioMixerEffectController.GetGUIDForMixLevel()), new GUILayoutOption[0]))
                    {
                        Undo.RecordObject(controller.TargetSnapshot, "Change Mix Level");
                        audioMixerEffectController.SetValueForMixLevel(controller, controller.TargetSnapshot, valueForMixLevel2);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    }
                }
                bool flag4 = true;
                if (this.m_CustomEffectGUIs.ContainsKey(audioMixerEffectController.effectName))
                {
                    IAudioEffectPluginGUI audioEffectPluginGUI = this.m_CustomEffectGUIs[audioMixerEffectController.effectName];
                    this.m_SharedPlugin.m_Controller = controller;
                    this.m_SharedPlugin.m_Effect     = audioMixerEffectController;
                    this.m_SharedPlugin.m_ParamDefs  = effectParameters;
                    flag4 = audioEffectPluginGUI.OnGUI(this.m_SharedPlugin);
                }
                if (flag4)
                {
                    MixerParameterDefinition[] array3 = effectParameters;
                    for (int k = 0; k < array3.Length; k++)
                    {
                        MixerParameterDefinition mixerParameterDefinition = array3[k];
                        float valueForParameter = audioMixerEffectController.GetValueForParameter(controller, controller.TargetSnapshot, mixerParameterDefinition.name);
                        if (AudioMixerEffectGUI.Slider(GUIContent.Temp(mixerParameterDefinition.name, mixerParameterDefinition.description), ref valueForParameter, mixerParameterDefinition.displayScale, mixerParameterDefinition.displayExponent, mixerParameterDefinition.units, mixerParameterDefinition.minRange, mixerParameterDefinition.maxRange, controller, new AudioEffectParameterPath(group, audioMixerEffectController, audioMixerEffectController.GetGUIDForParameter(mixerParameterDefinition.name)), new GUILayoutOption[0]))
                        {
                            Undo.RecordObject(controller.TargetSnapshot, "Change " + mixerParameterDefinition.name);
                            audioMixerEffectController.SetValueForParameter(controller, controller.TargetSnapshot, mixerParameterDefinition.name, valueForParameter);
                        }
                    }
                    if (effectParameters.Length > 0)
                    {
                        GUILayout.Space(6f);
                    }
                }
            }
            this.m_EffectDragging.HandleDragElement(effectIndex, effectRect, rect4, group, allGroups);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
            AudioMixerDrawUtils.DrawSplitter();
        }
        public void OnGUI(AudioMixerGroupController group)
        {
            if (group == null)
            {
                return;
            }
            AudioMixerController             controller         = group.controller;
            List <AudioMixerGroupController> allAudioGroupsSlow = controller.GetAllAudioGroupsSlow();
            Dictionary <AudioMixerEffectController, AudioMixerGroupController> dictionary = new Dictionary <AudioMixerEffectController, AudioMixerGroupController>();

            foreach (AudioMixerGroupController current in allAudioGroupsSlow)
            {
                AudioMixerEffectController[] effects = current.effects;
                for (int i = 0; i < effects.Length; i++)
                {
                    AudioMixerEffectController key = effects[i];
                    dictionary[key] = current;
                }
            }
            Rect totalRect = EditorGUILayout.BeginVertical(new GUILayoutOption[0]);

            if (EditorApplication.isPlaying)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                EditorGUI.BeginChangeCheck();
                GUILayout.Toggle(AudioSettings.editingInPlaymode, AudioMixerEffectView.Texts.editInPlaymode, EditorStyles.miniButton, new GUILayoutOption[]
                {
                    GUILayout.Width(120f)
                });
                if (EditorGUI.EndChangeCheck())
                {
                    AudioSettings.editingInPlaymode = !AudioSettings.editingInPlaymode;
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            using (new EditorGUI.DisabledScope(!AudioMixerController.EditingTargetSnapshot()))
            {
                if (group != this.m_PrevGroup)
                {
                    this.m_PrevGroup = group;
                    controller.m_HighlightEffectIndex = -1;
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                }
                AudioMixerEffectView.DoInitialModule(group, controller, allAudioGroupsSlow);
                for (int j = 0; j < group.effects.Length; j++)
                {
                    this.DoEffectGUI(j, group, allAudioGroupsSlow, dictionary, ref controller.m_HighlightEffectIndex);
                }
                this.m_EffectDragging.HandleDragging(totalRect, group, controller);
                GUILayout.Space(10f);
                EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.FlexibleSpace();
                if (EditorGUILayout.ButtonMouseDown(AudioMixerEffectView.Texts.addEffect, FocusType.Passive, GUISkin.current.button, new GUILayoutOption[0]))
                {
                    GenericMenu genericMenu            = new GenericMenu();
                    Rect        last                   = GUILayoutUtility.topLevel.GetLast();
                    AudioMixerGroupController[] groups = new AudioMixerGroupController[]
                    {
                        group
                    };
                    AudioMixerChannelStripView.AddEffectItemsToMenu(controller, groups, group.effects.Length, string.Empty, genericMenu);
                    genericMenu.DropDown(last);
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
        public void OnGUI(AudioMixerGroupController group)
        {
            if ((UnityEngine.Object)group == (UnityEngine.Object)null)
            {
                return;
            }
            AudioMixerController             controller         = group.controller;
            List <AudioMixerGroupController> allAudioGroupsSlow = controller.GetAllAudioGroupsSlow();
            Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap = new Dictionary <AudioMixerEffectController, AudioMixerGroupController>();

            using (List <AudioMixerGroupController> .Enumerator enumerator = allAudioGroupsSlow.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    AudioMixerGroupController current = enumerator.Current;
                    foreach (AudioMixerEffectController effect in current.effects)
                    {
                        effectMap[effect] = current;
                    }
                }
            }
            Rect totalRect = EditorGUILayout.BeginVertical();

            if (EditorApplication.isPlaying)
            {
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUI.BeginChangeCheck();
                GUILayout.Toggle((AudioSettings.editingInPlaymode ? 1 : 0) != 0, AudioMixerEffectView.Texts.editInPlaymode, EditorStyles.miniButton, new GUILayoutOption[1]
                {
                    GUILayout.Width(120f)
                });
                if (EditorGUI.EndChangeCheck())
                {
                    AudioSettings.editingInPlaymode = !AudioSettings.editingInPlaymode;
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
            EditorGUI.BeginDisabledGroup(!AudioMixerController.EditingTargetSnapshot());
            if ((UnityEngine.Object)group != (UnityEngine.Object) this.m_PrevGroup)
            {
                this.m_PrevGroup = group;
                controller.m_HighlightEffectIndex = -1;
                AudioMixerUtility.RepaintAudioMixerAndInspectors();
            }
            double num = (double)AudioMixerEffectView.DoInitialModule(group, controller, allAudioGroupsSlow);

            for (int effectIndex = 0; effectIndex < group.effects.Length; ++effectIndex)
            {
                this.DoEffectGUI(effectIndex, group, allAudioGroupsSlow, effectMap, ref controller.m_HighlightEffectIndex);
            }
            this.m_EffectDragging.HandleDragging(totalRect, group, controller);
            GUILayout.Space(10f);
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (EditorGUILayout.ButtonMouseDown(AudioMixerEffectView.Texts.addEffect, FocusType.Passive, GUISkin.current.button))
            {
                GenericMenu pm   = new GenericMenu();
                Rect        last = GUILayoutUtility.topLevel.GetLast();
                AudioMixerGroupController[] groups = new AudioMixerGroupController[1] {
                    group
                };
                AudioMixerChannelStripView.AddEffectItemsToMenu(controller, groups, group.effects.Length, string.Empty, pm);
                pm.DropDown(last);
            }
            EditorGUILayout.EndHorizontal();
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndVertical();
        }
        public void DoEffectGUI(int effectIndex, AudioMixerGroupController group, List <AudioMixerGroupController> allGroups, Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap, ref int highlightEffectIndex)
        {
            Event current = Event.current;
            AudioMixerController       controller = group.controller;
            AudioMixerEffectController effect1    = group.effects[effectIndex];

            MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(effect1.effectName);
            Rect      effectRect     = EditorGUILayout.BeginVertical();
            bool      flag1          = effectRect.Contains(current.mousePosition);
            EventType typeForControl = current.GetTypeForControl(this.m_EffectDragging.dragControlID);

            if (typeForControl == EventType.MouseMove && flag1 && highlightEffectIndex != effectIndex)
            {
                highlightEffectIndex = effectIndex;
                AudioMixerUtility.RepaintAudioMixerAndInspectors();
            }
            Rect  rect1    = GUILayoutUtility.GetRect(1f, 17f);
            Rect  rect2    = new Rect(rect1.x + 6f, rect1.y + 5f, 6f, 6f);
            Rect  position = new Rect((float)((double)rect1.x + 8.0 + 6.0), rect1.y, (float)((double)rect1.width - 8.0 - 6.0 - 14.0 - 5.0), rect1.height);
            Rect  rect3    = new Rect(position.xMax, rect1.y, 14f, 14f);
            Rect  rect4    = new Rect(rect1.x, rect1.y, (float)((double)rect1.width - 14.0 - 5.0), rect1.height);
            bool  flag2    = EditorPrefs.GetBool(AudioMixerGroupEditor.kPrefKeyForShowCpuUsage, false) && EditorUtility.audioProfilingEnabled;
            float num1     = !EditorGUIUtility.isProSkin ? 1f : 0.1f;
            Color color1   = new Color(num1, num1, num1, 0.2f);
            Color color2   = GUI.color;

            GUI.color = color1;
            GUI.DrawTexture(rect1, (Texture)EditorGUIUtility.whiteTexture);
            GUI.color = color2;
            Color effectColor = AudioMixerDrawUtils.GetEffectColor(effect1);

            EditorGUI.DrawRect(rect2, effectColor);
            GUI.Label(position, !flag2 ? effect1.effectName : effect1.effectName + string.Format(AudioMixerEffectView.Texts.cpuFormatString, (object)effect1.GetCPUUsage(controller)), EditorStyles.boldLabel);
            if (EditorGUI.ButtonMouseDown(rect3, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.inspectorTitlebarText))
            {
                AudioMixerEffectView.ShowEffectContextMenu(group, effect1, effectIndex, controller, rect3);
            }
            if (current.type == EventType.ContextClick && rect1.Contains(current.mousePosition))
            {
                AudioMixerEffectView.ShowEffectContextMenu(group, effect1, effectIndex, controller, new Rect(current.mousePosition.x, rect1.y, 1f, rect1.height));
                current.Use();
            }
            if (typeForControl == EventType.Repaint)
            {
                EditorGUIUtility.AddCursorRect(rect4, MouseCursor.ResizeVertical, this.m_EffectDragging.dragControlID);
            }
            EditorGUI.BeginDisabledGroup(effect1.bypass || group.bypassEffects);
            EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins, new GUILayoutOption[0]);
            if (effect1.IsAttenuation())
            {
                EditorGUILayout.BeginVertical();
                float valueForVolume = group.GetValueForVolume(controller, controller.TargetSnapshot);
                if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.volume, ref valueForVolume, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume(), controller, (AudioParameterPath) new AudioGroupParameterPath(group, group.GetGUIDForVolume())))
                {
                    Undo.RecordObject((UnityEngine.Object)controller.TargetSnapshot, "Change Volume Fader");
                    group.SetValueForVolume(controller, controller.TargetSnapshot, valueForVolume);
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                }
                float[] vuLevel = new float[9];
                float[] vuPeak  = new float[9];
                int     num2    = group.controller.GetGroupVUInfo(group.groupID, true, ref vuLevel, ref vuPeak);
                if (current.type == EventType.Layout)
                {
                    this.m_LastNumChannels = num2;
                }
                else
                {
                    if (num2 != this.m_LastNumChannels)
                    {
                        HandleUtility.Repaint();
                    }
                    num2 = this.m_LastNumChannels;
                }
                GUILayout.Space(4f);
                for (int index = 0; index < num2; ++index)
                {
                    float num3 = 1f - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(vuLevel[index], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1f, true);
                    float peak = 1f - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(vuPeak[index], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1f, true);
                    EditorGUILayout.VUMeterHorizontal(num3, peak, new GUILayoutOption[1]
                    {
                        GUILayout.Height(10f)
                    });
                    if (!EditorApplication.isPlaying && (double)peak > 0.0)
                    {
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    }
                }
                GUILayout.Space(4f);
                EditorGUILayout.EndVertical();
            }
            if (effect1.IsSend())
            {
                GUIContent buttonContent = !((UnityEngine.Object)effect1.sendTarget == (UnityEngine.Object)null) ? GUIContent.Temp(effect1.GetSendTargetDisplayString(effectMap)) : AudioMixerEffectView.Texts.none;
                Rect       buttonRect;
                if (AudioMixerEffectGUI.PopupButton(AudioMixerEffectView.Texts.bus, buttonContent, EditorStyles.popup, out buttonRect))
                {
                    AudioMixerEffectView.ShowBusPopupMenu(effectIndex, group, allGroups, effectMap, effect1, buttonRect);
                }
                if ((UnityEngine.Object)effect1.sendTarget != (UnityEngine.Object)null)
                {
                    float valueForMixLevel = effect1.GetValueForMixLevel(controller, controller.TargetSnapshot);
                    if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.sendLevel, ref valueForMixLevel, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, (AudioParameterPath) new AudioEffectParameterPath(group, effect1, effect1.GetGUIDForMixLevel())))
                    {
                        Undo.RecordObject((UnityEngine.Object)controller.TargetSnapshot, "Change Send Level");
                        effect1.SetValueForMixLevel(controller, controller.TargetSnapshot, valueForMixLevel);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    }
                }
            }
            if (MixerEffectDefinitions.EffectCanBeSidechainTarget(effect1))
            {
                bool flag3 = false;
                using (List <AudioMixerGroupController> .Enumerator enumerator = allGroups.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        foreach (AudioMixerEffectController effect2 in enumerator.Current.effects)
                        {
                            if (effect2.IsSend() && (UnityEngine.Object)effect2.sendTarget == (UnityEngine.Object)effect1)
                            {
                                flag3 = true;
                                break;
                            }
                            if (flag3)
                            {
                                break;
                            }
                        }
                        if (flag3)
                        {
                            break;
                        }
                    }
                }
                if (!flag3)
                {
                    GUILayout.Label(new GUIContent("No Send sources connected.", (Texture)EditorGUIUtility.warningIcon));
                }
            }
            if (effect1.enableWetMix && !effect1.IsReceive() && (!effect1.IsDuckVolume() && !effect1.IsAttenuation()) && !effect1.IsSend())
            {
                float valueForMixLevel = effect1.GetValueForMixLevel(controller, controller.TargetSnapshot);
                if (AudioMixerEffectGUI.Slider(AudioMixerEffectView.Texts.wet, ref valueForMixLevel, 1f, 1f, AudioMixerEffectView.Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, (AudioParameterPath) new AudioEffectParameterPath(group, effect1, effect1.GetGUIDForMixLevel())))
                {
                    Undo.RecordObject((UnityEngine.Object)controller.TargetSnapshot, "Change Mix Level");
                    effect1.SetValueForMixLevel(controller, controller.TargetSnapshot, valueForMixLevel);
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                }
            }
            bool flag4 = true;

            if (this.m_CustomEffectGUIs.ContainsKey(effect1.effectName))
            {
                IAudioEffectPluginGUI customEffectGuI = this.m_CustomEffectGUIs[effect1.effectName];
                this.m_SharedPlugin.m_Controller = controller;
                this.m_SharedPlugin.m_Effect     = effect1;
                this.m_SharedPlugin.m_ParamDefs  = effectParameters;
                flag4 = customEffectGuI.OnGUI((IAudioEffectPlugin)this.m_SharedPlugin);
            }
            if (flag4)
            {
                foreach (MixerParameterDefinition parameterDefinition in effectParameters)
                {
                    float valueForParameter = effect1.GetValueForParameter(controller, controller.TargetSnapshot, parameterDefinition.name);
                    if (AudioMixerEffectGUI.Slider(GUIContent.Temp(parameterDefinition.name, parameterDefinition.description), ref valueForParameter, parameterDefinition.displayScale, parameterDefinition.displayExponent, parameterDefinition.units, parameterDefinition.minRange, parameterDefinition.maxRange, controller, (AudioParameterPath) new AudioEffectParameterPath(group, effect1, effect1.GetGUIDForParameter(parameterDefinition.name))))
                    {
                        Undo.RecordObject((UnityEngine.Object)controller.TargetSnapshot, "Change " + parameterDefinition.name);
                        effect1.SetValueForParameter(controller, controller.TargetSnapshot, parameterDefinition.name, valueForParameter);
                    }
                }
                if (effectParameters.Length > 0)
                {
                    GUILayout.Space(6f);
                }
            }
            EditorGUI.EndDisabledGroup();
            this.m_EffectDragging.HandleDragElement(effectIndex, effectRect, rect4, group, allGroups);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
            AudioMixerDrawUtils.DrawSplitter();
        }
        public void OnGUI(AudioMixerGroupController group)
        {
            if (group == null)
            {
                return;
            }

            var controller = group.controller;
            var allGroups  = controller.GetAllAudioGroupsSlow();
            var effectMap  = new Dictionary <AudioMixerEffectController, AudioMixerGroupController>();

            foreach (var g in allGroups)
            {
                foreach (var e in g.effects)
                {
                    effectMap[e] = g;
                }
            }

            Rect totalRect = EditorGUILayout.BeginVertical();

            if (EditorApplication.isPlaying)
            {
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUI.BeginChangeCheck();
                GUILayout.Toggle(AudioSettings.editingInPlaymode, Texts.editInPlaymode, EditorStyles.miniButton, GUILayout.Width(120));
                if (EditorGUI.EndChangeCheck())
                {
                    AudioSettings.editingInPlaymode = !AudioSettings.editingInPlaymode;
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            using (new EditorGUI.DisabledScope(!AudioMixerController.EditingTargetSnapshot()))
            {
                if (group != m_PrevGroup)
                {
                    m_PrevGroup = group;
                    controller.m_HighlightEffectIndex = -1;
                    AudioMixerUtility.RepaintAudioMixerAndInspectors();
                }

                // Do Effect modules
                DoInitialModule(group, controller, allGroups);
                for (int effectIndex = 0; effectIndex < group.effects.Length; effectIndex++)
                {
                    DoEffectGUI(effectIndex, group, allGroups, effectMap, ref controller.m_HighlightEffectIndex);
                }

                m_EffectDragging.HandleDragging(totalRect, group, controller);

                GUILayout.Space(10f);

                EditorGUILayout.BeginHorizontal();

                GUILayout.FlexibleSpace();
                if (EditorGUILayout.DropdownButton(Texts.addEffect, FocusType.Passive, GUISkin.current.button))
                {
                    GenericMenu pm         = new GenericMenu();
                    Rect        buttonRect = GUILayoutUtility.topLevel.GetLast();
                    AudioMixerGroupController[] groupArray = new AudioMixerGroupController[] { group };
                    AudioMixerChannelStripView.AddEffectItemsToMenu(controller, groupArray, group.effects.Length, string.Empty, pm);
                    pm.DropDown(buttonRect);
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();
        }
        public void DoEffectGUI(int effectIndex, AudioMixerGroupController group, List <AudioMixerGroupController> allGroups, Dictionary <AudioMixerEffectController, AudioMixerGroupController> effectMap, ref int highlightEffectIndex)
        {
            Event evt = Event.current;

            AudioMixerController       controller = group.controller;
            AudioMixerEffectController effect     = group.effects[effectIndex];

            MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);

            // This rect is valid after every layout event
            Rect totalRect = EditorGUILayout.BeginVertical();

            bool      hovering = totalRect.Contains(evt.mousePosition);
            EventType evtType  = evt.GetTypeForControl(m_EffectDragging.dragControlID);

            if (evtType == EventType.MouseMove && hovering && highlightEffectIndex != effectIndex)
            {
                highlightEffectIndex = effectIndex;
                AudioMixerUtility.RepaintAudioMixerAndInspectors();
            }

            // Header
            const float colorCodeWidth = 6f;
            var         gearSize       = EditorStyles.iconButton.CalcSize(EditorGUI.GUIContents.titleSettingsIcon);
            Rect        headerRect     = GUILayoutUtility.GetRect(1, 17f);
            Rect        colorCodeRect  = new Rect(headerRect.x + 6f, headerRect.y + 5f, colorCodeWidth, colorCodeWidth);
            Rect        labelRect      = new Rect(headerRect.x + 8f + colorCodeWidth, headerRect.y, headerRect.width - 8f - colorCodeWidth - gearSize.x - 5f, headerRect.height);
            Rect        gearRect       = new Rect(labelRect.xMax, headerRect.y, gearSize.x, gearSize.y);
            Rect        dragRect       = new Rect(headerRect.x, headerRect.y, headerRect.width - gearSize.x - 5f, headerRect.height);

            {
                bool showCPU = EditorPrefs.GetBool(AudioMixerGroupEditor.kPrefKeyForShowCpuUsage, false) && EditorUtility.audioProfilingEnabled;

                float val         = EditorGUIUtility.isProSkin ? 0.1f : 1.0f;
                Color headerColor = new Color(val, val, val, 0.2f);
                Color origColor   = GUI.color;
                GUI.color = headerColor;
                GUI.DrawTexture(headerRect, EditorGUIUtility.whiteTexture);
                GUI.color = origColor;

                Color effectColorCode = AudioMixerDrawUtils.GetEffectColor(effect);
                EditorGUI.DrawRect(colorCodeRect, effectColorCode);
                GUI.Label(labelRect, showCPU ? effect.effectName + string.Format(Texts.cpuFormatString, effect.GetCPUUsage(controller)) : effect.effectName, EditorStyles.boldLabel);
                if (EditorGUI.DropdownButton(gearRect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive, EditorStyles.iconButton))
                {
                    ShowEffectContextMenu(group, effect, effectIndex, controller, gearRect);
                }

                // Show context menu if right clicking in header rect (for convenience)
                if (evt.type == EventType.ContextClick && headerRect.Contains(evt.mousePosition))
                {
                    ShowEffectContextMenu(group, effect, effectIndex, controller, new Rect(evt.mousePosition.x, headerRect.y, 1, headerRect.height));
                    evt.Use();
                }

                if (evtType == EventType.Repaint)
                {
                    EditorGUIUtility.AddCursorRect(dragRect, MouseCursor.ResizeVertical, m_EffectDragging.dragControlID);
                }
            }

            using (new EditorGUI.DisabledScope(effect.bypass || group.bypassEffects))
            {
                EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);

                if (effect.IsAttenuation())
                {
                    EditorGUILayout.BeginVertical();
                    float value = group.GetValueForVolume(controller, controller.TargetSnapshot);
                    if (AudioMixerEffectGUI.Slider(Texts.volume, ref value, 1.0f, 1.0f, Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume(), controller, new AudioGroupParameterPath(group, group.GetGUIDForVolume())))
                    {
                        Undo.RecordObject(controller.TargetSnapshot, "Change Volume Fader");
                        group.SetValueForVolume(controller, controller.TargetSnapshot, value);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    }

                    //FIXME
                    // 1) The VUMeter used is not in the same style that fits the rest of the Audio UI
                    // 2) The layout of the VU meters is hacked together and a lot of magic numbers are used.
                    int     numChannels  = 0;
                    float[] vuinfo_level = new float[9];
                    float[] vuinfo_peak  = new float[9];

                    numChannels = group.controller.GetGroupVUInfo(group.groupID, true, ref vuinfo_level, ref vuinfo_peak);

                    if (evt.type == EventType.Layout)
                    {
                        m_LastNumChannels = numChannels;
                    }
                    else
                    {
                        if (numChannels != m_LastNumChannels)
                        {
                            HandleUtility.Repaint();      // Repaint to ensure correct rendered num channels
                        }
                        // Ensure same num channels as in layout event to not break IMGUI controlID handling
                        numChannels = m_LastNumChannels;
                    }

                    GUILayout.Space(4f);
                    for (int c = 0; c < numChannels; ++c)
                    {
                        float level = 1 - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(vuinfo_level[c], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1, true);
                        float peak  = 1 - AudioMixerController.VolumeToScreenMapping(Mathf.Clamp(vuinfo_peak[c], AudioMixerController.kMinVolume, AudioMixerController.GetMaxVolume()), 1, true);
                        EditorGUILayout.VUMeterHorizontal(level, peak, GUILayout.Height(10));

                        //This allows the meters to drop to 0 after PlayMode has stopped.
                        if (!EditorApplication.isPlaying && peak > 0.0F)
                        {
                            AudioMixerUtility.RepaintAudioMixerAndInspectors();
                        }
                    }
                    GUILayout.Space(4f);
                    EditorGUILayout.EndVertical();
                }

                if (effect.IsSend())
                {
                    Rect       buttonRect;
                    GUIContent buttonContent = (effect.sendTarget == null) ? Texts.none : GUIContent.Temp(effect.GetSendTargetDisplayString(effectMap));
                    if (AudioMixerEffectGUI.PopupButton(Texts.bus, buttonContent, EditorStyles.popup, out buttonRect))
                    {
                        ShowBusPopupMenu(effectIndex, @group, allGroups, effectMap, effect, buttonRect);
                    }

                    if (effect.sendTarget != null)
                    {
                        float wetLevel = effect.GetValueForMixLevel(controller, controller.TargetSnapshot);
                        if (AudioMixerEffectGUI.Slider(Texts.sendLevel, ref wetLevel, 1.0f, 1.0f, Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, new AudioGroupParameterPath(group, group.GetGUIDForSend())))
                        {
                            Undo.RecordObject(controller.TargetSnapshot, "Change Send Level");
                            effect.SetValueForMixLevel(controller, controller.TargetSnapshot, wetLevel);
                            AudioMixerUtility.RepaintAudioMixerAndInspectors();
                        }
                    }
                }

                if (MixerEffectDefinitions.EffectCanBeSidechainTarget(effect))
                {
                    bool anyTargetsFound = false;
                    foreach (var g in allGroups)
                    {
                        foreach (var e in g.effects)
                        {
                            if (e.IsSend() && e.sendTarget == effect)
                            {
                                anyTargetsFound = true;
                                break;
                            }
                        }
                        if (anyTargetsFound)
                        {
                            break;
                        }
                    }
                    if (!anyTargetsFound)
                    {
                        GUILayout.Label(EditorGUIUtility.TrTextContent("No Send sources connected.", EditorGUIUtility.warningIcon));
                    }
                }

                // Wet mix
                if (effect.enableWetMix && !effect.IsReceive() && !effect.IsDuckVolume() && !effect.IsAttenuation() && !effect.IsSend())
                {
                    float wetLevel = effect.GetValueForMixLevel(controller, controller.TargetSnapshot);
                    if (AudioMixerEffectGUI.Slider(Texts.wet, ref wetLevel, 1.0f, 1.0f, Texts.dB, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect, controller, new AudioEffectParameterPath(group, effect, effect.GetGUIDForMixLevel())))
                    {
                        Undo.RecordObject(controller.TargetSnapshot, "Change Mix Level");
                        effect.SetValueForMixLevel(controller, controller.TargetSnapshot, wetLevel);
                        AudioMixerUtility.RepaintAudioMixerAndInspectors();
                    }
                }

                // All other effects
                bool drawDefaultGUI = true;
                if (m_CustomEffectGUIs.ContainsKey(effect.effectName))
                {
                    var customGUI = m_CustomEffectGUIs[effect.effectName];
                    m_SharedPlugin.m_Controller = controller;
                    m_SharedPlugin.m_Effect     = effect;
                    m_SharedPlugin.m_ParamDefs  = paramDefs;
                    drawDefaultGUI = customGUI.OnGUI(m_SharedPlugin);
                }
                if (drawDefaultGUI)
                {
                    foreach (var p in paramDefs)
                    {
                        float value = effect.GetValueForParameter(controller, controller.TargetSnapshot, p.name);
                        if (AudioMixerEffectGUI.Slider(GUIContent.Temp(p.name, p.description), ref value, p.displayScale, p.displayExponent, p.units, p.minRange, p.maxRange, controller, new AudioEffectParameterPath(group, effect, effect.GetGUIDForParameter(p.name))))
                        {
                            Undo.RecordObject(controller.TargetSnapshot, "Change " + p.name);
                            effect.SetValueForParameter(controller, controller.TargetSnapshot, p.name, value);
                        }
                    }
                    if (paramDefs.Length > 0)
                    {
                        GUILayout.Space(6f);
                    }
                }
            }

            m_EffectDragging.HandleDragElement(effectIndex, totalRect, dragRect, group, allGroups);

            EditorGUILayout.EndVertical(); // indented effect contents
            EditorGUILayout.EndVertical(); // calc total size

            AudioMixerDrawUtils.DrawSplitter();
        }