|
Post by CCI on Dec 4, 2022 0:58:16 GMT
From MasterAudio.cs line 969~989, Awake()
for (var j = 0; j < weight; j++) {
if (j > 0) {
// ReSharper disable once ArrangeStaticMemberQualifier
var extraChild = (GameObject)GameObject.Instantiate(child.gameObject, parentGroup.transform.position, Quaternion.identity);
extraChild.transform.name = child.gameObject.name;
childVariation = extraChild.GetComponent<SoundGroupVariation>();
childVariation.weight = 1;
newWeightedChildren.Add(extraChild.transform);
source = extraChild.GetComponent<AudioSource>();
//sources.Add(new AudioInfo(childVariation, source, source.volume));
sources.Add(new AudioInfo(childVariation, source, vol));
allVars.Add(childVariation);
switch (childVariation.audLocation) {
case AudioLocation.ResourceFile:
AudioResourceOptimizer.AddTargetForClip(childVariation.resourceFileName, source);
break;
}
}
The original audio source volume is set to 1, but the instantiated audio's volume is always set to 0.
So AudioInfo's OriginalVolume is set to 0, leading to always muted audio when the instantiated audio source is being used.
I'm quiet new to this asset, so I'm wondering if it would be safe to set the AudioInfo- OriginalVolume with the original audio sources' volume instead of the instantiated one.
I'm using Unity 2021.3.12f1
|
|
|
Post by DarkTonic Dev on Dec 4, 2022 5:16:40 GMT
Please don't be posting any of the source code in this forum in the future. Are you on the very latest version from the Asset Store?
Now even if it's instantiated at zero, it may be set to another number in the Start method of the Sound Group or Variation, have you checked? Initialization code is fairly complex to get everything to "warm" properly.
Also, are you sure that you aren't attempting to play the "warming" Audio Source while it's busy playing silently? You can turn off warming in Advanced Settings to make sure.
-B
|
|
|
Post by CCI on Dec 4, 2022 9:30:59 GMT
Oh, sorry. I shouldn't have done that. Yes, I'm using the latest version. I've been logging AudioInfo.OriginalVolume from start to end. if (aSource.clip.name.Contains("25349") && aSource.gameObject.scene.name.Contains("Right2")) Debug.Log(aInfo.OriginalVolume); The original SoundGroupVariation's OriginalVolume is set to 1, while the Instantiated one(By the Voices/Weight setting) stays at 0 forever. The only place I see the OriginalVolume gets modified is from ChangeVariationVolume() from MasterAudio.cs, but I don't think this is ever used. Or maybe I'm just missing something. I tried toggling warming on and off, but I don't think this is the cause. Setting the instantiated audio's OriginalVolume to the original audio's volume worked for me.
|
|
|
Post by DarkTonic Dev on Dec 4, 2022 16:30:16 GMT
Original Volume should always be set to the Audio Source's volume in edit mode. It it's not, perhaps you adjusted the Audio Source's volume instead of the Volume field on the Variation? You shouldn't touch the Audio Source in Master Audio at all, except for creating custom 3D rolloffs. Let me know if you figure out how it happened.
Thanks, -B
|
|