public void DumpHierarchy(string title, int level)
        {
            if (title != "")
            {
                Console.WriteLine(title);
            }
            string str = "";
            int    num = level;

            while (num-- > 0)
            {
                str += "  ";
            }
            Console.WriteLine(str + "name=" + base.name);
            str += "  ";
            AudioMixerEffectController[] effects = this.effects;
            for (int i = 0; i < effects.Length; i++)
            {
                AudioMixerEffectController audioMixerEffectController = effects[i];
                Console.WriteLine(str + "effect=" + audioMixerEffectController.ToString());
            }
            AudioMixerGroupController[] children = this.children;
            for (int j = 0; j < children.Length; j++)
            {
                AudioMixerGroupController audioMixerGroupController = children[j];
                audioMixerGroupController.DumpHierarchy("", level + 1);
            }
        }
Exemplo n.º 2
0
        public AudioMixerEffectController CopyEffect(AudioMixerEffectController sourceEffect)
        {
            var copiedEffect = new AudioMixerEffectController(sourceEffect.effectName);

            copiedEffect.name = sourceEffect.name;
            copiedEffect.PreallocateGUIDs();
            MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(sourceEffect.effectName);
            float value;

            foreach (var s in snapshots)
            {
                if (s.GetValue(sourceEffect.GetGUIDForMixLevel(), out value))
                {
                    s.SetValue(copiedEffect.GetGUIDForMixLevel(), value);
                }
                foreach (var p in paramDefs)
                {
                    if (s.GetValue(sourceEffect.GetGUIDForParameter(p.name), out value))
                    {
                        s.SetValue(copiedEffect.GetGUIDForParameter(p.name), value);
                    }
                }
            }

            AssetDatabase.AddObjectToAsset(copiedEffect, this);
            return(copiedEffect);
        }
Exemplo n.º 3
0
        void RemoveExposedParametersContainedInEffect(AudioMixerEffectController effect)
        {
            // Cleanup exposed parameters that were in the effect
            var exposedParams = exposedParameters;

            if (exposedParams.Length == 0)
            {
                return;
            }

            var undoString = "Remove Exposed Effect Parameter";

            if (exposedParams.Length > 1)
            {
                undoString = $"{undoString}s";
            }

            Undo.RecordObject(this, undoString);

            foreach (var param in exposedParams)
            {
                if (effect.ContainsParameterGUID(param.guid))
                {
                    RemoveExposedParameter(param.guid);
                }
            }
        }
Exemplo n.º 4
0
        public static bool MoveEffect(ref List <AudioMixerEffectController> sourceEffects, int sourceIndex, ref List <AudioMixerEffectController> targetEffects, int targetIndex)
        {
            if (sourceEffects == targetEffects)
            {
                if (targetIndex > sourceIndex)
                {
                    targetIndex--;
                }
                if (sourceIndex == targetIndex)
                {
                    return(false);
                }
            }
            if (sourceIndex < 0 || sourceIndex >= sourceEffects.Count)
            {
                return(false);
            }
            if (targetIndex < 0 || targetIndex > targetEffects.Count)
            {
                return(false);
            }
            AudioMixerEffectController effect = sourceEffects[sourceIndex];

            sourceEffects.RemoveAt(sourceIndex);
            targetEffects.Insert(targetIndex, effect);
            return(true);
        }
Exemplo n.º 5
0
        void ClearSendConnectionsTo(AudioMixerEffectController sendTarget)
        {
            var allGroups = GetAllAudioGroupsSlow();

            foreach (var g in allGroups)
            {
                foreach (var e in g.effects)
                {
                    if (e.IsSend() && e.sendTarget == sendTarget)
                    {
                        var guid = e.GetGUIDForMixLevel();

                        if (ContainsExposedParameter(guid))
                        {
                            Undo.RecordObjects(new Object[] { this, e }, "Clear Send target");
                            RemoveExposedParameter(guid);
                        }
                        else
                        {
                            Undo.RecordObject(e, "Clear Send target");
                        }

                        e.sendTarget = null;
                    }
                }
            }
        }
 public void InsertEffect(AudioMixerEffectController effect, int index)
 {
   List<AudioMixerEffectController> effectControllerList = new List<AudioMixerEffectController>((IEnumerable<AudioMixerEffectController>) this.effects);
   effectControllerList.Add((AudioMixerEffectController) null);
   for (int index1 = effectControllerList.Count - 1; index1 > index; --index1)
     effectControllerList[index1] = effectControllerList[index1 - 1];
   effectControllerList[index] = effect;
   this.effects = effectControllerList.ToArray();
 }
 public void InsertEffect(AudioMixerEffectController effect, int index)
 {
     List<AudioMixerEffectController> list = new List<AudioMixerEffectController>(this.effects) { null };
     for (int i = list.Count - 1; i > index; i--)
     {
         list[i] = list[i - 1];
     }
     list[index] = effect;
     this.effects = list.ToArray();
 }
			public BusConnection(float srcX, float srcY, AudioMixerEffectController targetEffect, float mixLevel, Color col, bool isSend, bool isSelected)
			{
				this.srcX = srcX;
				this.srcY = srcY;
				this.targetEffect = targetEffect;
				this.mixLevel = mixLevel;
				this.color = col;
				this.isSend = isSend;
				this.isSelected = isSelected;
			}
Exemplo n.º 9
0
        // Builds a graph over all connections going out of a group (the parent counts as one).
        // While building the map, the existing routing of effectSlotUnderTest are ignored and pretended it is connected to targetToTest instead.
        // Then checks are performed whether this setup would cause any loops in the graph.
        static Dictionary <object, ConnectionNode> BuildTemporaryGraph(
            List <AudioMixerGroupController> allGroups,
            AudioMixerGroupController groupWhoseEffectIsChanged, AudioMixerEffectController effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest,
            AudioMixerGroupController modifiedGroup1, List <AudioMixerEffectController> modifiedGroupEffects1,
            AudioMixerGroupController modifiedGroup2, List <AudioMixerEffectController> modifiedGroupEffects2
            )
        {
            // First build the chains of groups and their contained effects
            var graph = new Dictionary <object, ConnectionNode>();

            foreach (var group in allGroups)
            {
                var groupNode = new ConnectionNode();
                groupNode.group  = group;
                groupNode.effect = null;
                graph[group]     = groupNode;
                object groupTail        = group;
                var    reorderedEffects = (group == modifiedGroup1) ? modifiedGroupEffects1 : (group == modifiedGroup2) ? modifiedGroupEffects2 : group.effects.ToList();
                foreach (var effect in reorderedEffects)
                {
                    if (!graph.ContainsKey(effect))
                    {
                        graph[effect] = new ConnectionNode();
                    }
                    graph[effect].group  = group;
                    graph[effect].effect = effect;
                    if (!graph[groupTail].targets.Contains(effect))
                    {
                        graph[groupTail].targets.Add(effect);
                    }
                    AudioMixerEffectController target = (group == groupWhoseEffectIsChanged && effectWhoseTargetIsChanged == effect) ? targetToTest : effect.sendTarget;
                    if (target != null)
                    {
                        if (!graph.ContainsKey(target))
                        {
                            graph[target]        = new ConnectionNode();
                            graph[target].group  = group;
                            graph[target].effect = target;
                        }

                        if (!graph[effect].targets.Contains(target))
                        {
                            graph[effect].targets.Add(target);
                        }
                    }

                    groupTail = effect;
                }

                graph[group].groupTail = groupTail;
            }

            return(graph);
        }
Exemplo n.º 10
0
        public static bool InsertEffect(AudioMixerEffectController effect, ref List <AudioMixerEffectController> targetEffects, int targetIndex)
        {
            if (targetIndex < 0 || targetIndex > targetEffects.Count)
            {
                Debug.LogError("Inserting effect failed! size: " + targetEffects.Count + " at index: " + targetIndex);
                return(false);
            }

            targetEffects.Insert(targetIndex, effect);
            return(true);
        }
        public void InsertEffect(AudioMixerEffectController effect, int index)
        {
            List <AudioMixerEffectController> list = new List <AudioMixerEffectController>(this.effects);

            list.Add(null);
            for (int i = list.Count - 1; i > index; i--)
            {
                list[i] = list[i - 1];
            }
            list[index]  = effect;
            this.effects = list.ToArray();
        }
Exemplo n.º 12
0
        public void RemoveEffect(AudioMixerEffectController effect, AudioMixerGroupController group)
        {
            Undo.RecordObject(group, "Delete Effect");

            var modifiedEffectsList = new List <AudioMixerEffectController>(group.effects);

            modifiedEffectsList.Remove(effect);
            group.effects = modifiedEffectsList.ToArray();

            DestroyExposedParametersContainedInEffect(effect);
            Undo.DestroyObjectImmediate(effect);
        }
Exemplo n.º 13
0
        public void InsertEffect(AudioMixerEffectController effect, int index)
        {
            List <AudioMixerEffectController> effectControllerList = new List <AudioMixerEffectController>((IEnumerable <AudioMixerEffectController>) this.effects);

            effectControllerList.Add((AudioMixerEffectController)null);
            for (int index1 = effectControllerList.Count - 1; index1 > index; --index1)
            {
                effectControllerList[index1] = effectControllerList[index1 - 1];
            }
            effectControllerList[index] = effect;
            this.effects = effectControllerList.ToArray();
        }
Exemplo n.º 14
0
        public void InsertEffect(AudioMixerEffectController effect, int index)
        {
            var modifiedEffectsList = new List <AudioMixerEffectController>(effects);

            modifiedEffectsList.Add(null);
            for (int i = modifiedEffectsList.Count - 1; i > index; i--)
            {
                modifiedEffectsList[i] = modifiedEffectsList[i - 1];
            }
            modifiedEffectsList[index] = effect;
            effects = modifiedEffectsList.ToArray();
        }
Exemplo n.º 15
0
 public bool HasAttenuation()
 {
     AudioMixerEffectController[] effects = this.effects;
     for (int i = 0; i < effects.Length; i++)
     {
         AudioMixerEffectController audioMixerEffectController = effects[i];
         if (audioMixerEffectController.IsAttenuation())
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 16
0
        private void DestroyExposedParametersContainedInEffect(AudioMixerEffectController effect)
        {
            Undo.RecordObject(this, "Changed Exposed Parameters");
            //Cleanup exposed parameters that were in the effect
            var exposedParams = exposedParameters;

            foreach (var param in exposedParams)
            {
                if (effect.ContainsParameterGUID(param.guid))
                {
                    RemoveExposedParameter(param.guid);
                }
            }
        }
Exemplo n.º 17
0
        public void RemoveEffect(AudioMixerEffectController effect, AudioMixerGroupController group)
        {
            if (effect == null)
            {
                Debug.LogError("Effect is null.");
                return;
            }

            if (group == null)
            {
                Debug.LogError("Group is null.");
                return;
            }

            var effects     = group.effects;
            var foundEffect = false;

            for (var i = 0; i < effects.Length; ++i)
            {
                if (effects[i] == effect)
                {
                    foundEffect = true;
                    break;
                }
            }

            if (!foundEffect)
            {
                Debug.LogError($"Group {group.name} does not contain effect {effect.name}");
                return;
            }

            ClearSendConnectionsTo(effect);
            RemoveExposedParametersContainedInEffect(effect);

            var modifiedEffectsList = new List <AudioMixerEffectController>(group.effects);

            modifiedEffectsList.Remove(effect);

            const string undoGroupName = "Remove Effect";

            Undo.RecordObject(group, undoGroupName);

            group.effects = modifiedEffectsList.ToArray();

            Undo.DestroyObjectImmediate(effect);
            Undo.SetCurrentGroupName(undoGroupName);
        }
Exemplo n.º 18
0
        public void ClearSendConnectionsTo(AudioMixerEffectController sendTarget)
        {
            var allGroups = GetAllAudioGroupsSlow();

            foreach (var g in allGroups)
            {
                foreach (var e in g.effects)
                {
                    if (e.IsSend() && e.sendTarget == sendTarget)
                    {
                        Undo.RecordObject(e, "Clear Send target");
                        e.sendTarget = null;
                    }
                }
            }
        }
 public static Color GetEffectColor(AudioMixerEffectController effect)
 {
   if (effect.IsSend())
   {
     if ((Object) effect.sendTarget != (Object) null)
       return AudioMixerDrawUtils.kSendColor;
     return Color.gray;
   }
   if (effect.IsReceive())
     return AudioMixerDrawUtils.kReceiveColor;
   if (effect.IsDuckVolume())
     return AudioMixerDrawUtils.kDuckVolumeColor;
   if (effect.IsAttenuation())
     return AudioMixerDrawUtils.kAttenuationColor;
   return AudioMixerDrawUtils.kEffectColor;
 }
Exemplo n.º 20
0
        public AudioMixerGroupController CreateNewGroup(string name, bool storeUndoState)
        {
            var group = new AudioMixerGroupController(this);

            group.name = name;
            group.PreallocateGUIDs();

            var effect = new AudioMixerEffectController("Attenuation");

            AddNewSubAsset(effect, storeUndoState);
            effect.PreallocateGUIDs();

            group.InsertEffect(effect, 0);
            AddNewSubAsset(group, storeUndoState);

            return(group);
        }
        public string ResolveExposedParameterPath(GUID parameter, bool getOnlyBasePath)
        {
            //consult the cache of parameters first.
            if (exposedParamCache.ContainsKey(parameter))
            {
                AudioParameterPath path = exposedParamCache[parameter];

                return(path.ResolveStringPath(getOnlyBasePath));
            }

            //Search through the whole mixer!
            List <AudioMixerGroupController> groups = GetAllAudioGroupsSlow();

            foreach (AudioMixerGroupController group in groups)
            {
                if (group.GetGUIDForVolume() == parameter ||
                    group.GetGUIDForPitch() == parameter ||
                    group.GetGUIDForSend() == parameter)
                {
                    AudioGroupParameterPath newPath = new AudioGroupParameterPath(group, parameter);
                    exposedParamCache[parameter] = newPath;
                    return(newPath.ResolveStringPath(getOnlyBasePath));
                }
                else
                {
                    for (int i = 0; i < group.effects.Length; i++)
                    {
                        AudioMixerEffectController effect    = group.effects[i];
                        MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);

                        for (int j = 0; j < paramDefs.Length; j++)
                        {
                            GUID guid = effect.GetGUIDForParameter(paramDefs[j].name);
                            if (guid == parameter)
                            {
                                AudioEffectParameterPath newPath = new AudioEffectParameterPath(group, effect, parameter);
                                exposedParamCache[parameter] = newPath;
                                return(newPath.ResolveStringPath(getOnlyBasePath));
                            }
                        }
                    }
                }
            }
            return("Error finding Parameter path");
        }
Exemplo n.º 22
0
        public void CreateDefaultAsset(string path)
        {
            masterGroup      = new AudioMixerGroupController(this);
            masterGroup.name = "Master";
            masterGroup.PreallocateGUIDs();

            var attenuation = new AudioMixerEffectController("Attenuation");

            attenuation.PreallocateGUIDs();
            masterGroup.InsertEffect(attenuation, 0);

            AudioMixerSnapshotController snapshot = new AudioMixerSnapshotController(this);

            snapshot.name  = "Snapshot";
            this.snapshots = new AudioMixerSnapshotController[] { snapshot };

            this.startSnapshot = snapshot;

            Object[] objectArray = { this, masterGroup, attenuation, snapshot };
            AssetDatabase.CreateAssetFromObjects(objectArray, path);
        }
 public AudioMixerEffectController(string name)
 {
     AudioMixerEffectController.Internal_CreateAudioMixerEffectController(this, name);
 }
		public static bool WillChangeOfEffectTargetCauseFeedback(List<AudioMixerGroupController> allGroups, AudioMixerGroupController groupWhoseEffectIsChanged, int effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest, List<AudioMixerController.ConnectionNode> identifiedLoop)
		{
			Dictionary<object, AudioMixerController.ConnectionNode> dictionary = AudioMixerController.BuildTemporaryGraph(allGroups, groupWhoseEffectIsChanged, groupWhoseEffectIsChanged.effects[effectWhoseTargetIsChanged], targetToTest, null, null, null, null);
			foreach (AudioMixerGroupController current in allGroups)
			{
				AudioMixerGroupController[] children = current.children;
				for (int i = 0; i < children.Length; i++)
				{
					AudioMixerGroupController key = children[i];
					object groupTail = dictionary[key].groupTail;
					if (!dictionary[groupTail].targets.Contains(current))
					{
						dictionary[groupTail].targets.Add(current);
					}
				}
			}
			return AudioMixerController.DoesTheTemporaryGraphHaveAnyCycles(allGroups, identifiedLoop, dictionary);
		}
 public static bool InsertEffect(AudioMixerEffectController effect, ref List<AudioMixerEffectController> targetEffects, int targetIndex)
 {
   if (targetIndex < 0 || targetIndex > targetEffects.Count)
   {
     Debug.LogError((object) ("Inserting effect failed! size: " + (object) targetEffects.Count + " at index: " + (object) targetIndex));
     return false;
   }
   targetEffects.Insert(targetIndex, effect);
   return true;
 }
Exemplo n.º 26
0
        static public bool WillChangeOfEffectTargetCauseFeedback(List <AudioMixerGroupController> allGroups, AudioMixerGroupController groupWhoseEffectIsChanged, int effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest, List <ConnectionNode> identifiedLoop)
        {
            var graph = BuildTemporaryGraph(allGroups, groupWhoseEffectIsChanged, groupWhoseEffectIsChanged.effects[effectWhoseTargetIsChanged], targetToTest, null, null, null, null);

            // Connect the chains up using the group hierarchy
            foreach (var group in allGroups)
            {
                foreach (var childGroup in group.children)
                {
                    var tailOfChildGroup = graph[childGroup].groupTail;
                    if (!graph[tailOfChildGroup].targets.Contains(group))
                    {
                        graph[tailOfChildGroup].targets.Add(group);
                    }
                }
            }

            //ListTemporaryGraph(graph);

            return(DoesTheTemporaryGraphHaveAnyCycles(allGroups, identifiedLoop, graph));
        }
Exemplo n.º 27
0
 public static Color GetEffectColor(AudioMixerEffectController effect)
 {
     if (effect.IsSend())
     {
         return ((effect.sendTarget == null) ? Color.gray : kSendColor);
     }
     if (effect.IsReceive())
     {
         return kReceiveColor;
     }
     if (effect.IsDuckVolume())
     {
         return kDuckVolumeColor;
     }
     if (effect.IsAttenuation())
     {
         return kAttenuationColor;
     }
     return kEffectColor;
 }
 private static void ShowEffectContextMenu(AudioMixerGroupController group, AudioMixerEffectController effect, int effectIndex, AudioMixerController controller, Rect buttonRect)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AudioMixerEffectView.\u003CShowEffectContextMenu\u003Ec__AnonStorey63 menuCAnonStorey63 = new AudioMixerEffectView.\u003CShowEffectContextMenu\u003Ec__AnonStorey63();
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey63.effect = effect;
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey63.controller = controller;
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey63.group = group;
   // ISSUE: reference to a compiler-generated field
   menuCAnonStorey63.effectIndex = effectIndex;
   GenericMenu pm = new GenericMenu();
   // ISSUE: reference to a compiler-generated field
   if (!menuCAnonStorey63.effect.IsReceive())
   {
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     if (!menuCAnonStorey63.effect.IsAttenuation() && !menuCAnonStorey63.effect.IsSend() && !menuCAnonStorey63.effect.IsDuckVolume())
     {
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated method
       pm.AddItem(new GUIContent("Allow Wet Mixing (causes higher memory usage)"), menuCAnonStorey63.effect.enableWetMix, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AA));
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated method
       pm.AddItem(new GUIContent("Bypass"), menuCAnonStorey63.effect.bypass, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AB));
       pm.AddSeparator(string.Empty);
     }
     // ISSUE: reference to a compiler-generated method
     pm.AddItem(new GUIContent("Copy effect settings to all snapshots"), false, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AC));
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     if (!menuCAnonStorey63.effect.IsAttenuation() && !menuCAnonStorey63.effect.IsSend() && (!menuCAnonStorey63.effect.IsDuckVolume() && menuCAnonStorey63.effect.enableWetMix))
     {
       // ISSUE: reference to a compiler-generated method
       pm.AddItem(new GUIContent("Copy effect settings to all snapshots, including wet level"), false, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AD));
     }
     pm.AddSeparator(string.Empty);
   }
   // ISSUE: reference to a compiler-generated field
   AudioMixerGroupController[] groups = new AudioMixerGroupController[1]{ menuCAnonStorey63.group };
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   AudioMixerChannelStripView.AddEffectItemsToMenu(menuCAnonStorey63.controller, groups, menuCAnonStorey63.effectIndex, "Add effect before/", pm);
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   AudioMixerChannelStripView.AddEffectItemsToMenu(menuCAnonStorey63.controller, groups, menuCAnonStorey63.effectIndex + 1, "Add effect after/", pm);
   // ISSUE: reference to a compiler-generated field
   if (!menuCAnonStorey63.effect.IsAttenuation())
   {
     pm.AddSeparator(string.Empty);
     // ISSUE: reference to a compiler-generated method
     pm.AddItem(new GUIContent("Remove this effect"), false, new GenericMenu.MenuFunction(menuCAnonStorey63.\u003C\u003Em__AE));
   }
   pm.DropDown(buttonRect);
 }
		public GUIStyle GetEffectBarStyle(AudioMixerEffectController effect)
		{
			if (effect.IsSend() || effect.IsReceive() || effect.IsDuckVolume())
			{
				return this.styles.sendReturnBar;
			}
			if (effect.IsAttenuation())
			{
				return this.styles.attenuationBar;
			}
			return this.styles.effectBar;
		}
 private void DestroyExposedParametersContainedInEffect(AudioMixerEffectController effect)
 {
   Undo.RecordObject((UnityEngine.Object) this, "Changed Exposed Parameters");
   foreach (ExposedAudioParameter exposedParameter in this.exposedParameters)
   {
     if (effect.ContainsParameterGUID(exposedParameter.guid))
       this.RemoveExposedParameter(exposedParameter.guid);
   }
 }
 public void CreateDefaultAsset(string path)
 {
   this.masterGroup = new AudioMixerGroupController((AudioMixer) this);
   this.masterGroup.name = "Master";
   this.masterGroup.PreallocateGUIDs();
   AudioMixerEffectController effect = new AudioMixerEffectController("Attenuation");
   effect.PreallocateGUIDs();
   this.masterGroup.InsertEffect(effect, 0);
   AudioMixerSnapshotController snapshotController = new AudioMixerSnapshotController((AudioMixer) this);
   snapshotController.name = "Snapshot";
   this.snapshots = new AudioMixerSnapshotController[1]
   {
     snapshotController
   };
   this.startSnapshot = (AudioMixerSnapshot) snapshotController;
   AssetDatabase.CreateAssetFromObjects(new UnityEngine.Object[4]
   {
     (UnityEngine.Object) this,
     (UnityEngine.Object) this.masterGroup,
     (UnityEngine.Object) effect,
     (UnityEngine.Object) snapshotController
   }, path);
 }
		private static Dictionary<object, AudioMixerController.ConnectionNode> BuildTemporaryGraph(List<AudioMixerGroupController> allGroups, AudioMixerGroupController groupWhoseEffectIsChanged, AudioMixerEffectController effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest, AudioMixerGroupController modifiedGroup1, List<AudioMixerEffectController> modifiedGroupEffects1, AudioMixerGroupController modifiedGroup2, List<AudioMixerEffectController> modifiedGroupEffects2)
		{
			Dictionary<object, AudioMixerController.ConnectionNode> dictionary = new Dictionary<object, AudioMixerController.ConnectionNode>();
			foreach (AudioMixerGroupController current in allGroups)
			{
				dictionary[current] = new AudioMixerController.ConnectionNode
				{
					group = current,
					effect = null
				};
				object obj = current;
				List<AudioMixerEffectController> list = (!(current == modifiedGroup1)) ? ((!(current == modifiedGroup2)) ? current.effects.ToList<AudioMixerEffectController>() : modifiedGroupEffects2) : modifiedGroupEffects1;
				foreach (AudioMixerEffectController current2 in list)
				{
					if (!dictionary.ContainsKey(current2))
					{
						dictionary[current2] = new AudioMixerController.ConnectionNode();
					}
					dictionary[current2].group = current;
					dictionary[current2].effect = current2;
					if (!dictionary[obj].targets.Contains(current2))
					{
						dictionary[obj].targets.Add(current2);
					}
					AudioMixerEffectController audioMixerEffectController = (!(current == groupWhoseEffectIsChanged) || !(effectWhoseTargetIsChanged == current2)) ? current2.sendTarget : targetToTest;
					if (audioMixerEffectController != null)
					{
						if (!dictionary.ContainsKey(audioMixerEffectController))
						{
							dictionary[audioMixerEffectController] = new AudioMixerController.ConnectionNode();
							dictionary[audioMixerEffectController].group = current;
							dictionary[audioMixerEffectController].effect = audioMixerEffectController;
						}
						if (!dictionary[current2].targets.Contains(audioMixerEffectController))
						{
							dictionary[current2].targets.Add(audioMixerEffectController);
						}
					}
					obj = current2;
				}
				dictionary[current].groupTail = obj;
			}
			return dictionary;
		}
 public void RemoveEffect(AudioMixerEffectController effect, AudioMixerGroupController group)
 {
   Undo.RecordObject((UnityEngine.Object) group, "Delete Effect");
   List<AudioMixerEffectController> effectControllerList = new List<AudioMixerEffectController>((IEnumerable<AudioMixerEffectController>) group.effects);
   effectControllerList.Remove(effect);
   group.effects = effectControllerList.ToArray();
   this.DestroyExposedParametersContainedInEffect(effect);
   Undo.DestroyObjectImmediate((UnityEngine.Object) effect);
 }
 public static extern bool EffectCanBeSidechainTarget(AudioMixerEffectController effect);
 public AudioMixerGroupController CreateNewGroup(string name, bool storeUndoState)
 {
   AudioMixerGroupController mixerGroupController = new AudioMixerGroupController((AudioMixer) this);
   mixerGroupController.name = name;
   mixerGroupController.PreallocateGUIDs();
   AudioMixerEffectController effect = new AudioMixerEffectController("Attenuation");
   this.AddNewSubAsset((UnityEngine.Object) effect, storeUndoState);
   effect.PreallocateGUIDs();
   mixerGroupController.InsertEffect(effect, 0);
   this.AddNewSubAsset((UnityEngine.Object) mixerGroupController, storeUndoState);
   return mixerGroupController;
 }
 private static Dictionary<object, AudioMixerController.ConnectionNode> BuildTemporaryGraph(List<AudioMixerGroupController> allGroups, AudioMixerGroupController groupWhoseEffectIsChanged, AudioMixerEffectController effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest, AudioMixerGroupController modifiedGroup1, List<AudioMixerEffectController> modifiedGroupEffects1, AudioMixerGroupController modifiedGroup2, List<AudioMixerEffectController> modifiedGroupEffects2)
 {
   Dictionary<object, AudioMixerController.ConnectionNode> dictionary = new Dictionary<object, AudioMixerController.ConnectionNode>();
   using (List<AudioMixerGroupController>.Enumerator enumerator1 = allGroups.GetEnumerator())
   {
     while (enumerator1.MoveNext())
     {
       AudioMixerGroupController current1 = enumerator1.Current;
       dictionary[(object) current1] = new AudioMixerController.ConnectionNode()
       {
         group = current1,
         effect = (AudioMixerEffectController) null
       };
       object index = (object) current1;
       using (List<AudioMixerEffectController>.Enumerator enumerator2 = (!((UnityEngine.Object) current1 == (UnityEngine.Object) modifiedGroup1) ? (!((UnityEngine.Object) current1 == (UnityEngine.Object) modifiedGroup2) ? ((IEnumerable<AudioMixerEffectController>) current1.effects).ToList<AudioMixerEffectController>() : modifiedGroupEffects2) : modifiedGroupEffects1).GetEnumerator())
       {
         while (enumerator2.MoveNext())
         {
           AudioMixerEffectController current2 = enumerator2.Current;
           if (!dictionary.ContainsKey((object) current2))
             dictionary[(object) current2] = new AudioMixerController.ConnectionNode();
           dictionary[(object) current2].group = current1;
           dictionary[(object) current2].effect = current2;
           if (!dictionary[index].targets.Contains((object) current2))
             dictionary[index].targets.Add((object) current2);
           AudioMixerEffectController effectController = !((UnityEngine.Object) current1 == (UnityEngine.Object) groupWhoseEffectIsChanged) || !((UnityEngine.Object) effectWhoseTargetIsChanged == (UnityEngine.Object) current2) ? current2.sendTarget : targetToTest;
           if ((UnityEngine.Object) effectController != (UnityEngine.Object) null)
           {
             if (!dictionary.ContainsKey((object) effectController))
             {
               dictionary[(object) effectController] = new AudioMixerController.ConnectionNode();
               dictionary[(object) effectController].group = current1;
               dictionary[(object) effectController].effect = effectController;
             }
             if (!dictionary[(object) current2].targets.Contains((object) effectController))
               dictionary[(object) current2].targets.Add((object) effectController);
           }
           index = (object) current2;
         }
       }
       dictionary[(object) current1].groupTail = index;
     }
   }
   return dictionary;
 }
 private static extern void Internal_CreateAudioMixerEffectController(AudioMixerEffectController mono, string name);
 private extern static void Internal_CreateAudioMixerEffectController([Writable] AudioMixerEffectController mono, string name);
		private static extern void Internal_CreateAudioMixerEffectController(AudioMixerEffectController mono, string name);
			public ConnectSendContext(AudioMixerEffectController sendEffect, AudioMixerEffectController targetEffect)
			{
				this.sendEffect = sendEffect;
				this.targetEffect = targetEffect;
			}
 private static void ShowBusPopupMenu(int effectIndex, AudioMixerGroupController group, List<AudioMixerGroupController> allGroups, Dictionary<AudioMixerEffectController, AudioMixerGroupController> effectMap, AudioMixerEffectController effect, Rect buttonRect)
 {
   GenericMenu pm = new GenericMenu();
   pm.AddItem(new GUIContent("None"), false, new GenericMenu.MenuFunction2(AudioMixerChannelStripView.ConnectSendPopupCallback), (object) new AudioMixerChannelStripView.ConnectSendContext(effect, (AudioMixerEffectController) null));
   pm.AddSeparator(string.Empty);
   AudioMixerChannelStripView.AddMenuItemsForReturns(pm, string.Empty, effectIndex, group, allGroups, effectMap, effect, true);
   if (pm.GetItemCount() == 2)
     pm.AddDisabledItem(new GUIContent("No valid Receive targets found"));
   pm.DropDown(buttonRect);
 }
 public void ClearSendConnectionsTo(AudioMixerEffectController sendTarget)
 {
   using (List<AudioMixerGroupController>.Enumerator enumerator = this.GetAllAudioGroupsSlow().GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       foreach (AudioMixerEffectController effect in enumerator.Current.effects)
       {
         if (effect.IsSend() && (UnityEngine.Object) effect.sendTarget == (UnityEngine.Object) sendTarget)
         {
           Undo.RecordObject((UnityEngine.Object) effect, "Clear Send target");
           effect.sendTarget = (AudioMixerEffectController) null;
         }
       }
     }
   }
 }
 //Change to use effect
 public extern static bool EffectCanBeSidechainTarget(AudioMixerEffectController effect);
Exemplo n.º 44
0
 public AudioEffectParameterPath(AudioMixerGroupController group, AudioMixerEffectController effect, GUID parameter)
     : base(group, parameter)
 {
     this.effect = effect;
 }
		private void EffectSlotDragging(Rect r, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, bool showLevel, float level, int effectIndex, ref int highlightEffectIndex, AudioMixerChannelStripView.ChannelStripParams p)
		{
			Event current = Event.current;
			switch (current.GetTypeForControl(this.m_EffectInteractionControlID))
			{
			case EventType.MouseDown:
				if (r.Contains(current.mousePosition) && current.button == 0 && GUIUtility.hotControl == 0)
				{
					GUIUtility.hotControl = this.m_EffectInteractionControlID;
					this.m_MouseDragStartX = current.mousePosition.x;
					this.m_MouseDragStartValue = level;
					highlightEffectIndex = effectIndex;
					this.m_MovingEffectSrcIndex = -1;
					this.m_MovingEffectDstIndex = -1;
					this.m_WaitingForDragEvent = true;
					this.m_MovingSrcRect = r;
					this.m_MovingDstRect = r;
					this.m_MovingSrcGroup = p.group;
					this.m_MovingDstGroup = p.group;
					this.m_MovingEffectAllowed = true;
					this.SetFocus();
					Event.current.Use();
					EditorGUIUtility.SetWantsMouseJumping(1);
					InspectorWindow.RepaintAllInspectors();
				}
				break;
			case EventType.MouseUp:
				if (GUIUtility.hotControl == this.m_EffectInteractionControlID && current.button == 0 && p.stripRect.Contains(current.mousePosition))
				{
					if (this.m_MovingEffectDstIndex != -1 && this.m_MovingEffectAllowed)
					{
						if (this.IsDuplicateKeyPressed() && this.CanDuplicateDraggedEffect())
						{
							AudioMixerEffectController sourceEffect = this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex];
							AudioMixerEffectController effect2 = this.m_MovingSrcGroup.controller.CopyEffect(sourceEffect);
							List<AudioMixerEffectController> list = this.m_MovingDstGroup.effects.ToList<AudioMixerEffectController>();
							if (AudioMixerController.InsertEffect(effect2, ref list, this.m_MovingEffectDstIndex))
							{
								this.m_MovingDstGroup.effects = list.ToArray();
							}
						}
						else
						{
							if (this.m_MovingSrcGroup == this.m_MovingDstGroup)
							{
								List<AudioMixerEffectController> list2 = this.m_MovingSrcGroup.effects.ToList<AudioMixerEffectController>();
								if (AudioMixerController.MoveEffect(ref list2, this.m_MovingEffectSrcIndex, ref list2, this.m_MovingEffectDstIndex))
								{
									this.m_MovingSrcGroup.effects = list2.ToArray();
								}
							}
							else
							{
								if (!this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex].IsAttenuation())
								{
									List<AudioMixerEffectController> list3 = this.m_MovingSrcGroup.effects.ToList<AudioMixerEffectController>();
									List<AudioMixerEffectController> list4 = this.m_MovingDstGroup.effects.ToList<AudioMixerEffectController>();
									if (AudioMixerController.MoveEffect(ref list3, this.m_MovingEffectSrcIndex, ref list4, this.m_MovingEffectDstIndex))
									{
										this.m_MovingSrcGroup.effects = list3.ToArray();
										this.m_MovingDstGroup.effects = list4.ToArray();
									}
								}
							}
						}
					}
					this.ClearEffectDragging(ref highlightEffectIndex);
					current.Use();
					EditorGUIUtility.SetWantsMouseJumping(0);
					GUIUtility.ExitGUI();
				}
				break;
			case EventType.MouseDrag:
				if (GUIUtility.hotControl == this.m_EffectInteractionControlID)
				{
					if (this.HasFocus() && this.m_WaitingForDragEvent)
					{
						this.m_ChangingWetMixIndex = -1;
						if (effectIndex < p.group.effects.Length)
						{
							if (Mathf.Abs(current.delta.y) > Mathf.Abs(current.delta.x))
							{
								this.m_MovingEffectSrcIndex = effectIndex;
								this.ClearFocus();
							}
							else
							{
								this.m_ChangingWetMixIndex = this.m_IndexCounter;
							}
						}
						this.m_WaitingForDragEvent = false;
					}
					if (this.IsMovingEffect() && p.stripRect.Contains(current.mousePosition))
					{
						float num = r.height * 0.5f;
						float num2 = (effectIndex != 0) ? 0f : (-num);
						float num3 = (effectIndex != p.group.effects.Length - 1) ? r.height : (r.height + num);
						float num4 = current.mousePosition.y - r.y;
						if (num4 >= num2 && num4 <= num3 && effectIndex < p.group.effects.Length)
						{
							int num5 = (num4 >= num) ? (effectIndex + 1) : effectIndex;
							if (num5 != this.m_MovingEffectDstIndex || this.m_MovingDstGroup != p.group)
							{
								this.m_MovingDstRect.x = r.x;
								this.m_MovingDstRect.width = r.width;
								this.m_MovingDstRect.y = ((num4 >= num) ? (r.y + r.height) : r.y) - 1f;
								this.m_MovingEffectDstIndex = num5;
								this.m_MovingDstGroup = p.group;
								this.m_MovingEffectAllowed = ((!this.m_MovingSrcGroup.effects[this.m_MovingEffectSrcIndex].IsAttenuation() || !(this.m_MovingSrcGroup != this.m_MovingDstGroup)) && !AudioMixerController.WillMovingEffectCauseFeedback(p.allGroups, this.m_MovingSrcGroup, this.m_MovingEffectSrcIndex, this.m_MovingDstGroup, num5, null) && (!this.IsDuplicateKeyPressed() || this.CanDuplicateDraggedEffect()));
							}
							current.Use();
						}
					}
					if (this.IsAdjustingWetMix() && this.HasFocus() && showLevel)
					{
						this.m_WaitingForDragEvent = false;
						float value = AudioMixerChannelStripView.kEffectScaleMouseDrag * HandleUtility.niceMouseDelta + level;
						float num6 = Mathf.Clamp(value, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect) - level;
						if (num6 != 0f)
						{
							Undo.RecordObject(this.m_Controller.TargetSnapshot, "Change effect level");
							if (effect.IsSend() && this.m_Controller.CachedSelection.Count > 1 && this.m_Controller.CachedSelection.Contains(p.group))
							{
								List<AudioMixerEffectController> list5 = new List<AudioMixerEffectController>();
								foreach (AudioMixerGroupController current2 in this.m_Controller.CachedSelection)
								{
									AudioMixerEffectController[] effects = current2.effects;
									for (int i = 0; i < effects.Length; i++)
									{
										AudioMixerEffectController audioMixerEffectController = effects[i];
										if (audioMixerEffectController.effectName == effect.effectName && audioMixerEffectController.sendTarget == effect.sendTarget)
										{
											list5.Add(audioMixerEffectController);
										}
									}
								}
								foreach (AudioMixerEffectController current3 in list5)
								{
									if (!current3.IsSend() || current3.sendTarget != null)
									{
										current3.SetValueForMixLevel(this.m_Controller, snapshot, Mathf.Clamp(current3.GetValueForMixLevel(this.m_Controller, snapshot) + num6, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect));
									}
								}
							}
							else
							{
								if (!effect.IsSend() || effect.sendTarget != null)
								{
									effect.SetValueForMixLevel(this.m_Controller, snapshot, Mathf.Clamp(level + num6, AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect));
								}
							}
							InspectorWindow.RepaintAllInspectors();
						}
						current.Use();
					}
				}
				break;
			}
		}
 public static bool WillChangeOfEffectTargetCauseFeedback(List<AudioMixerGroupController> allGroups, AudioMixerGroupController groupWhoseEffectIsChanged, int effectWhoseTargetIsChanged, AudioMixerEffectController targetToTest, List<AudioMixerController.ConnectionNode> identifiedLoop)
 {
   Dictionary<object, AudioMixerController.ConnectionNode> graph = AudioMixerController.BuildTemporaryGraph(allGroups, groupWhoseEffectIsChanged, groupWhoseEffectIsChanged.effects[effectWhoseTargetIsChanged], targetToTest, (AudioMixerGroupController) null, (List<AudioMixerEffectController>) null, (AudioMixerGroupController) null, (List<AudioMixerEffectController>) null);
   using (List<AudioMixerGroupController>.Enumerator enumerator = allGroups.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       AudioMixerGroupController current = enumerator.Current;
       foreach (AudioMixerGroupController child in current.children)
       {
         object groupTail = graph[(object) child].groupTail;
         if (!graph[groupTail].targets.Contains((object) current))
           graph[groupTail].targets.Add((object) current);
       }
     }
   }
   return AudioMixerController.DoesTheTemporaryGraphHaveAnyCycles(allGroups, identifiedLoop, graph);
 }
		public static void InsertEffectPopupCallback(object obj)
		{
			AudioMixerChannelStripView.EffectContext effectContext = (AudioMixerChannelStripView.EffectContext)obj;
			Undo.RecordObject(effectContext.group, "Add effect");
			AudioMixerEffectController audioMixerEffectController = new AudioMixerEffectController(effectContext.name);
			effectContext.group.InsertEffect(audioMixerEffectController, effectContext.index);
			AssetDatabase.AddObjectToAsset(audioMixerEffectController, effectContext.controller);
			audioMixerEffectController.PreallocateGUIDs();
			AudioMixerUtility.RepaintAudioMixerAndInspectors();
		}
		private string GetEffectSlotTooltip(AudioMixerEffectController effect, Rect effectRect, AudioMixerChannelStripView.ChannelStripParams p)
		{
			if (!effectRect.Contains(Event.current.mousePosition))
			{
				return string.Empty;
			}
			if (effect.IsSend())
			{
				if (effect.sendTarget != null)
				{
					string sendTargetDisplayString = effect.GetSendTargetDisplayString(p.effectMap);
					return "Send to: " + sendTargetDisplayString;
				}
				return this.styles.emptySendSlotGUIContent.tooltip;
			}
			else
			{
				if (effect.IsReceive())
				{
					return this.styles.returnSlotGUIContent.tooltip;
				}
				if (effect.IsDuckVolume())
				{
					return this.styles.duckVolumeSlotGUIContent.tooltip;
				}
				if (effect.IsAttenuation())
				{
					return this.styles.attenuationSlotGUIContent.tooltip;
				}
				return this.styles.effectSlotGUIContent.tooltip;
			}
		}
		public static void AddMenuItemsForReturns(GenericMenu pm, string prefix, int effectIndex, AudioMixerGroupController group, List<AudioMixerGroupController> allGroups, Dictionary<AudioMixerEffectController, AudioMixerGroupController> effectMap, AudioMixerEffectController effect, bool showCurrent)
		{
			foreach (AudioMixerGroupController current in allGroups)
			{
				AudioMixerEffectController[] effects = current.effects;
				for (int i = 0; i < effects.Length; i++)
				{
					AudioMixerEffectController audioMixerEffectController = effects[i];
					if (MixerEffectDefinitions.EffectCanBeSidechainTarget(audioMixerEffectController))
					{
						List<AudioMixerController.ConnectionNode> list = new List<AudioMixerController.ConnectionNode>();
						if (!AudioMixerController.WillChangeOfEffectTargetCauseFeedback(allGroups, group, effectIndex, audioMixerEffectController, list))
						{
							if (showCurrent || effect.sendTarget != audioMixerEffectController)
							{
								pm.AddItem(new GUIContent(prefix + "'" + audioMixerEffectController.GetDisplayString(effectMap) + "'"), effect.sendTarget == audioMixerEffectController, new GenericMenu.MenuFunction2(AudioMixerChannelStripView.ConnectSendPopupCallback), new AudioMixerChannelStripView.ConnectSendContext(effect, audioMixerEffectController));
							}
						}
						else
						{
							string text = "A connection to '" + AudioMixerController.FixNameForPopupMenu(audioMixerEffectController.GetDisplayString(effectMap)) + "' would result in a feedback loop/";
							pm.AddDisabledItem(new GUIContent(text + "Loop: "));
							int num = 1;
							foreach (AudioMixerController.ConnectionNode current2 in list)
							{
								pm.AddDisabledItem(new GUIContent(string.Concat(new object[]
								{
									text,
									num,
									": ",
									current2.GetDisplayString(),
									"->"
								})));
								num++;
							}
							pm.AddDisabledItem(new GUIContent(text + num + ": ..."));
						}
					}
				}
			}
		}
		private string GetEffectSlotName(AudioMixerEffectController effect, bool showLevel, AudioMixerSnapshotController snapshot, AudioMixerChannelStripView.ChannelStripParams p)
		{
			if (this.m_ChangingWetMixIndex == this.m_IndexCounter && showLevel)
			{
				return string.Format("{0:F1} dB", effect.GetValueForMixLevel(this.m_Controller, snapshot));
			}
			if (effect.IsSend() && effect.sendTarget != null)
			{
				return effect.GetSendTargetDisplayString(p.effectMap);
			}
			return effect.effectName;
		}
		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);
		}
		private void EffectSlot(Rect effectRect, AudioMixerSnapshotController snapshot, AudioMixerEffectController effect, int effectIndex, ref int highlightEffectIndex, AudioMixerChannelStripView.ChannelStripParams p, ref Dictionary<AudioMixerEffectController, AudioMixerChannelStripView.PatchSlot> patchslots)
		{
			if (effect == null)
			{
				return;
			}
			Rect rect = effectRect;
			Event current = Event.current;
			if (current.type == EventType.Repaint && patchslots != null && (effect.IsSend() || MixerEffectDefinitions.EffectCanBeSidechainTarget(effect)))
			{
				AudioMixerChannelStripView.PatchSlot patchSlot = new AudioMixerChannelStripView.PatchSlot();
				patchSlot.group = p.group;
				patchSlot.x = rect.xMax - (rect.yMax - rect.yMin) * 0.5f;
				patchSlot.y = (rect.yMin + rect.yMax) * 0.5f;
				patchslots[effect] = patchSlot;
			}
			bool flag = !effect.DisallowsBypass();
			Rect position = rect;
			position.width = 10f;
			rect.xMin += 10f;
			if (flag && GUI.Button(position, this.bypassButtonContent, GUIStyle.none))
			{
				effect.bypass = !effect.bypass;
				this.m_Controller.UpdateBypass();
				InspectorWindow.RepaintAllInspectors();
			}
			this.m_IndexCounter++;
			float num = (!(effect != null)) ? AudioMixerController.kMinVolume : Mathf.Clamp(effect.GetValueForMixLevel(this.m_Controller, snapshot), AudioMixerController.kMinVolume, AudioMixerController.kMaxEffect);
			bool flag2 = effect != null && ((effect.IsSend() && effect.sendTarget != null) || effect.enableWetMix);
			if (current.type == EventType.Repaint)
			{
				GUIStyle effectBarStyle = this.GetEffectBarStyle(effect);
				float num2 = (!flag2) ? 1f : ((num - AudioMixerController.kMinVolume) / (AudioMixerController.kMaxEffect - AudioMixerController.kMinVolume));
				bool flag3 = (!p.group.bypassEffects && (effect == null || !effect.bypass)) || (effect != null && effect.DisallowsBypass());
				Color color = (!(effect != null)) ? new Color(0f, 0f, 0f, 0.5f) : AudioMixerDrawUtils.GetEffectColor(effect);
				if (!flag3)
				{
					color = new Color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f);
				}
				if (flag3)
				{
					if (num2 < 1f)
					{
						float num3 = rect.width * num2;
						if (num3 < 4f)
						{
							num3 = Mathf.Max(num3, 2f);
							float num4 = 1f - num3 / 4f;
							Color color2 = GUI.color;
							if (!GUI.enabled)
							{
								GUI.color = new Color(1f, 1f, 1f, 0.5f);
							}
							GUI.DrawTextureWithTexCoords(new Rect(rect.x, rect.y, num3, rect.height), effectBarStyle.focused.background, new Rect(num4, 0f, 1f - num4, 1f));
							GUI.color = color2;
						}
						else
						{
							effectBarStyle.Draw(new Rect(rect.x, rect.y, num3, rect.height), false, false, false, true);
						}
						GUI.DrawTexture(new Rect(rect.x + num3, rect.y, rect.width - num3, rect.height), effectBarStyle.onFocused.background, ScaleMode.StretchToFill);
					}
					else
					{
						effectBarStyle.Draw(rect, !flag2, false, false, flag2);
					}
				}
				else
				{
					effectBarStyle.Draw(rect, false, false, false, false);
				}
				if (flag)
				{
					this.styles.circularToggle.Draw(new Rect(position.x + 2f, position.y + 5f, position.width - 2f, position.width - 2f), false, false, !effect.bypass, false);
				}
				if (effect.IsSend() && effect.sendTarget != null)
				{
					position.y -= 1f;
					GUI.Label(position, this.styles.sendString, EditorStyles.miniLabel);
				}
				EditorGUI.BeginDisabledGroup(!flag3);
				string effectSlotName = this.GetEffectSlotName(effect, flag2, snapshot, p);
				string effectSlotTooltip = this.GetEffectSlotTooltip(effect, rect, p);
				GUI.Label(new Rect(rect.x, rect.y, rect.width - 10f, rect.height), GUIContent.Temp(effectSlotName, effectSlotTooltip), this.styles.effectName);
				EditorGUI.EndDisabledGroup();
			}
			else
			{
				this.EffectSlotDragging(effectRect, snapshot, effect, flag2, num, effectIndex, ref highlightEffectIndex, p);
			}
		}
		public AudioEffectParameterPath(AudioMixerGroupController group, AudioMixerEffectController effect, GUID parameter) : base(group, parameter)
		{
			this.effect = effect;
		}
 public AudioMixerEffectController CopyEffect(AudioMixerEffectController sourceEffect)
 {
   AudioMixerEffectController effectController = new AudioMixerEffectController(sourceEffect.effectName);
   effectController.name = sourceEffect.name;
   effectController.PreallocateGUIDs();
   MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(sourceEffect.effectName);
   foreach (AudioMixerSnapshotController snapshot in this.snapshots)
   {
     float num;
     if (snapshot.GetValue(sourceEffect.GetGUIDForMixLevel(), out num))
       snapshot.SetValue(effectController.GetGUIDForMixLevel(), num);
     foreach (MixerParameterDefinition parameterDefinition in effectParameters)
     {
       if (snapshot.GetValue(sourceEffect.GetGUIDForParameter(parameterDefinition.name), out num))
         snapshot.SetValue(effectController.GetGUIDForParameter(parameterDefinition.name), num);
     }
   }
   AssetDatabase.AddObjectToAsset((UnityEngine.Object) effectController, (UnityEngine.Object) this);
   return effectController;
 }