SETUP:
Alienware m17 laptop
Windows 10
Unity 2019.4.36f1
FMOD (UnityAudio disabled)
PROBLEM: Unity Editor hangs during DEVICELISTCHANGED callback if FMOD API is accessed. Specifically, the endpoints are:
- CoreSystem.getDriver
- CoreSystem.getNumDrivers
- CoreSystem.getDriverInfo
Attaching debugger shows that the stuck call is:
RuntimeManager.DrawDebugOverlay (Line 728) => Memory.GetStats(Line 924), called with blocking = true.
Callback was triggered by switching system device.
No other calls appear to be stuck and FMOD music continues to play.
FAILED WORK AROUND: Disable stats. Registered callback is not received, and program hangs in editor when playing is stopped. While playing switching devices cause problems indicated by console warning:
[FMOD] AsyncCommandBuffer::growBuffer : Growing command buffer to 524288 bytes. Initial command buffer size can be tuned to avoid dynamic growth using Studio::System::setAdvancedSettings()
UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeUtils:DebugLogWarning (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:533)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:86)
FMOD.Studio.System:getBus (string,FMOD.Studio.Bus&) (at Assets/Plugins/FMOD/src/fmod_studio.cs:444)
FMODUnity.RuntimeManager:ApplyMuteState () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:1447)
FMODUnity.RuntimeManager:Update () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:537)
WORKAROUND: Set (in a thread-safe way) a flag to trigger updating devices on the main Unity thread.
I have not noticed any hangs when calling the FMOD API inside a DEVICELISTCHANGED
callback. How long is it hanging for?
Would it be possible for you to share a code snippet of your callback?