junor
New Member
Posts: 2
Posts: 2
|
Post by junor on Oct 1, 2022 18:32:57 GMT
Hello,
I have an issue where changing the bus volume resets the volume of an already playing variation.
I play the variation using PlaySound3DAtTransform and set the volume to 0, because I wish to fade in the sound.
However, when I change the bus volume while it's playing(from the UI or through code), it resets the variation volume back to 0. In fact, it will always reset it to a volume it was initially played at.
Here's a code snippet of what I'm using to play the variation
if(playerInRange && !isPlaying){
if(psr==null) psr = MasterAudio.PlaySound3DAtTransform(soundGroup, transform, 0f);
else psr = MasterAudio.PlaySound3DAtTransform(soundGroup, transform, 0f, variationName:psr.ActingVariation.name); psr.ActingVariation.FadeToVolume(PlayerPrefs.GetInt("VolumeMusic", 50), 1.5f);
isPlaying = true;
}
else if(!playerInRange && isPlaying){
psr.ActingVariation.FadeOutNowAndStop(1.5f);
isPlaying = false;
}
I'm not sure if I'm missing something in the documentation on how the bus volume works with the sound group/variation volumes, but any suggestions will be appreciated.
PS: I have also tried using AdjustVolume on the variation after playing to set it to 0, and then using FadeToVolume afterwards but that doesn't seem to work for me.
Thanks!
|
|
|
Post by DarkTonic Dev on Oct 2, 2022 6:42:29 GMT
I couldn't reproduce it on the latest of Master Audio 2022. Are you on the latest? I tried changing the bus volume during the fade and after the fade. It didn't go back to zero. It seems like during the fade, bus volume will not affect the volume at all.
If you're on the latest version, you'll need to send me an example scene that reproduces the bug.
Thanks -Brian
|
|
junor
New Member
Posts: 2
Posts: 2
|
Post by junor on Oct 6, 2022 20:47:22 GMT
After working on it some more I was able to figure out that some other code in the game sets the bus volume above the 0-1 range, and using the UI (after the fade has completed) puts the volume very low that it is basically 0.
I have another question, when I use a PlaySound function without setting the volume, is there a way for me to know what the volume it plays at beforehand? I understand there's a calculation that happens with the mixer, bus, group volumes to determine the final variation volume.
|
|
|
Post by DarkTonic Dev on Oct 6, 2022 21:30:40 GMT
Sure, the calculation is Variation Volume (times) Sound Group Volume (times) Bus Volume (if there's a bus assigned), (times) Master Mixer Volume.
|
|