|
Post by lebazooke on Jul 6, 2020 23:08:32 GMT
Hello I am trying to add MasterAudio to my current scene. Following the tutorial I add a GameObject with an Event Sounds initially inactive, when I activate it via code it works and plays the sound. But when I try to play sounds from the code via MasterAudio.PlaySound or MasterAudio.PlaySoundAndForget nothing sounds. Checking some things I see that in the inspector I see that if it indicates that if they reproduce. Try increasing the "Voices" field. Because I got a message in the log that was currently busy. On each occasion when the event was invoked. With this the message disappeared, but the sound still does not play. In the capture that I attach the inspector says that if the method was invoked, and that they are supposedly reproducing at that time. but it does not reproduce. Also try changing the sound it works with but it doesn't sound either.
Thanks in advance
|
|
|
Post by DarkTonic Dev on Jul 6, 2020 23:36:25 GMT
You say the sound does not play, but I bet they are playing and you just can't hear them because they're too far away from the Audio Listener. First, force all Sound Groups to 2D and see if you can hear them.
Also, turn on "Log Sounds" in Advanced Settings to see if things are playing or not, and watch the mixer section for that Sound Group which will always show the number of voices playing during play.
|
|
|
Post by lebazooke on Jul 6, 2020 23:45:15 GMT
You say the sound does not play, but I bet they are playing and you just can't hear them because they're too far away from the Audio Listener. First, force all Sound Groups to 2D and see if you can hear them. Also, turn on "Log Sounds" in Advanced Settings to see if things are playing or not, and watch the mixer section for that Sound Group which will always show the number of voices playing during play. Thank you very much. super fast response. Switching to "Force All To 2D" corrected the problem.
Sorry when it was very basic
|
|
|
Post by DarkTonic Dev on Jul 6, 2020 23:52:16 GMT
No problem. So if you really want it to be 3D you will need to use a larger radius Audio Source Template. Several are included. You can apply them from the mixer section to Sound Groups. Apply a larger one, hit play, see if it's loud enough. If it's not, go up to the next larger.
|
|
|
Post by eyesgood on Aug 1, 2020 20:39:09 GMT
I am still testing, but I am having this exact same issue. I have a Master Audio Group under Master Audio. This group is for player action sounds. I have the Group Control set to Force All to 2D. My question is, does it sound like I am using groups correctly? I have all sounds in the single Master Audio Group. Settings are: with Bulk Creation Mode set to One Group With Variations, and Variation Create Mode set to Resource File (sounds under Resources/Sounds/Action folder). I script the call to play a chopping sound first, then a tree falling sound after 3 seconds. Sometimes the tree falling sound never fires. Watching the Inspector, the second sound sometimes just doesn't fire (green). I am calling the sounds like this:
MasterAudio.PlaySoundAndForget("ActionSounds", 1, null, 3.0f, "SmallTreeFalling", null);
The error message I get is:
T: 398.4143 - MasterAudio: All 19 children of ActionSounds were busy. Will not play this sound for this instance. If you need more voices, increase the 'Voices (Weight)' field on the Variation(s) in your Sound Group.
After the 3 second delay of the chopping sound, the tree fall sound is supposed to start. I would say it does about 75% of the time.
Update: It happens a lot when I am debugging on the first instance of playing the sounds. Here is the error:
T: 16.01064 - MasterAudio: All 19 children of ActionSounds were busy. Will not play this sound for this instance. If you need more voices, increase the 'Voices (Weight)' field on the Variation(s) in your Sound Group. UnityEngine.Debug:Log(Object) DarkTonic.MasterAudio.MasterAudio:LogMessage(String) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:7294) DarkTonic.MasterAudio.MasterAudio:PlaySoundAtVolume(String, Single, Vector3, Nullable`1, Nullable`1, Transform, String, Boolean, Single, Boolean, Boolean, Boolean, Boolean, Boolean) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:2199) DarkTonic.MasterAudio.MasterAudio:PlaySoundAndForget(String, Single, Nullable`1, Single, String, Nullable`1) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1493) Assets.Scripts.Player.PlayerAction:PerformActionOnObject(STObjectAction, STTilemapLevel, STTilemapLayer, Int32, Int32) (at Assets/Scripts/Player/PlayerAction.cs:212) Assets.Scripts.Player.PlayerAction:ProcessTreeRadialButtonClick(String) (at Assets/Scripts/Player/PlayerAction.cs:74) UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)
|
|
|
Post by DarkTonic Dev on Aug 2, 2020 8:02:58 GMT
You can put them all in the same Sound Group if you want, but unless you're using "Looped Chain" mode (which you're not) or Dialog mode (which you're not), you should group only actual "Variations" of the same sound in the same Sound Group. i.e. if you have 3 different jump sounds, those go in 1 Group. The top of this documentation page gives this advice, if you're curious: www.dtdevtools.com/docs/masteraudio/SoundGroupVariations.htmAnyway, none of that will make a difference in the error you're seeing. For that you need to do what it suggests, and increase the "Voices (Weight)" field of the particular Variation to a higher number. It might be set to 1, which means that only 1 of that Variation can play at the same time.
|
|
|
Post by eyesgood on Aug 2, 2020 13:36:09 GMT
Thank you for the reply and suggestions. That link helped. There is so much to take in with MasterAudio.
|
|
|
Post by DarkTonic Dev on Aug 2, 2020 16:05:39 GMT
There is. But the basics aren't too bad. this is one of the basics. And our documentation is pretty good.
|
|
|
Post by eyesgood on Aug 8, 2020 16:41:28 GMT
T: 922.3325 - MasterAudio: All 95 children of ActionSounds were busy. Will not play this sound for this instance. If you need more voices, increase the 'Voices (Weight)' field on the Variation(s) in your Sound Group. UnityEngine.Debug:Log(Object) DarkTonic.MasterAudio.MasterAudio:LogMessage(String) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:7294) DarkTonic.MasterAudio.MasterAudio:PlaySoundAtVolume(String, Single, Vector3, Nullable`1, Nullable`1, Transform, String, Boolean, Single, Boolean, Boolean, Boolean, Boolean, Boolean) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:2199) DarkTonic.MasterAudio.MasterAudio:PlaySoundAndForget(String, Single, Nullable`1, Single, String, Nullable`1) (at Assets/Plugins/DarkTonic/MasterAudio/Scripts/Singleton/MasterAudio.cs:1493) Assets.Scripts.Player.PlayerAction:PerformActionOnFlora(STObjectAction, STTilemapLevel, STTilemapLayer, Int32, Int32) (at Assets/Scripts/Player/PlayerAction.cs:254) Assets.Scripts.Player.PlayerAction:ProcessTreeRadialButtonClick(String) (at Assets/Scripts/Player/PlayerAction.cs:75) UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376) This issue has returned. I followed your instructions and increased the voices weight to 3 for each variant. When that failed to fix it, I increased them to 100. When I did that, Unity bogs down so much the game wont even respond. What is strange is that it happens when I start the game. It's not like I have called the sounds 95 times. It sometimes fails the first, second, third time the sounds are getting played. How can all the children be busy if its only called 1 or 2 times before it stops working? Here is how I am calling in code: MasterAudio.PlaySoundAndForget("ActionSounds", 1, null, 0, "ChopTree", null); _messageText.text += _nl + "You chop on the tree."; PerformActionOnFlora(STObjectAction.ChopTree, STGameManager.Instance.PlayerLevel, STTilemapLayer.Top, ptXPos, ptYPos); in PerformActionOnFlora() method: MasterAudio.PlaySoundAndForget("ActionSounds", 1, null, 3.0f, "SmallTreeFalling", null); Watching the group at runtime, both sounds are called (2 green) at the same time of course, but only one plays, then the other plays 3 seconds later.... that is, when it works. Can you offer any further assistance with this? Thank you.
|
|
|
Post by DarkTonic Dev on Aug 8, 2020 22:36:09 GMT
I can't reproduce anything like that. If you didn't tell it to play 95 times, it wouldn't be playing 95.
First of all, it said that 95 Variations of a single Sound Group are all busy. That means you have 95 Audio Clips playing just in that Sound Group. Be aware that Unity can only play 32 voices and it mutes the rest, so that's wasted CPU, and yes that could really slow down your game for no reason since you're not going to hear all of them.
If you are really playing that many, you need to rethink your sound design.
I can't read your attachments, they're too small. Try attaching instead of inserting in the next response.
You can send me a stripped down project that reproduces what you're seeing if you like, as a PM, and tell me how to reproduce it.
|
|