public static InMusicGroup CreateMusicGroup(InMusicNode parent, string name) { var newNode = CreateMusicGroup(parent); newNode._name = name; return(newNode); }
private static void DrawMuteSolo(Rect fullArea, InMusicNode node) { Rect butArea = fullArea; butArea.width = 16; butArea.height = 12; butArea.y += 3; butArea.x += EditorGUI.indentLevel * 5 + 5; Texture mute = MusicUpdater.IsMute(node) ? EditorResources.Instance.Muted : EditorResources.Instance.NotMute; if (GUI.Button(butArea, mute, GUIStyle.none)) { InUndoHelper.RegisterUndo(node, "Mute"); MusicUpdater.FlipMute(node); } butArea.y += 14; Texture solo = MusicUpdater.IsSolo(node) ? EditorResources.Instance.Soloed : EditorResources.Instance.NotSolo; if (GUI.Button(butArea, solo, GUIStyle.none)) { InUndoHelper.RegisterUndo(node, "Solo"); MusicUpdater.FlipSolo(node); } }
public static void SetInitialSettings(InMusicNode node, float parentVolume, float parentPitch) { float volume = node._minVolume * parentVolume; float pitch = node._minPitch * parentPitch; if (Application.isPlaying) { node.runtimeMute = node._mute; node.runtimeSolo = node._solo; node.runtimeVolume = node._minVolume; node.runtimePitch = node._minPitch; var playingInfo = node.PlayingInfo; var sources = playingInfo.Players; int sourceCount = sources.Count; for (int i = 0; i < sourceCount; i++) { sources[i].pitch = pitch; sources[i].SetLoudness(volume); } } var children = node._children; int childCount = children.Count; for (int i = 0; i < childCount; i++) { SetInitialSettings(children[i], volume, pitch); } }
public static void SetInitialSettings(InMusicNode node, float parentVolume, float parentPitch) { float volume = node._minVolume * parentVolume; float pitch = node._minPitch * parentPitch; if (Application.isPlaying) { node.runtimeMute = node._mute; node.runtimeSolo = node._solo; node.runtimeVolume = node._minVolume; node.runtimePitch = node._minPitch; var playingInfo = node.PlayingInfo; var sources = playingInfo.Players; int sourceCount = sources.Count; for (int i = 0; i < sourceCount; i++) { sources[i].pitch = pitch; sources[i].SetLoudness(volume); } } var children = node._children; int childCount = children.Count; for (int i = 0; i < childCount; i++) { SetInitialSettings(children[i], volume, pitch); } }
public static Texture LookUpIcon(InMusicNode node) { var group = node as InMusicGroup; if (!Application.isPlaying || group == null) { if (node._type == MusicNodeType.Music) { return(EditorResources.Instance.Audio); } if (node.IsRootOrFolder) { return(EditorResources.Instance.Folder); } return(null); } else { if (group.PlayingInfo.State == MusicState.Playing) { return(EditorResources.Instance.Play); } else if (group.PlayingInfo.State == MusicState.Paused) { return(EditorResources.Instance.Pause); } else //if (group.PlayingInfo.State == MusicState.Stopped) { return(EditorResources.Instance.Stop); } } }
public static InMusicGroup CreateMusicGroup(InMusicNode parent) { var newNode = CreateNode <InMusicGroup>(parent.gameObject, parent, GUIDCreator.Create()); newNode._type = MusicNodeType.Music; return(newNode); }
public void SetVolumeOfAllChildren(InMusicNode musicNode, float targetVolume, float duration, LeanTweenType twenType = LeanTweenType.easeInOutQuad) { for (int i = 0; i < musicNode._children.Count; i++) { FadeVolume(musicNode._children[i], targetVolume, duration); } }
//TODO MUSICUPDATE public static void RebuildBanks() { InAudioBankLink rootBank = InAudioInstanceFinder.DataManager.BankLinkTree; InAudioNode audioRoot = InAudioInstanceFinder.DataManager.AudioTree; InMusicNode musicRoot = InAudioInstanceFinder.DataManager.MusicTree; TreeWalker.ForEach(rootBank, DeleteAllNodesFromBanks); TreeWalker.ForEach(audioRoot, node => { var folderData = node._nodeData as InFolderData; SetBankIfNotNull(folderData, rootBank); }); TreeWalker.ForEach(musicRoot, node => { var folderData = node as InMusicFolder; SetBankIfNotNull(folderData, rootBank); }); TreeWalker.ForEach(audioRoot, AddNodesToBank); TreeWalker.ForEach(musicRoot, AddNodesToBank); //Set the bank of the root node if it is missing InFolderData inFolderData = audioRoot._nodeData as InFolderData; if (inFolderData != null && inFolderData.BankLink == null) { inFolderData.BankLink = TreeWalker.FindFirst(rootBank, link => link._type == AudioBankTypes.Bank); } if (inFolderData.BankLink != null) { TreeWalker.ForEach(audioRoot, SetBanks); } }
public static InMusicFolder CreateFolder(GameObject go, InMusicNode parent) { var newNode = CreateNode <InMusicFolder>(go, parent, GUIDCreator.Create()); newNode._type = MusicNodeType.Folder; return(newNode); }
private static void UpdateSolo(InMusicNode node, bool soloedParent, ref bool anySoloed, out bool hasSoloedChild) { var children = node._children; int childCount = children.Count; bool solo = soloedParent; var playingInfo = node.PlayingInfo; solo = soloedParent | IsSolo(node); playingInfo.IsSoloed = solo; anySoloed |= solo; bool solodChild = false; for (int i = 0; i < childCount; i++) { bool solod; UpdateSolo(children[i], solo, ref anySoloed, out solod); solodChild |= solod; } hasSoloedChild = solo | solodChild; if (solodChild) { node.PlayingInfo.HasSoloedChild = true; } }
public static bool Draw(InMusicNode node, bool isSelected, out bool clicked) { var group = node as InMusicGroup; clicked = false; Rect fullArea = EditorGUILayout.BeginHorizontal(); Rect area = EditorGUILayout.BeginHorizontal(); if (isSelected) GUI.DrawTexture(area, EditorResources.Instance.GetBackground()); GUILayout.Space(EditorGUI.indentLevel * 16); DrawVolume(fullArea, node); bool folded = node.IsFoldedOut; Texture picture; if (folded || node._getChildren.Count == 0) picture = EditorResources.Instance.Minus; else picture = EditorResources.Instance.Plus; if (GUILayout.Button(picture, GUIStyle.none, GUILayout.Height(EditorResources.Instance.Minus.height), GUILayout.Width(EditorResources.Instance.Minus.width))) { node.IsFoldedOut = !node.IsFoldedOut; Event.current.UseEvent(); } Texture icon = LookUpIcon(node); TreeNodeDrawerHelper.DrawIcon(GUILayoutUtility.GetLastRect(), icon, GUIStyle.none); EditorGUILayout.LabelField(""); EditorGUILayout.EndHorizontal(); Rect labelArea = GUILayoutUtility.GetLastRect(); labelArea.y += 8; labelArea.x += 60; EditorGUI.LabelField(labelArea, node.GetName); if (group != null) { if (!Application.isPlaying) GUI.enabled = false; DrawPlayStop(fullArea, group); GUI.enabled = true; } DrawMuteSolo(fullArea, node); EditorGUILayout.EndHorizontal(); if (Event.current.ClickedWithin(fullArea)) { clicked = true; } return node.IsFoldedOut; }
public static InMusicFolder CreateFolder(GameObject go, InMusicNode parent) { var newNode = CreateNode <InMusicFolder>(go, parent, GUIDCreator.Create()); newNode._type = MusicNodeType.Folder; newNode._bankLink = TreeWalker.FindFirst(InAudioInstanceFinder.DataManager.BankLinkTree, link => link._type == AudioBankTypes.Bank); return(newNode); }
public void Find(InMusicNode toFind) { if (InAudioInstanceFinder.Instance != null) musicCreatorGUI.Find(toFind); else { Debug.LogError("InAudio: Cannot open window without having the manager in the scene"); } }
public static bool UpdateSoloMute(InMusicNode root) { bool anySolo = false; bool hasSolodChild; UpdateSolo(root, false, ref anySolo, out hasSolodChild); UpdateMute(root, false); return(anySolo); }
public static void ChangeMusicNodeBank(InMusicNode node, InAudioBankLink newBank) { var all = GetAllBanks(); InUndoHelper.RecordObject(all.ToArray().AddObj(node), "Changed Bank"); InMusicFolder data = (node as InMusicFolder); data._bankLink = newBank; RebuildBanks(); }
private void Load(bool forceReload) { if (!Loaded || forceReload) { AudioRoot = LoadData <InAudioNode>(FolderSettings.AudioLoadData); EventRoot = LoadData <InAudioEventNode>(FolderSettings.EventLoadData); MusicRoot = LoadData <InMusicNode>(FolderSettings.MusicLoadData); SettingsRoot = LoadData <InSettingsNode>(FolderSettings.SettingsLoadData); roots = new Component[] { AudioRoot, EventTree, MusicRoot, SettingsRoot }; } }
private static void AddNodesToBank(InMusicNode musicNode) { if (musicNode._type == MusicNodeType.Music) { var musicGroup = musicNode as InMusicGroup; if (musicGroup != null) { AddNodeToBank(musicGroup); } } }
public float GetHiearchyPitch(InMusicNode musicNode) { if (musicNode == null) { return(1); } float pitch = musicNode.Pitch * GetHiearchyPitch(musicNode._getParent); return(pitch); }
public void Find(InMusicNode toFind) { if (InAudioInstanceFinder.Instance != null) { musicCreatorGUI.Find(toFind); } else { Debug.LogError("InAudio: Cannot open window without having the manager in the scene"); } }
private static T CreateNode <T>(GameObject go, InMusicNode parent, int guid) where T : InMusicNode { var node = go.AddComponentUndo <T>(); node._guid = guid; node._name = parent._name + " Child"; node._mixerGroup = parent._mixerGroup; node.AssignParent(parent); return(node); }
private static void DrawVolume(Rect fullArea, InMusicNode @group) { GUI.enabled = false; Rect sliderRect = fullArea; sliderRect.x = sliderRect.width - 30; sliderRect.width = 20; sliderRect.height -= 5; GUI.VerticalSlider(sliderRect, @group.PlayingInfo.FinalVolume, 1f, 0f); GUI.enabled = true; }
public static AudioMixerGroup GetUsedMixerGroup(this InMusicNode node) { if (node == null) { return(null); } if (node._overrideParentMixerGroup || node.IsRoot) { return(node._mixerGroup); } else { return(GetUsedMixerGroup(node._parent)); } }
public static InMusicNode GetParentMixing(this InMusicNode node) { if (node == null) { return(null); } if (node._overrideParentMixerGroup || node.IsRoot) { return(node); } else { return(GetParentMixing(node._parent)); } }
private static void UpdateMute(InMusicNode node, bool mutedParent) { var children = node._children; int childCount = children.Count; bool muted = false; muted = IsMute(node) | mutedParent; node.PlayingInfo.AffectedByMute = muted; for (int i = 0; i < childCount; i++) { UpdateMute(children[i], muted); } }
public static float GetPitch(InMusicNode node) { #if UNITY_EDITOR if (Application.isPlaying) { return(node.runtimePitch); } else { return(node._minPitch); } #else return(node.runtimePitch); #endif }
public static bool IsMute(InMusicNode node) { #if UNITY_EDITOR if (Application.isPlaying) { return(node.runtimeMute); } else { return(node._mute); } #else return(node.runtimeMute); #endif }
public static void FlipMute(InMusicNode group) { #if UNITY_EDITOR if (Application.isPlaying) { group.runtimeMute = !group.runtimeMute; } else { group._mute = !group._mute; } #else group.runtimeMute = !group.runtimeMute; #endif }
public static bool IsSolo(InMusicNode group) { #if UNITY_EDITOR if (Application.isPlaying) { return(group.runtimeSolo); } else { return(group._solo); } #else return(group.runtimeSolo); #endif }
public static void SetSolo(InMusicNode group, bool value) { #if UNITY_EDITOR if (Application.isPlaying) { group.runtimeSolo = value; } else { group._solo = value; } #else group.runtimeSolo = value; #endif }
public static void FlipSolo(InMusicNode group) { #if UNITY_EDITOR if (Application.isPlaying) { group.runtimeSolo = !group.runtimeSolo; } else { group._solo = !group._solo; } #else group.runtimeSolo = !group.runtimeSolo; #endif }
public static void DrawMixer(InMusicNode node, SerializedProperty prop) { if (!node.IsRoot) { bool overrideParent = EditorGUILayout.Toggle("Override Parent Mixer", node._overrideParentMixerGroup); if (overrideParent != node._overrideParentMixerGroup) { InUndoHelper.RecordObjectFull(node, "Override parent mixer group"); node._overrideParentMixerGroup = overrideParent; } if (!node._overrideParentMixerGroup) { GUI.enabled = false; } } EditorGUILayout.BeginHorizontal(); if (node._overrideParentMixerGroup) { EditorGUILayout.PropertyField(prop, new GUIContent("Mixer Group")); } else { if (node._parent != null) { var parentProp = new SerializedObject(node.GetParentMixing()); parentProp.Update(); EditorGUILayout.PropertyField(parentProp.FindProperty("_mixerGroup"), new GUIContent("Parent Mixer Group")); parentProp.ApplyModifiedProperties(); } else { var parentProp = new SerializedObject(node); parentProp.Update(); EditorGUILayout.PropertyField(parentProp.FindProperty("_mixerGroup"), new GUIContent("Mixer Group")); parentProp.ApplyModifiedProperties(); } } GUI.enabled = node.GetParentMixing() != null; if (GUILayout.Button("Find", GUILayout.Width(40))) { SearchHelper.SearchFor(node._mixerGroup); } EditorGUILayout.EndHorizontal(); GUI.enabled = true; }
public void Load(bool forceReload = false) { if (AudioRoot == null || BankLinkRoot == null || EventRoot == null || MusicRoot == null || forceReload) { Component[] audioData; Component[] eventData; Component[] bankLinkData; Component[] musicData; SaveAndLoad.LoadManagerData(out audioData, out eventData, out musicData, out bankLinkData); AudioRoot = CheckData <InAudioNode>(audioData); EventRoot = CheckData <InAudioEventNode>(eventData); BankLinkTree = CheckData <InAudioBankLink>(bankLinkData); MusicTree = CheckData <InMusicNode>(musicData); } }
public static InAudioBankLink GetBank(this InMusicNode node) { var data = node as InMusicFolder; if (node.IsRoot) { return(data._bankLink); } if (node.IsFolder && data._overrideParentBank && data._bankLink != null) { return(data._bankLink); } return(GetBank(node._parent)); }
public static void DrawMixer(InMusicNode node, SerializedProperty prop) { if (!node.IsRoot) { bool overrideParent = EditorGUILayout.Toggle("Override Parent Mixer", node._overrideParentMixerGroup); if (overrideParent != node._overrideParentMixerGroup) { InUndoHelper.RecordObjectFull(node, "Override parent mixer group"); node._overrideParentMixerGroup = overrideParent; } if (!node._overrideParentMixerGroup) GUI.enabled = false; } EditorGUILayout.BeginHorizontal(); if (node._overrideParentMixerGroup) EditorGUILayout.PropertyField(prop, new GUIContent("Mixer Group")); else { if (node._parent != null) { var parentProp = new SerializedObject(node.GetParentMixing()); parentProp.Update(); EditorGUILayout.PropertyField(parentProp.FindProperty("_mixerGroup"), new GUIContent("Parent Mixer Group")); parentProp.ApplyModifiedProperties(); } else { var parentProp = new SerializedObject(node); parentProp.Update(); EditorGUILayout.PropertyField(parentProp.FindProperty("_mixerGroup"), new GUIContent("Mixer Group")); parentProp.ApplyModifiedProperties(); } } GUI.enabled = node.GetParentMixing() != null; if (GUILayout.Button("Find", GUILayout.Width(40))) { SearchHelper.SearchFor(node._mixerGroup); } EditorGUILayout.EndHorizontal(); GUI.enabled = true; }
private static void DrawVolume(Rect fullArea, InMusicNode @group) { GUI.enabled = false; Rect sliderRect = fullArea; sliderRect.x = sliderRect.width - 30; sliderRect.width = 20; sliderRect.height -= 5; GUI.VerticalSlider(sliderRect, @group.PlayingInfo.FinalVolume, 1f, 0f); GUI.enabled = true; }
public float GetHiearchyPitch(InMusicNode musicNode) { if (musicNode == null) { return 1; } float pitch = musicNode.Pitch * GetHiearchyPitch(musicNode._getParent); return pitch; }
private static void DrawMuteSolo(Rect fullArea, InMusicNode node) { Rect butArea = fullArea; butArea.width = 16; butArea.height = 12; butArea.y += 3; butArea.x += EditorGUI.indentLevel*5 + 5; Texture mute = MusicUpdater.IsMute(node) ? EditorResources.Instance.Muted : EditorResources.Instance.NotMute; if (GUI.Button(butArea, mute, GUIStyle.none)) { InUndoHelper.RegisterUndo(node, "Mute"); MusicUpdater.FlipMute(node); } butArea.y += 14; Texture solo = MusicUpdater.IsSolo(node) ? EditorResources.Instance.Soloed : EditorResources.Instance.NotSolo; if (GUI.Button(butArea, solo, GUIStyle.none)) { InUndoHelper.RegisterUndo(node, "Solo"); MusicUpdater.FlipSolo(node); } }
public static float GetPitch(InMusicNode node) { #if UNITY_EDITOR if (Application.isPlaying) return node.runtimePitch; else return node._minPitch; #else return node.runtimePitch; #endif }
public static void SetSolo(InMusicNode group, bool value) { #if UNITY_EDITOR if (Application.isPlaying) group.runtimeSolo = value; else group._solo = value; #else group.runtimeSolo = value; #endif }
public static void UpdateVolumePitch(InMusicNode node, float parentVolume, float parentPitch, bool areAnySolo) { var group = node as InMusicGroup; var children = node._children; int childCount = children.Count; float volume; var playingInfo = node.PlayingInfo; if (group != null) { bool checkPlayer; #if UNITY_EDITOR checkPlayer = Application.isPlaying; #else checkPlayer = true; #endif if (group.Playing && checkPlayer) { var players = playingInfo.Players; if (players.Count > 0) { var player = players[0]; if (!player.isPlaying) { CleanupMusicNode(group); } } } } if (playingInfo.Fading && group != null) { float currentTime = Time.time; if (currentTime >= playingInfo.EndTime) { group.runtimeVolume = playingInfo.TargetVolume; playingInfo.Fading = false; if (playingInfo.DoAtEnd == MusicState.Stopped) { InAudio.Music.Stop(group); } else if (playingInfo.DoAtEnd == MusicState.Paused) { InAudio.Music.Pause(group); } } else if (currentTime < playingInfo.StartTime) { //Do nothing } else { var duration = playingInfo.EndTime - playingInfo.StartTime; var left = playingInfo.EndTime - currentTime; node.runtimeVolume = AudioTween.DirectTween(playingInfo.TweenType, playingInfo.StartVolume, playingInfo.TargetVolume, 1 - left / duration); } } if(!playingInfo.AffectedByMute) volume = GetVolume(node) * parentVolume; else volume = 0f; if (areAnySolo && !playingInfo.IsSoloed && !playingInfo.HasSoloedChild) { volume = 0; } var sources = playingInfo.Players; int sourceCount = sources.Count; var pitch = GetPitch(node) * parentPitch; if (Application.isPlaying) { for (int i = 0; i < sourceCount; i++) { sources[i].pitch = pitch; sources[i].SetLoudness(volume); } } playingInfo.FinalVolume = volume; for (int i = 0; i < childCount; i++) { UpdateVolumePitch(children[i], volume, pitch, areAnySolo); } }
private static void UpdateMute(InMusicNode node, bool mutedParent) { var children = node._children; int childCount = children.Count; bool muted = false; muted = IsMute(node) | mutedParent; node.PlayingInfo.AffectedByMute = muted; for (int i = 0; i < childCount; i++) { UpdateMute(children[i], muted); } }
public void FadeAndStop(InMusicNode toFade, float duration, LeanTweenType tweenType = LeanTweenType.easeInOutQuad) { Fade(toFade, 0f, duration, tweenType, Time.time); toFade.PlayingInfo.DoAtEnd = MusicState.Stopped; }
public static bool IsSolo(InMusicNode group) { #if UNITY_EDITOR if (Application.isPlaying) return group.runtimeSolo; else return group._solo; #else return group.runtimeSolo; #endif }
public void FadeToInitialVolume(InMusicNode toFade, float duration, LeanTweenType tweenType = LeanTweenType.easeInOutQuad) { Fade(toFade, toFade._minVolume, duration, tweenType, Time.time); }
public void FadeAndPause(InMusicNode toFade, float targetVolume, float duration, LeanTweenType tweenType = LeanTweenType.easeInOutQuad) { Fade(toFade, targetVolume, duration, tweenType, Time.time); toFade.PlayingInfo.DoAtEnd = MusicState.Paused; }
public void SetVolume(InMusicNode musicNode, float volume) { musicNode.Volume = volume; //Is updated in the beginning of the next frame in InAudio.Update via the MusicUpdater class }
private void CreateMusicLists(InMusicNode inMusicNode) { var group = inMusicNode as InMusicGroup; if (group != null) { var info = group.PlayingInfo; info.Music = group; if (info.Players != null) info.Players.Capacity = group._Clips.Count; } for (int i = 0; i < inMusicNode._children.Count; i++) { if (inMusicNode._children[i] != null) { CreateMusicLists(inMusicNode._children[i]); } } }
private static void Fade(InMusicNode toFade, float targetVolume, float duration, LeanTweenType tweenType, float startTime) { if (tweenType == LeanTweenType.animationCurve) { Debug.LogError("InAudio: AnimationCurve is not supported in fading. Used on Music Group \"" + toFade.GetName + "\""); return; } var runInfo = toFade.PlayingInfo; runInfo.Fading = true; runInfo.StartTime = startTime; runInfo.EndTime = startTime + duration; runInfo.TweenType = tweenType; runInfo.TargetVolume = targetVolume; runInfo.StartVolume = toFade.runtimeVolume; }
private static void AddNodesToBank(InMusicNode musicNode) { if (musicNode._type == MusicNodeType.Music) { var musicGroup = musicNode as InMusicGroup; if (musicGroup != null) { AddNodeToBank(musicGroup); } } }
public void SetVolumeOfAllChildren(InMusicNode musicNode, float targetVolume, float duration, LeanTweenType twenType = LeanTweenType.easeInOutQuad) { for (int i = 0; i < musicNode._children.Count; i++) { FadeVolume(musicNode._children[i], targetVolume, duration); } }
public static void ChangeMusicNodeBank(InMusicNode node, InAudioBankLink newBank) { var all = GetAllBanks(); InUndoHelper.RecordObject(all.ToArray().AddObj(node), "Changed Bank"); InMusicFolder data = (node as InMusicFolder); data._bankLink = newBank; RebuildBanks(); }
/// <summary> /// Gets the parent of the musicGroup, and fades all other nodes out than the parameter /// </summary> /// <param name="musicNode">The child to focus on</param> /// <param name="targetVolume">The new volume of it</param> /// <param name="otherTargetVolume">The volume of the other nodes than the musicGroup parameter</param> /// <param name="duration">How long it should take to fade to it</param> /// <param name="twenType">How to tween the values</param> public void FocusOn(InMusicNode musicNode, float targetVolume, float otherTargetVolume, float duration, LeanTweenType twenType = LeanTweenType.easeInOutQuad) { var parent = musicNode._parent; if (parent.IsRootOrFolder) { throw new ArgumentException("InAudio: Cannot pass MusicGroup which parent is not a Music Group"); } for (int i = 0; i < parent._children.Count; i++) { var child = parent._children[i]; if (child != musicNode) { FadeVolume(child as InMusicGroup, otherTargetVolume, duration); } else { FadeVolume(child as InMusicGroup, targetVolume, duration); } } }
private static void UpdateSolo(InMusicNode node, bool soloedParent, ref bool anySoloed, out bool hasSoloedChild) { var children = node._children; int childCount = children.Count; bool solo = soloedParent; var playingInfo = node.PlayingInfo; solo = soloedParent | IsSolo(node); playingInfo.IsSoloed = solo; anySoloed |= solo; bool solodChild = false; for (int i = 0; i < childCount; i++) { bool solod; UpdateSolo(children[i], solo, ref anySoloed, out solod); solodChild |= solod; } hasSoloedChild = solo | solodChild; if (solodChild) { node.PlayingInfo.HasSoloedChild = true; } }
/// <summary> /// Get the initial volume of this node, independent from the volume while playing and the hierarchy /// </summary> /// <param name="musicNode"></param> /// <returns></returns> public float GetInitialVolume(InMusicNode musicNode) { //Do not change this value, except from the GUI as it will change the prefab, even in Play mode. return musicNode._minVolume; }
public static bool UpdateSoloMute(InMusicNode root) { bool anySolo = false; bool hasSolodChild; UpdateSolo(root, false, ref anySolo, out hasSolodChild); UpdateMute(root, false); return anySolo; }
public float GetVolume(InMusicNode musicNode) { return musicNode.Volume; }
public static void FlipSolo(InMusicNode group) { #if UNITY_EDITOR if (Application.isPlaying) group.runtimeSolo = !group.runtimeSolo; else group._solo = !group._solo; #else group.runtimeSolo = !group.runtimeSolo; #endif }
public static Texture LookUpIcon(InMusicNode node) { var group = node as InMusicGroup; if (!Application.isPlaying || group == null) { if (node._type == MusicNodeType.Music) return EditorResources.Instance.Audio; if (node.IsRootOrFolder) return EditorResources.Instance.Folder; return null; } else { if (group.PlayingInfo.State == MusicState.Playing) return EditorResources.Instance.Play; else if (group.PlayingInfo.State == MusicState.Paused) return EditorResources.Instance.Pause; else //if (group.PlayingInfo.State == MusicState.Stopped) return EditorResources.Instance.Stop; } }
public void FadeVolumeAt(InMusicNode toFade, float targetVolume, float duration, float startTime, LeanTweenType tweenType = LeanTweenType.easeInOutQuad) { //There are no guarantees that the music is playing, Fade(toFade, targetVolume, duration, tweenType, startTime); }
public void CrossfadeVolume(InMusicNode from, InMusicGroup to, float duration, LeanTweenType tweenType = LeanTweenType.easeInOutQuad) { Fade(from, 0f, duration, tweenType, Time.time); Fade(to, 1f, duration, tweenType, Time.time); }