This commit is contained in:
左右看
2023-07-05 02:25:27 +08:00
parent 1a49208ad2
commit 2599726a62
5 changed files with 145 additions and 4 deletions
@@ -14,4 +14,6 @@ MonoBehaviour:
m_EditorClassIdentifier:
outputAssetsRoot:
useCommonKey: 1
cuesheetKeyList: []
cuesheetKeyList:
- cuesheetGuid: 000000000
key: 75923756697503
+85
View File
@@ -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<string> cueNameList = new List<string>();
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<CriAtomSource>();
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));
}
*/
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c38f800f346211947a7d89fe087e4d42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+46 -3
View File
@@ -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文件和Awb文件的路径
string nameVar = SongAwb.Name.Split('.')[0].Split('/').Last();
//使用Live的Bgm
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<AudioSource>();
}
else
Binary file not shown.