diff --git a/Assets/Scripts/Audio/CRIMW/CriWare/Editor/CriAtom/CriAtomWindowPrefs.asset b/Assets/Scripts/Audio/CRIMW/CriWare/Editor/CriAtom/CriAtomWindowPrefs.asset index 54672d8..e187af3 100644 --- a/Assets/Scripts/Audio/CRIMW/CriWare/Editor/CriAtom/CriAtomWindowPrefs.asset +++ b/Assets/Scripts/Audio/CRIMW/CriWare/Editor/CriAtom/CriAtomWindowPrefs.asset @@ -14,4 +14,6 @@ MonoBehaviour: m_EditorClassIdentifier: outputAssetsRoot: useCommonKey: 1 - cuesheetKeyList: [] + cuesheetKeyList: + - cuesheetGuid: 000000000 + key: 75923756697503 diff --git a/Assets/Scripts/UmaViewerAudio.cs b/Assets/Scripts/UmaViewerAudio.cs new file mode 100644 index 0000000..a4b10b8 --- /dev/null +++ b/Assets/Scripts/UmaViewerAudio.cs @@ -0,0 +1,85 @@ +using CriWare; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +public class UmaViewerAudio +{ + static public void LoadLiveSoundCri(int songid, UmaDatabaseEntry SongAwb) + { + Debug.Log(SongAwb.Name); + + //获取总线数 + Debug.Log(CriAtomExAcf.GetNumDspSettings()); + + string busName = CriAtomExAcf.GetDspSettingNameByIndex(0); + + var dspSetInfo = new CriAtomExAcf.AcfDspSettingInfo(); + + + + Debug.Log(CriAtomExAcf.GetDspSettingInformation(busName, out dspSetInfo)); + + Debug.Log(dspSetInfo.name); + Debug.Log(dspSetInfo.numExtendBuses); + Debug.Log(dspSetInfo.numBuses); + Debug.Log(dspSetInfo.numSnapshots); + Debug.Log(dspSetInfo.snapshotStartIndex); + + var busInfo = new CriAtomExAcf.AcfDspBusInfo(); + + for (ushort i = 0; i < dspSetInfo.numExtendBuses; i++) + { + Debug.Log(i); + Debug.Log(CriAtomExAcf.GetDspBusInformation(i, out busInfo)); + + Debug.Log(busInfo.name); + Debug.Log(busInfo.volume); + Debug.Log(busInfo.numFxes); + Debug.Log(busInfo.numBusLinks); + } + + //获取Acb文件和Awb文件的路径 + string nameVar = SongAwb.Name.Split('.')[0].Split('/').Last(); + + //使用Live的Bgm + //nameVar = $"snd_bgm_live_{songid}_oke"; + + LoadSound Loader = (LoadSound)ScriptableObject.CreateInstance("LoadSound"); + LoadSound.UmaSoundInfo soundInfo = Loader.getSoundPath(nameVar); + + //音频组件添加路径,载入音频 + CriAtom.AddCueSheet(nameVar, soundInfo.acbPath, soundInfo.awbPath); + + //获得当前音频信息 + CriAtomEx.CueInfo[] cueInfoList; + List cueNameList = new List(); + cueInfoList = CriAtom.GetAcb(nameVar).GetCueInfoList(); + foreach (CriAtomEx.CueInfo cueInfo in cueInfoList) + { + cueNameList.Add(cueInfo.name); + Debug.Log(cueInfo.type); + Debug.Log(cueInfo.userData); + } + + //创建播放器 + CriAtomSource source = new GameObject("CuteAudioSource").AddComponent(); + source.transform.SetParent(GameObject.Find("AudioManager/AudioControllerBgm").transform); + source.cueSheet = nameVar; + + //播放 + source.Play(cueNameList[0]); + + //source.SetBusSendLevelOffset(1, 1); + + + /* + for (int i = 0; i < 17; i++) + { + Debug.Log(source.player.GetParameterFloat32((CriAtomEx.Parameter)i)); + } + */ + + } +} diff --git a/Assets/Scripts/UmaViewerAudio.cs.meta b/Assets/Scripts/UmaViewerAudio.cs.meta new file mode 100644 index 0000000..9ca6aa2 --- /dev/null +++ b/Assets/Scripts/UmaViewerAudio.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c38f800f346211947a7d89fe087e4d42 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UmaViewerBuilder.cs b/Assets/Scripts/UmaViewerBuilder.cs index e21be25..d339c52 100644 --- a/Assets/Scripts/UmaViewerBuilder.cs +++ b/Assets/Scripts/UmaViewerBuilder.cs @@ -740,11 +740,43 @@ public class UmaViewerBuilder : MonoBehaviour UI.ResetAudioPlayer(); } + Debug.Log(SongAwb.Name); + + //鑾峰彇鎬荤嚎鏁� + Debug.Log(CriAtomExAcf.GetNumDspSettings()); + + string busName = CriAtomExAcf.GetDspSettingNameByIndex(0); + + var dspSetInfo = new CriAtomExAcf.AcfDspSettingInfo(); + + + + Debug.Log(CriAtomExAcf.GetDspSettingInformation(busName, out dspSetInfo)); + + Debug.Log(dspSetInfo.name); + Debug.Log(dspSetInfo.numExtendBuses); + Debug.Log(dspSetInfo.numBuses); + Debug.Log(dspSetInfo.numSnapshots); + Debug.Log(dspSetInfo.snapshotStartIndex); + + var busInfo = new CriAtomExAcf.AcfDspBusInfo(); + + for(ushort i = 0; i < dspSetInfo.numExtendBuses; i++) + { + Debug.Log(i); + Debug.Log(CriAtomExAcf.GetDspBusInformation(i, out busInfo)); + + Debug.Log(busInfo.name); + Debug.Log(busInfo.volume); + Debug.Log(busInfo.numFxes); + Debug.Log(busInfo.numBusLinks); + } + //鑾峰彇Acb鏂囦欢鍜孉wb鏂囦欢鐨勮矾寰� string nameVar = SongAwb.Name.Split('.')[0].Split('/').Last(); //浣跨敤Live鐨凚gm - nameVar = $"snd_bgm_live_{songid}_oke"; + //nameVar = $"snd_bgm_live_{songid}_oke"; LoadSound Loader = (LoadSound)ScriptableObject.CreateInstance("LoadSound"); LoadSound.UmaSoundInfo soundInfo = Loader.getSoundPath(nameVar); @@ -759,6 +791,8 @@ public class UmaViewerBuilder : MonoBehaviour foreach (CriAtomEx.CueInfo cueInfo in cueInfoList) { cueNameList.Add(cueInfo.name); + Debug.Log(cueInfo.type); + Debug.Log(cueInfo.userData); } //鍒涘缓鎾斁鍣� @@ -768,6 +802,17 @@ public class UmaViewerBuilder : MonoBehaviour //鎾斁 source.Play(cueNameList[0]); + + //source.SetBusSendLevelOffset(1, 1); + + + /* + for (int i = 0; i < 17; i++) + { + Debug.Log(source.player.GetParameterFloat32((CriAtomEx.Parameter)i)); + } + */ + } //Use decrypt function @@ -825,8 +870,6 @@ public class UmaViewerBuilder : MonoBehaviour AudioSource source; if (CurrentAudioSources.Count > 0) { - - if (Mathf.Abs(CurrentAudioSources[0].clip.length - clip.length) > 3) return; source = CurrentAudioSources[0].gameObject.AddComponent(); } else diff --git a/Assets/StreamingAssets/sound_proj.acf b/Assets/StreamingAssets/sound_proj.acf index 183531d..fdd345a 100644 Binary files a/Assets/StreamingAssets/sound_proj.acf and b/Assets/StreamingAssets/sound_proj.acf differ