I’m using the low-level system to initialize sounds, by getting the low-level system from the StudioSystem, then creating a sound calling
Sound = LowLevelSystem->createSound(... // LowLevelSystem is of type FMOD::System*
Sound is a class member, and after my (Unreal Engine UCLASS) class is destroyed, I wish to release the sound neatly. However, in some cases the FMOD StudioSystem is no longer available, for example when the game stops.
To cope with this, I added some code to the FMOD plugin that allows me to add ‘FMOD cleanup listeners’ that are notified when FMOD is about to destroy its StudioSystem. However, every time a new FMOD version comes out I need to redo this, and I’m wondering if I really need to.
Does FMOD release any unreleased sounds when its StudioSystem shuts down?
No you have to free the sounds yourself. If FMOD uses a memory pool though you can basically close fmod down then free the pool memory.
Thanks for the response. If I am to release them myself, can you give me advise on when to do that?
I’ve installed the normal UE4 plugin into my UE4.14 project, all latest versions, and I’m making some sounds using the LowLevelSystem.
However, when I want to release these sounds the StudioSystem pointer is no longer valid - this is during EndPlay in my UE4 actor. I’d rather not fiddle with the FMOD source anymore, so please advise me how to either listen to some FMOD ‘shutting down’ event, or finding the best place in UE4 code to clean up FMOD?
And since I’m using the FMOD plugin, does that mean the pool memory is being freed as FMOD closes down?
If you create an object using the LowLevelSystem you will need to manually release it. This would generally be done in something like the BeginDestroy or Destroyed functions. This can be an issue in Editor because the FMOD Systems are released before everything is cleaned up by Unreal, but will function correctly in a standalone game.
I’m only using the system in the game runtime, so this should suffice. I will try this! Thanks!