Possible DSP parameter data related regression in 2.02.10 and above (FMOD_ERR_INTERNAL)

Hi,

I upgraded the version of FMOD to 2.02.11 in my project recently and started getting random FMOD_ERR_INTERNALs, and after installing various versions of FMOD it appears to be an issue introduced in 2.02.10. My code does the following:

  1. Create an instance of an event with the Steam Audio spatializer effect
  2. In an instance create callback, find the Steam Audio DSP and call setParameterData for the SIMULATION_OUTPUTS parameter.
  3. After playback has stopped, release the event instance.

The next time StudioSystem::update is called, it will return FMOD_ERR_INTERNAL and log the following:

FMOD: assertion: 'mImpl->mRefCount > 0' failed
 (C:\buildagent2\work\b8b6893b00c565e4\studio_api\src\fmod_effect.cpp:assert, 132)
FMOD: System::update returned error 28.
(C:\buildagent2\work\b8b6893b00c565e4\studio_api\src\fmod_asyncmanager.cpp:AsyncManager::asyncThreadLoop, 815)
FMOD error: An error occurred that wasn't supposed to.  Contact support.

Additionally, this can sometimes result in a crash in StudioSystem::release when shutting down, but this doesn’t always occur.
I’ve done a full trace log at FMOD log - Pastebin.com. I’m not 100% sure that this isn’t the result of something being poorly implemented in the plugin, but after going through the source of the plugin I’m not sure how it could cause this, and versions 2.02.09 and below still work.

Hi,

Unfortunately, I was unable to reproduce the issue. Are you able to reproduce the issue if you try it with a different DSP? Or would it be possible to get a copy of the code uploaded to your profile?

I was recently experiencing this same issue and was able to create a minimal Unity project to reproduce it. I assumed it was a but with Steam Audio, so I posted an issue to its GItHub Issues page: [Unity + FMOD] Error when exiting Play Mode while a Steam Audio Source is attached to an FMOD Studio Event Emitter · Issue #244 · ValveSoftware/steam-audio · GitHub

My report from there:

Video:

I created a minimal project using:

  • Unity 2021.3.18f1
  • FMOD Studio integration 2.02.12 from FMOD’s website
  • Steam Audio version 4.1.3 from the GitHub releases

If the FMOD Event has the Steam Audio Spatializer attached to it, and the Steam Audio Source component is enabled on the Game Object with the FMOD Studio Event Emitter component, then an error will appear upon exiting Play Mode.

The only modification I made to any of the files was a fix for FMOD, so that it would properly recognize the phonon_fmod plugin. I explained the fix here: Bug with loading .bundle plugins on macOS (and the fix for it)
Otherwise, the files are unmodified.

The complete project (both Unity and FMOD Studio) can be downloaded here: Steam Audio Bug Repro 2.zip - Google Drive

The error messages themselves, from Editor.log, are:

[FMOD] assert : assertion: 'mImpl->mRefCount > 0' failed
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogError (object)
FMODUnity.RuntimeUtils:DebugLogError (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:574)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:77)

(Filename: Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 574)

[FMOD] AsyncManager::asyncThreadLoop : System::update returned error 28.
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogError (object)
FMODUnity.RuntimeUtils:DebugLogError (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:574)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:77)

(Filename: Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 574)

I hope this is able to help with diagnosing and fixing the issue!

Hi,

Thank you for such detailed findings and a project. We really appreciate it. I have passed this onto our development team to look into further. If there is any progress I will let you know.

1 Like

Thanks for the response! :smiley:

1 Like

FWIW, I am also seeing this in Unreal when using setParameterData on the “Resonance Audio Listener” DSP unit. In my case, I am searching for the DSP every frame by iterating over all loaded banks and busses until I find it, and then configuring a vraudio::RoomProperties variable and passing it to setParameterData. If this is caused by trying to set the parameter while the DSP is in the process of being destroyed, what would be a good way to determine that state since DSP doesn’t have an isValid method?

Hi,

Are you using the same version of FMOD?

You can check the result of the FMOD functions using FMOD_RESULT which provides useful debug information. The result we are looking for is FMOD_ERR_INVALID_HANDLE which lets us know the DSP is no longer valid.

FMOD_RESULT result = myDsp.setParameterData()

What is happening in your game for you to receive the assertion?

We are using 2.02.13. I don’t check the result of calling setParameterData because I call it more or less immediately after retrieving it from the bus ChannelGroup, but I will add a check and see if the result changes from FMOD_OK before seeing the assertions.

In our game, I am configuring the room dynamically and updating the DSP. When exiting PIE I see the assertion and people running Release Editor builds experience a crash. This happens even if I disable updating the DSP before exiting PIE.

1 Like

I wrapped the setParameterData call in verifyfmod and do not see any warnings/errors logged from that call when exiting PIE.

1 Like

Thank you for confirming. We are currently working on the issue and it is targeted to be released with the next update. I will post here if there is any progress.