What is the proper sequence to shut down FMOD?

Hello there,

Following a user issue leading to the application hanging forever on their machine, we narrowed this problem down to when the application is closing and calls Studio::System::flushCommands() (which blocks forever).

Our shut down sequence is:

  • Studio::System::unloadAll()
  • Studio::System::flushCommands()
  • Studio::System::release()

This made me wonder what is the expected sequence to shut down FMOD. Some exemples call Studio::System::unloadAll() and Studio::System::release() and that’s it.
Other exemples unload each banks individually, and some examples call Studio::System::flushCommands() before Studio::System::release() (to make sure that the banks are unloaded, I assume?) but some don’t.

Is Studio::System::flushCommands() even needed? Does Studio::System::release() calls it internally and/or wait for the banks to actually be unloaded?

And is Studio::System::unloadAll() required? There is at least one exemple that loads a bank and just call Studio::System::release() without explicitly unloading anything.

Thanks for any clarification.

Cheers!

(Running on FMOD 2.02.11 and the freeze also happened on earlier versions.)

Hi,

To Shut Down the FMOD System you can just call Studio::System::release(). You can read more about it here: FMOD Engine | White Papers - Shut Down. The release function takes care of all the unloading for you.

More information about flushCommands() can be found here: FMOD Engine | Core API Reference - System. In summary, this will block the calling thread until all pending commands have been executed, this is useful if you want to control when a command is called. Yes, it ensures that all commands have been completed before calling release.

No, the release() function will take care of all of this for you.

It is not required when shutting down the FMOD system, the example using this function was a display of all the different methods for loading banks so it was added as a safeguard but not necessary if you are using the same method for all your banks.

Hope this helps!

Crystal clear. Thank you, Connor.

1 Like