Inheritance: UnityEngine.Audio.AudioMixerSnapshot
 private int GetSnapshotIndex(AudioMixerSnapshotController snapshot)
 {
   for (int index = 0; index < this.m_Snapshots.Count; ++index)
   {
     if ((UnityEngine.Object) this.m_Snapshots[index] == (UnityEngine.Object) snapshot)
       return index;
   }
   return 0;
 }
		private int GetSnapshotIndex(AudioMixerSnapshotController snapshot)
		{
			for (int i = 0; i < this.m_Snapshots.Count; i++)
			{
				if (this.m_Snapshots[i] == snapshot)
				{
					return i;
				}
			}
			return 0;
		}
示例#3
0
 public void CopyAttenuationToAllSnapshots(AudioMixerGroupController group, AudioMixerSnapshotController snapshot)
 {
     AudioMixerSnapshotController[] snaps = snapshots;
     for (int n = 0; n < snaps.Length; n++)
     {
         if (snaps[n] == snapshot)
         {
             continue;
         }
         var dst = snaps[n];
         group.SetValueForVolume(this, dst, group.GetValueForVolume(this, snapshot));
     }
 }
 private void DeleteSnapshot(AudioMixerSnapshotController snapshot)
 {
     if (this.m_Controller.snapshots.Length <= 1)
     {
         Debug.Log("You must have at least 1 snapshot in an AudioMixer.");
     }
     else
     {
         this.m_Controller.RemoveSnapshot(snapshot);
         this.LoadFromBackend();
         this.m_ReorderableListWithRenameAndScrollView.list.index = this.GetSnapshotIndex(this.m_Controller.TargetSnapshot);
         this.UpdateViews();
     }
 }
			public static void Show(Rect buttonRect, AudioMixerSnapshotController snapshot, AudioMixerSnapshotListView list)
			{
				GenericMenu genericMenu = new GenericMenu();
				AudioMixerSnapshotListView.SnapshotMenu.data userData = new AudioMixerSnapshotListView.SnapshotMenu.data
				{
					snapshot = snapshot,
					list = list
				};
				genericMenu.AddItem(new GUIContent("Set as start Snapshot"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.SetAsStartupSnapshot), userData);
				genericMenu.AddSeparator(string.Empty);
				genericMenu.AddItem(new GUIContent("Rename"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.Rename), userData);
				genericMenu.AddItem(new GUIContent("Duplicate"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.Duplicate), userData);
				genericMenu.AddItem(new GUIContent("Delete"), false, new GenericMenu.MenuFunction2(AudioMixerSnapshotListView.SnapshotMenu.Delete), userData);
				genericMenu.DropDown(buttonRect);
			}
示例#6
0
        public void CopyAllSettingsToAllSnapshots(AudioMixerGroupController group, AudioMixerSnapshotController snapshot)
        {
            for (int n = 0; n < group.effects.Length; n++)
            {
                CopyEffectSettingsToAllSnapshots(group, n, snapshot, true);
            }

            AudioMixerSnapshotController[] snaps = snapshots;
            for (int n = 0; n < snaps.Length; n++)
            {
                if (snaps[n] == snapshot)
                {
                    continue;
                }
                var dst = snaps[n];
                group.SetValueForVolume(this, dst, group.GetValueForVolume(this, snapshot));
                group.SetValueForPitch(this, dst, group.GetValueForPitch(this, snapshot));
            }
        }
示例#7
0
        public void RemoveSnapshot(AudioMixerSnapshotController snapshot)
        {
            if (snapshots.Length < 2)
            {
                return;
            }

            var deletedSnapshot = snapshot;

            Undo.RecordObject(this, "Remove Snapshot");

            var snapshotList = new List <AudioMixerSnapshotController>(snapshots);

            snapshotList.Remove(deletedSnapshot);
            snapshots = snapshotList.ToArray();

            Undo.DestroyObjectImmediate(deletedSnapshot);

            OnSubAssetChanged();
        }
示例#8
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 extern void SetValueForParameter(AudioMixerController controller, AudioMixerSnapshotController snapshot, string parameterName, float value);
示例#10
0
 public extern void SetValueForSend(AudioMixerController controller, AudioMixerSnapshotController snapshot, float value);
示例#11
0
 public bool GetValue(GUID guid, out float value)
 {
     return(AudioMixerSnapshotController.INTERNAL_CALL_GetValue(this, guid, out value));
 }
示例#12
0
 public bool GetTransitionTypeOverride(GUID guid, out ParameterTransitionType type)
 {
     return(AudioMixerSnapshotController.INTERNAL_CALL_GetTransitionTypeOverride(this, guid, out type));
 }
 public static void Show(Rect buttonRect, AudioMixerSnapshotController snapshot, AudioMixerSnapshotListView list)
 {
     GenericMenu menu = new GenericMenu();
     data userData = new data {
         snapshot = snapshot,
         list = list
     };
     if (<>f__mg$cache0 == null)
     {
		public void CopyAllSettingsToAllSnapshots(AudioMixerGroupController group, AudioMixerSnapshotController snapshot)
		{
			for (int i = 0; i < group.effects.Length; i++)
			{
				this.CopyEffectSettingsToAllSnapshots(group, i, snapshot, true);
			}
			AudioMixerSnapshotController[] snapshots = this.snapshots;
			for (int j = 0; j < snapshots.Length; j++)
			{
				if (!(snapshots[j] == snapshot))
				{
					AudioMixerSnapshotController snapshot2 = snapshots[j];
					group.SetValueForVolume(this, snapshot2, group.GetValueForVolume(this, snapshot));
					group.SetValueForPitch(this, snapshot2, group.GetValueForPitch(this, snapshot));
				}
			}
		}
 public float GetValueForParameter(AudioMixerController controller, AudioMixerSnapshotController snapshot, string parameterName);
示例#16
0
 private extern static void INTERNAL_CALL_SetValue(AudioMixerSnapshotController self, GUID guid, float value);
 public void CopyAttenuationToAllSnapshots(AudioMixerGroupController group, AudioMixerSnapshotController snapshot)
 {
   AudioMixerSnapshotController[] snapshots = this.snapshots;
   for (int index = 0; index < snapshots.Length; ++index)
   {
     if (!((UnityEngine.Object) snapshots[index] == (UnityEngine.Object) snapshot))
     {
       AudioMixerSnapshotController snapshot1 = snapshots[index];
       group.SetValueForVolume(this, snapshot1, group.GetValueForVolume(this, snapshot));
     }
   }
 }
 public float GetValueForMixLevel(AudioMixerController controller, AudioMixerSnapshotController snapshot);
 public void CopyAllSettingsToAllSnapshots(AudioMixerGroupController group, AudioMixerSnapshotController snapshot)
 {
   for (int effectIndex = 0; effectIndex < group.effects.Length; ++effectIndex)
     this.CopyEffectSettingsToAllSnapshots(group, effectIndex, snapshot, true);
   AudioMixerSnapshotController[] snapshots = this.snapshots;
   for (int index = 0; index < snapshots.Length; ++index)
   {
     if (!((UnityEngine.Object) snapshots[index] == (UnityEngine.Object) snapshot))
     {
       AudioMixerSnapshotController snapshot1 = snapshots[index];
       group.SetValueForVolume(this, snapshot1, group.GetValueForVolume(this, snapshot));
       group.SetValueForPitch(this, snapshot1, group.GetValueForPitch(this, snapshot));
     }
   }
 }
 public void CopyEffectSettingsToAllSnapshots(AudioMixerGroupController group, int effectIndex, AudioMixerSnapshotController snapshot, bool includeWetParam)
 {
   AudioMixerSnapshotController[] snapshots = this.snapshots;
   for (int index = 0; index < snapshots.Length; ++index)
   {
     if (!((UnityEngine.Object) snapshots[index] == (UnityEngine.Object) snapshot))
     {
       AudioMixerEffectController effect = group.effects[effectIndex];
       MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(effect.effectName);
       float num;
       if (includeWetParam)
       {
         GUID guidForMixLevel = effect.GetGUIDForMixLevel();
         if (snapshot.GetValue(guidForMixLevel, out num))
           snapshots[index].SetValue(guidForMixLevel, num);
       }
       foreach (MixerParameterDefinition parameterDefinition in effectParameters)
       {
         GUID guidForParameter = effect.GetGUIDForParameter(parameterDefinition.name);
         if (snapshot.GetValue(guidForParameter, out num))
           snapshots[index].SetValue(guidForParameter, num);
       }
     }
   }
 }
 public void RemoveSnapshot(AudioMixerSnapshotController snapshot)
 {
   if (this.snapshots.Length < 2)
     return;
   AudioMixerSnapshotController snapshotController = snapshot;
   Undo.RecordObject((UnityEngine.Object) this, "Remove Snapshot");
   List<AudioMixerSnapshotController> snapshotControllerList = new List<AudioMixerSnapshotController>((IEnumerable<AudioMixerSnapshotController>) this.snapshots);
   snapshotControllerList.Remove(snapshotController);
   this.snapshots = snapshotControllerList.ToArray();
   Undo.DestroyObjectImmediate((UnityEngine.Object) snapshotController);
   this.OnSubAssetChanged();
 }
		public extern void SetValueForMixLevel(AudioMixerController controller, AudioMixerSnapshotController snapshot, float value);
示例#23
0
 extern public float GetValueForVolume(AudioMixerController controller, AudioMixerSnapshotController snapshot);
示例#24
0
 private static extern void INTERNAL_CALL_SetTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid, ParameterTransitionType type);
示例#25
0
 extern public void SetValueForVolume(AudioMixerController controller, AudioMixerSnapshotController snapshot, float value);
示例#26
0
 private extern static bool INTERNAL_CALL_GetTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid, out ParameterTransitionType type);
 public float GetValueForPitch(AudioMixerController controller, AudioMixerSnapshotController snapshot);
 private void SetAsStartupSnapshot(AudioMixerSnapshotController snapshot)
 {
   this.m_Controller.startSnapshot = (AudioMixerSnapshot) snapshot;
 }
 public void SetValueForPitch(AudioMixerController controller, AudioMixerSnapshotController snapshot, float value);
 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);
 }
示例#31
0
 public float GetValueForPitch(AudioMixerController controller, AudioMixerSnapshotController snapshot);
示例#32
0
 public void SetTransitionTypeOverride(GUID guid, ParameterTransitionType type)
 {
     AudioMixerSnapshotController.INTERNAL_CALL_SetTransitionTypeOverride(this, guid, type);
 }
示例#33
0
 public void SetValueForPitch(AudioMixerController controller, AudioMixerSnapshotController snapshot, float value);
示例#34
0
 public void ClearTransitionTypeOverride(GUID guid)
 {
     AudioMixerSnapshotController.INTERNAL_CALL_ClearTransitionTypeOverride(this, guid);
 }
 public extern float GetValueForVolume(AudioMixerController controller, AudioMixerSnapshotController snapshot);
示例#36
0
 public extern float GetValueForSend(AudioMixerController controller, AudioMixerSnapshotController snapshot);
示例#37
0
 private static extern void Internal_CreateAudioMixerSnapshotController([Writable] AudioMixerSnapshotController mono, AudioMixer owner);
		public extern float GetValueForMixLevel(AudioMixerController controller, AudioMixerSnapshotController snapshot);
 private static extern void INTERNAL_CALL_ClearTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid);
		public extern void SetValueForParameter(AudioMixerController controller, AudioMixerSnapshotController snapshot, string parameterName, float value);
 private static extern bool INTERNAL_CALL_GetValue(AudioMixerSnapshotController self, GUID guid, out float value);
示例#42
0
 extern private static void Internal_CreateAudioMixerSnapshotController(AudioMixerSnapshotController mono, AudioMixer owner);
		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;
		}
示例#44
0
 private extern static bool INTERNAL_CALL_GetValue(AudioMixerSnapshotController self, GUID guid, out float value);
		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);
			}
		}
示例#46
0
 private extern static void INTERNAL_CALL_ClearTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid);
		public void CopyEffectSettingsToAllSnapshots(AudioMixerGroupController group, int effectIndex, AudioMixerSnapshotController snapshot, bool includeWetParam)
		{
			AudioMixerSnapshotController[] snapshots = this.snapshots;
			for (int i = 0; i < snapshots.Length; i++)
			{
				if (!(snapshots[i] == snapshot))
				{
					AudioMixerEffectController audioMixerEffectController = group.effects[effectIndex];
					MixerParameterDefinition[] effectParameters = MixerEffectDefinitions.GetEffectParameters(audioMixerEffectController.effectName);
					if (includeWetParam)
					{
						GUID gUIDForMixLevel = audioMixerEffectController.GetGUIDForMixLevel();
						float value;
						if (snapshot.GetValue(gUIDForMixLevel, out value))
						{
							snapshots[i].SetValue(gUIDForMixLevel, value);
						}
					}
					MixerParameterDefinition[] array = effectParameters;
					for (int j = 0; j < array.Length; j++)
					{
						MixerParameterDefinition mixerParameterDefinition = array[j];
						GUID gUIDForParameter = audioMixerEffectController.GetGUIDForParameter(mixerParameterDefinition.name);
						float value;
						if (snapshot.GetValue(gUIDForParameter, out value))
						{
							snapshots[i].SetValue(gUIDForParameter, value);
						}
					}
				}
			}
		}
		public void CopyAttenuationToAllSnapshots(AudioMixerGroupController group, AudioMixerSnapshotController snapshot)
		{
			AudioMixerSnapshotController[] snapshots = this.snapshots;
			for (int i = 0; i < snapshots.Length; i++)
			{
				if (!(snapshots[i] == snapshot))
				{
					AudioMixerSnapshotController snapshot2 = snapshots[i];
					group.SetValueForVolume(this, snapshot2, group.GetValueForVolume(this, snapshot));
				}
			}
		}
示例#49
0
 public AudioMixerSnapshotController(AudioMixer owner)
 {
     AudioMixerSnapshotController.Internal_CreateAudioMixerSnapshotController(this, owner);
 }
 private void Rename(AudioMixerSnapshotController snapshot)
 {
   this.m_ReorderableListWithRenameAndScrollView.BeginRename(this.GetSnapshotIndex(snapshot), 0.0f);
 }
示例#51
0
 public void SetValue(GUID guid, float value)
 {
     AudioMixerSnapshotController.INTERNAL_CALL_SetValue(this, guid, value);
 }
 private static extern void INTERNAL_CALL_SetTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid, ParameterTransitionType type);
		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;
			}
		}
示例#54
0
 public void CopyEffectSettingsToAllSnapshots(AudioMixerGroupController group, int effectIndex, AudioMixerSnapshotController snapshot, bool includeWetParam)
 {
     AudioMixerSnapshotController[] snaps = snapshots;
     for (int n = 0; n < snaps.Length; n++)
     {
         if (snaps[n] == snapshot)
         {
             continue;
         }
         var effect = group.effects[effectIndex];
         MixerParameterDefinition[] paramDefs = MixerEffectDefinitions.GetEffectParameters(effect.effectName);
         float value;
         if (includeWetParam)
         {
             var guid = effect.GetGUIDForMixLevel();
             if (snapshot.GetValue(guid, out value))
             {
                 snaps[n].SetValue(guid, value);
             }
         }
         foreach (var p in paramDefs)
         {
             var guid = effect.GetGUIDForParameter(p.name);
             if (snapshot.GetValue(guid, out value))
             {
                 snaps[n].SetValue(guid, value);
             }
         }
     }
 }
 private static extern void INTERNAL_CALL_SetValue(AudioMixerSnapshotController self, GUID guid, float value);
 private static extern void Internal_CreateAudioMixerSnapshotController(AudioMixerSnapshotController mono, AudioMixer owner);
		public void RemoveSnapshot(AudioMixerSnapshotController snapshot)
		{
			if (this.snapshots.Length < 2)
			{
				return;
			}
			Undo.RecordObject(this, "Remove Snapshot");
			List<AudioMixerSnapshotController> list = new List<AudioMixerSnapshotController>(this.snapshots);
			list.Remove(snapshot);
			this.snapshots = list.ToArray();
			Undo.DestroyObjectImmediate(snapshot);
			this.OnSubAssetChanged();
		}