diff --git a/Assets/Scripts/UmaViewerAudio.cs b/Assets/Scripts/UmaViewerAudio.cs index 38db9a3..91a70b9 100644 --- a/Assets/Scripts/UmaViewerAudio.cs +++ b/Assets/Scripts/UmaViewerAudio.cs @@ -1,9 +1,11 @@ using CriWare; +using CriWareFormats; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; +using UnityEngine.Networking.Types; using static CriWare.CriAtomExCategory.ReactDuckerParameter; public class UmaViewerAudio @@ -12,20 +14,21 @@ public class UmaViewerAudio static UmaViewerMain Main => UmaViewerMain.Instance; public struct UmaSoundInfo { - public string acbPath; - public string awbPath; + public UmaDatabaseEntry acb; + public UmaDatabaseEntry awb; } static public UmaSoundInfo getSoundPath(string name) { Debug.Log(name); UmaSoundInfo info; - info.acbPath = null; - info.awbPath = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")).FilePath; + info.acb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb")); + info.awb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")); return info; } - static public CriAtomSource ApplyCueSheet(string cueName) + /* + static public CriAtomSource Apply(string cueName) { UmaSoundInfo soundInfo = getSoundPath(cueName); CriAtom.AddCueSheet(cueName, soundInfo.acbPath, soundInfo.awbPath); @@ -39,6 +42,37 @@ public class UmaViewerAudio return source; } + */ + + static public List ApplySound(string cueName) + { + UmaSoundInfo soundInfo = getSoundPath(cueName); + + GameObject sourceRoot = new GameObject("CuteAudioSource"); + sourceRoot.transform.SetParent(GameObject.Find("AudioManager/AudioControllerBgm").transform); + + List sourceList = new List(); + + List sounds = UmaViewerBuilder.LoadAudio(soundInfo.awb); + foreach(var clip in sounds) + { + AudioSource source = sourceRoot.AddComponent(); + source.clip = clip; + sourceList.Add(source); + } + + Debug.Log(sourceList); + + return sourceList; + } + + public static void Play(List sourceList) + { + foreach(var source in sourceList) + { + source.Play(); + } + } public enum PartForm { diff --git a/Assets/Scripts/UmaViewerBuilder.cs b/Assets/Scripts/UmaViewerBuilder.cs index 4c97d9f..40e769c 100644 --- a/Assets/Scripts/UmaViewerBuilder.cs +++ b/Assets/Scripts/UmaViewerBuilder.cs @@ -850,7 +850,7 @@ public class UmaViewerBuilder : MonoBehaviour source.Play(); } - public List LoadAudio(UmaDatabaseEntry awb) + public static List LoadAudio(UmaDatabaseEntry awb) { List clips = new List(); string awbPath = awb.FilePath; diff --git a/Assets/Scripts/UmaViewerUI.cs b/Assets/Scripts/UmaViewerUI.cs index 5fdfa9e..793c122 100644 --- a/Assets/Scripts/UmaViewerUI.cs +++ b/Assets/Scripts/UmaViewerUI.cs @@ -862,7 +862,7 @@ public class UmaViewerUI : MonoBehaviour Destroy(NormalSubSoundList.content.GetChild(i).gameObject); } - var subSounds = Builder.LoadAudio(awb); + var subSounds = UmaViewerBuilder.LoadAudio(awb); foreach (var sound in subSounds) { diff --git a/Assets/Scripts/umamusume/Gallop/Live/Director.cs b/Assets/Scripts/umamusume/Gallop/Live/Director.cs index 0e3e96c..b0d3736 100644 --- a/Assets/Scripts/umamusume/Gallop/Live/Director.cs +++ b/Assets/Scripts/umamusume/Gallop/Live/Director.cs @@ -326,8 +326,8 @@ namespace Gallop.Live public AudioSource[] liveSong; - public List liveVocal; - public CriAtomSource liveMusic; + public List> liveVocal = new List>(); + public List liveMusic = new List(); public PartEntry partInfo; @@ -465,19 +465,19 @@ namespace Gallop.Live if (entry != null) { Debug.Log(entry.Name); - liveVocal.Add(UmaViewerAudio.ApplyCueSheet(entry.Name.Split('.')[0])); + liveVocal.Add(UmaViewerAudio.ApplySound(entry.Name.Split('.')[0])); } } } - liveMusic = UmaViewerAudio.ApplyCueSheet(string.Format(SONG_PATH, songid)); + liveMusic = UmaViewerAudio.ApplySound(string.Format(SONG_PATH, songid)); foreach (var vocal in liveVocal) { - vocal.Play(0); + UmaViewerAudio.Play(vocal); } - liveMusic.Play(0); + UmaViewerAudio.Play(liveMusic); } else { @@ -512,7 +512,7 @@ namespace Gallop.Live _liveTimelineControl.AlterUpdate(_liveCurrentTime); if (!_soloMode) { - UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal); + //UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal); } } @@ -543,9 +543,9 @@ namespace Gallop.Live { if (!_soloMode) { - if(liveMusic.time > 0.1) + if (liveMusic[0].time > 0.1) { - _liveCurrentTime = (float)liveMusic.time / 1000; + _liveCurrentTime = (float)liveMusic[0].time / 1000; _syncTime = true; } } @@ -562,9 +562,10 @@ namespace Gallop.Live { if (sliderControl.is_Outed) { + /* _liveCurrentTime = UI.ProgressBar.value * totalTime; - if (liveMusic) + if (liveMusic.Count > 0) { int CriTime = Convert.ToInt32(_liveCurrentTime * 1000); @@ -590,6 +591,7 @@ namespace Gallop.Live song.Play(); } } + */ OnTimelineUpdate(_liveCurrentTime); @@ -600,7 +602,7 @@ namespace Gallop.Live else if (sliderControl.is_Touched) { _liveCurrentTime = UI.ProgressBar.value * totalTime; - + /* if (liveMusic) { liveMusic.Stop(); @@ -616,7 +618,7 @@ namespace Gallop.Live song.Stop(); } } - + */ OnTimelineUpdate(_liveCurrentTime); } else