|
Post by Saif on Jan 26, 2024 23:16:49 GMT
Hi,
I ran into a strange situation, here is the following steps to replicate it:
- I FadeBusToVolume a certain bus to volume 0 and set willStopAfterFade to true - During the above fadeout I restart the game where I MutEverything and StopMixer - If I try to replay the forementioned Bus, the Bus volume will remain at 0
My guess is that the FadeBusToVolume coroutine will keep running even if I StopMixer. Is there a way to stopallcoroutines in Masteraudio when I restart?
Kind regards, Saif
|
|
|
Post by DarkTonic Dev on Jan 27, 2024 22:16:55 GMT
Strictly speaking, there are very few actual Coroutines in our product. We use them only when necessary. FadeBusToVolume is not a Coroutine. If you can confirm that the bus fade is still happening when you StopMixer, we can provide code to stop all similar gradual events during "StopMixer".
You could perform a test by settings an exceedingly long fade and trying to restart the game before and after the fade completes.
Let me know and thanks! Brian
|
|
|
Post by Saif on Jan 28, 2024 16:11:23 GMT
Hi Brian,
Thanks for the reply. Yes I can confirm that the FadeBusToVolume is still happening after I StopMixer. Can I please ask for: - Code to stop all similar gradual events during "StopMixer" - If the FadeBusToVolume is stopped in the middle, is there a way to reset the volume of the bus to it's original value?
Kind regards, Saif
|
|
|
Post by DarkTonic Dev on Jan 29, 2024 21:08:54 GMT
Thanks, I will look into the code tomorrow and report back.
|
|
|
Post by DarkTonic Dev on Jan 30, 2024 18:52:35 GMT
Add this private method to MasterAudio.cs
private static void StopAllGradualProcesses() { // finish Occlusion for (var i = 0; i < Instance.VariationOcclusionFreqChanges.Count; i++) { var aFader = Instance.VariationOcclusionFreqChanges[i]; aFader.CompletionTime = AudioUtil.Time; }
// finish Bus fades for (var i = 0; i < Instance.BusFades.Count; i++) { BusFadeInfo aFader = Instance.BusFades[i]; aFader.CompletionTime = AudioUtil.Time; }
// finish Bus pitch glides for (var i = 0; i < Instance.BusPitchGlides.Count; i++) { BusPitchGlideInfo aGlider = Instance.BusPitchGlides[i]; aGlider.CompletionTime = AudioUtil.Time; }
// finish Group fades for (var i = 0; i < Instance.GroupFades.Count; i++) { var aFader = Instance.GroupFades[i]; aFader.CompletionTime = AudioUtil.Time; }
// finish Group pitch glides for (var i = 0; i < Instance.GroupPitchGlides.Count; i++) { GroupPitchGlideInfo aGlider = Instance.GroupPitchGlides[i]; aGlider.CompletionTime = AudioUtil.Time; } }
And call it from StopMixer method.
public static void StopMixer() { Instance.VariationsStartedDuringMultiStop.Clear(); Instance._isStoppingMultiple = true;
foreach (var key in Instance.AllSoundGroupNames) { StopAllOfSound(Instance.AudioSourcesBySoundType[key].Group.GameObjectName); }
StopAllGradualProcesses();
Instance._isStoppingMultiple = false; }
This will be in the next update.
|
|
|
Post by Saif on Jan 31, 2024 1:01:47 GMT
That's great! Thank you for sharing this. I assume there is no way for the bus volumes to reset to their original values after stopping the fading?
|
|
|
Post by DarkTonic Dev on Feb 1, 2024 3:17:45 GMT
Yes, you the second optional parameter does that. "willResetVolumeAfterFade" set to true does the trick.
https://www.dtdevtools.com/API/masteraudio/class_dark_tonic_1_1_master_audio_1_1_master_audio.html#abd27b10537617df70dfd1f84a134bab0
|
|
|
Post by Saif on Feb 1, 2024 5:12:21 GMT
Sorry I missed that, thank you for your great support!
|
|
|
Post by DarkTonic Dev on Feb 1, 2024 21:58:04 GMT
No problem.
|
|