[iOS] Frequent SystemNotInitializedException


(Romain THERY) #1

I cannot reproduce this exception on our test devices, but we frequently have the following exceptions sent to Unity performance reports service:
SystemNotInitializedException: FMOD Studio initialization failed : Calling initialize : ERR_OUTPUT_INIT : Error initializing output device.

Occurring on all versions of iOS and devices, with FMOD 1.09.06

Any idea why it couldn’t initialize the output device ?


(Cameron Baron) #2

Normally this is caused by a conflict between Unity’s inbuilt audio and the FMOD integration. This can be avoided by disabling the Unity inbuilt audio, steps can be found here:
https://fmod.com/resources/documentation-api?page=content/generated/engine_new_unity/troubleshooting.html#/


(Romain THERY) #3

Thank you for your reply, unfortunately I already had disabled Unity Audio ticking that option. Any other leads ?


(Cameron Baron) #4

The only other issue I can think of is if the app is suspended/sent to the background while it is starting up (during FMOD’s initialization). To avoid this you can enable the settings for background audio which will allow FMOD to init if suspended, but will still pause the sounds due to Unity and code in the RuntimeManager.cs.

https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionBasics/AudioSessionBasics.html


(Shannon Greenwood) #5

The error isn’t reproducible, but is fairly common. We’re seeing it during development with a small number of users. Any more feedback on what is going on would be appreciated ( or confirmation of a fix ).


(Cameron Baron) #6

Previously if the system failed to init, every time you tried to access it you would get an exception, making it hard to determine the cause.
In the latest versions, 1.09.08 & 1.10.00, we changed it to throw the exception once and then set the system to no sound mode. This is not a fix, just nicer.

I’m not sure what the fix would be without seeing more information on the specific error as there could be a number of causes. The couple I mentioned above are just the most common, and are out of our control to ‘fix’.


(Shannon Greenwood) #7

Will there be logs in addition to this error that will help diagnose? How can I gather more information about what is happening?


(Shannon Greenwood) #8

Will there be logs in addition to this error that will help diagnose? How can I gather more information about what is happening?


(Cameron Baron) #9

You can add extra flags to the FMOD Debug init in the RuntimeManager.cs, to look like this:

FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG | FMOD.DEBUG_FLAGS.TYPE_TRACE, FMOD.DEBUG_MODE.FILE, null, RuntimeUtils.LogFileName);

This should provide more information about the errors. If you could provide the log files, either here or to support@fmod.com, we can take a look for you.


(Shannon Greenwood) #10

changed the code by commenting out #define

got this error
03:47:19 [Exception] SystemNotInitializedException: FMOD Studio initialization failed : Applying debug settings : ERR_UNSUPPORTED : A command issued was not supported by this object. Possibly a plugin without certain callbacks specified. FMODUnity.RuntimeManager.CheckInitResult (RESULT result, System.String cause)
FMODUnity.RuntimeManager.Initialiase (Boolean forceNoNetwork)
FMODUnity.RuntimeManager.get_Instance ()
FMODUnity.RuntimeManager.LoadBank (System.String bankName, Boolean loadSamples)
FMODUnity.StudioBankLoader.Load ()
FMODUnity.StudioBankLoader.HandleGameEvent (LoaderGameEvent gameEvent)
FMODUnity.StudioBankLoader.Start ()

Is this supported on IOS at all?
(since I had to comment out the define)

Do I need to set the DEVELOPMENT_BUILD #define?

//#if UNITY_EDITOR || ((UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX) && DEVELOPMENT_BUILD)
result = FMOD.Debug.Initialize(FMOD.DEBUG_FLAGS.LOG | FMOD.DEBUG_FLAGS.TYPE_TRACE, FMOD.DEBUG_MODE.FILE, null, RuntimeUtils.LogFileName);
if (result == FMOD.RESULT.ERR_FILE_NOTFOUND)
{
#if UNITY_5_X
Debug.LogErrorFormat(“FMOD Studio: Cannot open FMOD debug log file ‘{0}’, logs will be missing for this session.”, System.IO.Path.Combine(Application.dataPath, RuntimeUtils.LogFileName));
#else
Debug.LogError(string.Format(“FMOD Studio: Cannot open FMOD debug log file ‘{0}’, logs will be missing for this session.”, System.IO.Path.Combine(Application.dataPath, RuntimeUtils.LogFileName)));
#endif
}
else
{
CheckInitResult(result, “Applying debug settings”);
}
//#endif


(Johannes Deml) #11

Any progress on this so far?
I’m also getting this error from Unity performance reporting:
FMOD Studio initialization failed : Calling initialize : ERR_OUTPUT_INIT : Error initializing output device.

Disabling unity audio has the problem that all other audio sources are muted. It is not possible (as of my knowledge) to set the audio session yourself before showing the splash screen:
https://www.fmod.org/questions/question/mute-audio-sources-option-ignored-when-disabling-unity-audio/#sabai-entity-content-46782


(Cameron Baron) #12

We are currently looking into this and will hopefully have a solution soon.


(Cameron Baron) #13

In FMOD Studio version 1.09.07 we limited the number of exceptions thrown from this issue by re-initializing in no sound mode. This is by no means a fix for the cause of the exception but it does stop the error spam.

We currently have a solution planned for a future release, although it does require reworking some of the LowLevel init system for iOS, unfortunately we don’t have a time frame for this at the moment.