We are using the extension for spatialized audio with FMOD on Quest. When too many sounds play (like 90), the sounds, which are oneshots, will stay in the lifecycle as active, and cannot be released, this then causes successive sound effects not to play and get stuck as well. The only workaround we have for this is to block sounds from playing if too many are already active. It would be good if the lifecycle resolved properly.
A few questions:
- What version of FMOD for Unity are you using?
- Are you using the Studio API to play Events, or the Core API to play Sounds?
- In FMOD for Unity’s settings, can I get you to set the logging level to “Log”, enable API error logging, and post a log where the issue occurs?
- We are using 2.02.21 on Unity 2022.3.36f1
- Using the Studio API
Here is the log: fmod_overload-3-25.log - Google Drive
Thanks for the log.
The issue you’re running into is likely caused by a combination of two things:
- Your event instances not being released, or never reach their end even when
release()has been called on them - As a result of the event instances not releasing, you’re either hitting an event instance limit set on an event or a bus, or your voice count is hitting the max voice counts set in FMOD for Unity’s Settings → Platform Specific
For the first point, you need to make sure the event instances have had release() called on them - oneshots played with RuntimeManager.PlayOneShot() are set to release. If the instances persist despite being released, it’s likely that the event is either set to persistent in the event macro section of the deck in Studio, or has no natural end (i.e. there’s always content that it will play in the future, it loops forever, etc.). I’d recommend making sure that neither of these things are occurring for the event instances in question.
For the second point, if resolving the first point doesn’t fix the issue, you may need to either increase the event’s max instances, or the bus instance limit if either of them have been set to low values. If the channel count is the issue, not the event instance count, you should increase the max real and virtual voice counts in FMOD for Unity’s settings, as mentioned previously.
I added logic in StudioEventEmitter to detect when sounds are done playing and stopping them and that seems to have fixed the issue.
Happy to hear!
I must revive this old thread because I have a few observations regarding this topic. I have a lot of sounds in my project, 20 cars roaming around, each one with a fairly complex engine sound, tire noise, skid sounds etc.
This leads to half of the sounds not playing at all, 50% of the traffic car engine sounds never start playing (the fmod event instance never enters the playing state) and it sounds like the overall sound quality drops to a 16khz sample rate, which fixes itself after a few seconds but then falls back randomly. Is that intended behaviour because of configuration/hardcoded limits?
Also, is it in the hands of the game developer to play/stop sounds that are too far away from the player to save resources or should fmod be able to handle that?
This sounds like an event limiting issue, or that the number of voices is exceeding the virtual/real voices set for the FMOD system using System::init or Studio::System::initialize, and System::setSoftwareChannels respectively. I’d recommend recording a profiler session via live update and checking the number of voices and event instances playing, and seeing whether they’re hitting any limits.
This definitely isn’t expected behavior. Do you get any warnings/errors from the FMOD system when this occurs?
While FMOD does have a virtualization system, which can address a lot of the CPU load incurred by playing a large amount of voices at once, it is not a culling system. If developers want to cull voices outside of a specific range and then resume them, it is up to them to implement that functionality (broadly speaking; there is some culling functionality in the integrations which can stop events playing when they’re outside their max distance).