mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update Audio
Update Audio
This commit is contained in:
@@ -25,7 +25,6 @@ namespace TEngine
|
|||||||
public AudioMixer audioMixer { get; set; }
|
public AudioMixer audioMixer { get; set; }
|
||||||
float[] _agentVolume = new float[(int)AudioType.Max];
|
float[] _agentVolume = new float[(int)AudioType.Max];
|
||||||
private AudioAgent[] _audioAgents = new AudioAgent[(int)AudioType.Max];
|
private AudioAgent[] _audioAgents = new AudioAgent[(int)AudioType.Max];
|
||||||
public Dictionary<string, int> _soundConfigDic = new Dictionary<string, int>();
|
|
||||||
public Dictionary<string, AssetData> AudioClipPool = new Dictionary<string, AssetData>();
|
public Dictionary<string, AssetData> AudioClipPool = new Dictionary<string, AssetData>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -473,32 +472,17 @@ namespace TEngine
|
|||||||
|
|
||||||
for (int i = 0; i < _audioObjects.Count; i++)
|
for (int i = 0; i < _audioObjects.Count; i++)
|
||||||
{
|
{
|
||||||
if (AudioMgr.Instance._soundConfigDic != null && AudioMgr.Instance._soundConfigDic.ContainsKey(path) && AudioMgr.Instance._soundConfigDic[path] == num)
|
if (_audioObjects[i]._assetData == null || _audioObjects[i].IsFinish == true)
|
||||||
{
|
{
|
||||||
if (_audioObjects[i] != null && _audioObjects[i]._assetData != null && path == _audioObjects[i]._assetData.Path)
|
freeChannel = i;
|
||||||
{
|
|
||||||
if (_audioObjects[i].Duration > duration)
|
|
||||||
{
|
|
||||||
duration = _audioObjects[i].Duration;
|
|
||||||
|
|
||||||
freeChannel = i;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if (_audioObjects[i].Duration > duration)
|
||||||
{
|
{
|
||||||
if (_audioObjects[i]._assetData == null || _audioObjects[i].IsFinish == true)
|
duration = _audioObjects[i].Duration;
|
||||||
{
|
|
||||||
freeChannel = i;
|
|
||||||
|
|
||||||
break;
|
freeChannel = i;
|
||||||
}
|
|
||||||
else if (_audioObjects[i].Duration > duration)
|
|
||||||
{
|
|
||||||
duration = _audioObjects[i].Duration;
|
|
||||||
|
|
||||||
freeChannel = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -161,11 +161,11 @@ namespace TEngine
|
|||||||
|
|
||||||
public void Init(AudioMixerGroup audioMixerGroup = null)
|
public void Init(AudioMixerGroup audioMixerGroup = null)
|
||||||
{
|
{
|
||||||
GameObject host = new GameObject("Audio");
|
GameObject root = new GameObject("Audio");
|
||||||
host.transform.SetParent(AudioMgr.Instance.transform);
|
root.transform.SetParent(AudioMgr.Instance.transform);
|
||||||
host.transform.localPosition = Vector3.zero;
|
root.transform.localPosition = Vector3.zero;
|
||||||
_transform = host.transform;
|
_transform = root.transform;
|
||||||
_source = host.AddComponent<AudioSource>();
|
_source = root.AddComponent<AudioSource>();
|
||||||
_source.playOnAwake = false;
|
_source.playOnAwake = false;
|
||||||
if (audioMixerGroup != null)
|
if (audioMixerGroup != null)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user