|
Post by oopp on Aug 3, 2023 12:11:48 GMT
Hi, I need to play more than one sound at the same time, but this number is uncertain, it could be 10, it could be 200.
I think it should actually only be necessary to play a couple of the sounds closest to the Audio Listener.
However, I don't want the other sounds to be stopped when these are played. Because these sounds are looped and persistent and are controlled by some state to play and pause, etc.
For some reason, in some cases I don't use Event Sound ,Ambient Sound. nor MasterAudio.PlaySound3DFollowTransform method. Instead, I use the MasterAudio.PlaySound3DAtVector3 method.
What should I do to fulfill my needs?Thanks.
|
|
|
Post by DarkTonic Dev on Aug 3, 2023 14:19:40 GMT
Well, the default limit in Unity is 32 sounds playing at the same time. The rest will be culled. Have you changed the default settings?
It doesn't matter which script or API call you use. However you will need to set your Bus Voice Limits high (or don't use voice limits) and set your Voices for variations to your intended max.
|
|
|
Post by oopp on Aug 4, 2023 6:24:04 GMT
Ok, but should I use the MasterAudio.CreateGroupVariationFromClip method for uncertain quantities? Will this multiply the audio clip memory? Also how do I remove the soundGroupVariation? thanks!
|
|
|
Post by oopp on Aug 4, 2023 12:16:45 GMT
I tried to create a new Variation using "CreateGroupVariationFromClip" and I found out that this new Variation is set to the "Instance. soundGroupVariationTemplate.gameObject". It can't be the same as other variations of the same SoundGroup.
|
|
|
Post by oopp on Aug 4, 2023 12:18:10 GMT
In case I happen to play more than 512 sounds at the same time, what happens to the unity
|
|
|
Post by DarkTonic Dev on Aug 4, 2023 12:37:07 GMT
Ok, but should I use the MasterAudio.CreateGroupVariationFromClip method for uncertain quantities? Will this multiply the audio clip memory? Also how do I remove the soundGroupVariation? thanks! Why do you want to create the Variation at runtime? Increasing the voices doesn't affect memory usage at all, since Unity 5.
|
|
|
Post by DarkTonic Dev on Aug 4, 2023 12:37:39 GMT
I tried to create a new Variation using "CreateGroupVariationFromClip" and I found out that this new Variation is set to the "Instance. soundGroupVariationTemplate.gameObject". It can't be the same as other variations of the same SoundGroup. It's a separate variation, yes. I'm not sure what you're trying to do. As I said earlier, if you want more of the same sound, you need to increase its Voices count in the Variation. The default is 1 voice.
|
|
|
Post by DarkTonic Dev on Aug 4, 2023 12:39:18 GMT
In case I happen to play more than 512 sounds at the same time, what happens to the unity Looks like the hard limit (if you set it that high, otherwise 32), is 256 voices. forum.unity.com/threads/max-real-voices-always-limited-to-32.1406710/Anything further won't be played (heard). You can use Bus voice limits to make sure older/further sounds are stopped when the limit is reached, so you hear the new sounds.
|
|
|
Post by oopp on Aug 4, 2023 14:20:27 GMT
Thanks. The reason I wanted to generate more sounds at runtime was because I wasn't sure how many sounds I might end up with playing. If the number of settings is not enough, then some sounds will be stopped. This can lead to not good enough results on some of the longer sounds or loops. So what I'm hoping for is that if I don't set enough, I can also generate more sounds to make sure that other sounds don't get stopped in a not-so-good way. Of course, there wouldn't actually be hundreds of sounds playing at the same time, I'm just envisioning extreme cases where this could lead to a bad situation
|
|
|
Post by DarkTonic Dev on Aug 4, 2023 18:22:40 GMT
I'd advise just setting it high enough for worst case in edit mode. As I said, it doesn't take any more audio memory to have dupes.
|
|
|
Post by oopp on Aug 8, 2023 11:55:04 GMT
Okay, I get it. Thank you very much.
|
|
|
Post by DarkTonic Dev on Aug 8, 2023 21:53:38 GMT
No problem.
|
|