Crash on Event Initialization, only in Build

I’ve been working on a voice chat script from my previous topic and have been experiencing crashes during the initialization of the script. I’ve noticed that this only happens in the build and not while in editor mode.

I’ve been able to reduce the frequency of the crashes by adding a short arbitrary time delay to the event but it’s not guaranteed to work. Do I need to wait for something to be fully loaded before making an instance or assigning call backs? If so, what?

The event is asynchronous and created in Start().
If I dont Invoke the DelayedStart() method and call the logic immediately, it causes crashes consistently in the build when you quit and rejoin.

It seems like I can completely alleviate the crashes by delaying for about a second, but this seems unsafe.

    private void Start()
    {

        // Initialize clip buffer
        optimalRate = (int)SteamUser.OptimalSampleRate;
        outputBufferSize = optimalRate * 4;
        outputBuffer = new byte[outputBufferSize];

        // Initialize Local Memory Streams
        micStream = new MemoryStream();
        decoderInput = new MemoryStream();
        decoderOutput = new MemoryStream();
        
        // Configure sound exinfo
        exinfo.cbsize = Marshal.SizeOf(typeof(FMOD.CREATESOUNDEXINFO));
        exinfo.numchannels = 1;
        exinfo.format = FMOD.SOUND_FORMAT.PCM16;
        exinfo.length = (uint)optimalRate;
        exinfo.defaultfrequency = optimalRate; //Sample Rate, Should be 24hz
        exinfo.decodebuffersize = (uint)optimalRate/5; //0.2 second buffer for latency
        exinfo.pcmreadcallback = new FMOD.SOUND_PCMREAD_CALLBACK(PcmReadCallback);

        //DelayedStart(); // THIS CAUSES CRASHES <-----------------------------------
        Invoke(nameof(DelayedStart), 0f); // THIS MAKES CRASHES LESS FREQUENT <------
    }

    void DelayedStart() {
        // Initialize voice event
        playerVoiceInstance = RuntimeManager.CreateInstance(playerVoiceEvent);
        playerVoiceInstance.setCallback(new EVENT_CALLBACK(VoiceEventCallback));
        playerVoiceInstance.set3DAttributes(RuntimeUtils.To3DAttributes(sourceTransform));
        playerVoiceInstance.start();
    }

Update:
This only seems to happen after starting a game, quitting to title, then starting another game.
I am wondering if I am not correctly freeing up the programmer sound when players are destroyed.

Once again this never breaks in the editor, but it does in the build.

    void OnDestroy() {
        // Clean up sound and event instances
        isReady = false;
        exinfo.pcmreadcallback = null;
        playerVoiceInstance.setCallback(null);
        playerVoiceInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
        outputSound.release();
        outputSound.clearHandle();
        playerVoiceInstance.release();
        playerVoiceInstance.clearHandle();
    }

Second Update:

I’m getting this warning so it seems like previous instances and sounds aren’t being released properly.
Is this an issue with releasing both at the same time?

[FMOD] EventInstance::flushReleaseQueue : Event instance has programmer sounds pending release, update thread will be blocked until programmer sounds are released.

EDIT:

In the log I’m getting [FMOD] OutputWASAPI::mixerThread : Starvation detected in WASAPI output buffer! when rejoining, causing the crash.

What am I doing wrong here? The project isnt very resource intensive at all.
Calling outputSound.release() right before releasing the instance throws an error, invalid handle.

EDIT II: Still needing help

Heres the full script.
Fortunately it works like a charm in the editor and when first loaded in the build.
However, cleanup seems to not be working, causing future instantiation to crash the build eventually.

Still having trouble getting the event and it’s programmer sound to free up correctly.
Would I be better off using a singleton class to manage these voice chat events so that all the script references aren’t destroyed with the player objects?

You might need to wait for the system to be initialized, you can query the RuntimeManager.IsInitialized property which might help.

One thing I’m noticing from the script you shared is that you aren’t releasing your programmer sounds. If you take a look at the Programmer Sounds Example you can see how you are suppsoed to cleanup destroyed sounds by releasing them in the EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND callback.

I had EVENT_CALLBACK_TYPE.DESTROY_PROGRAMMER_SOUND implemented originally but removed it because it wasn’t being called.
It seems like I need to set the callback to null otherwise the editor crashes immediately on release.

if(playerVoiceInstance.hasHandle() && playerVoiceInstance.isValid()) {
    playerVoiceInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
    playerVoiceInstance.release();
    playerVoiceInstance.setCallback(null);
} 

What’s the best way to handle all these operations at once when the script is destroyed?
I’ve tried flipping the order of these to no avail.

Looking back over your code:

playerVoiceInstance.setCallback(new EVENT_CALLBACK(VoiceEventCallback));

This is probably the source of your issue, your callback will be deleted at the garbage collector’s whim unless you save it somewhere, which would explain the bizarre crashes you are getting. In the Programmer Sound Example we create the callback in Start and save it to a member variable:

    FMOD.Studio.EVENT_CALLBACK dialogueCallback;
...
    void Start()
    {
        // Explicitly create the delegate object and assign it to a member so it doesn't get freed
        // by the garbage collecter while it's being used
        dialogueCallback = new FMOD.Studio.EVENT_CALLBACK(DialogueEventCallback);
    }

Can you please try storing your callback in a member variable and see if that make a difference? There should be no need to null it out either.

That seems to do the trick!
Thanks for pointing it out; I thought I was being clever by just instantiating it there.

Doing some testing and not getting any errors or crashes after rapidly opening and closing etc.
I did eventually get an ERR_CHANNEL_STOLEN on very rare cases but it doesn’t seem to affect anything and might just be because error logging is on.

1 Like

Glad to hear it’s working now. That ERR_CHANNEL_STOLEN is just about voice stealing, and you are correct this is just overzealous logging.

Only issue now is a crash when multiple instances are destroyed.

[FMOD] EventInstance::flushReleaseQueue : Event instance has programmer sounds pending release, update thread will be blocked until programmer sounds are released.

I only get this warning when I use FMOD.Studio.STOP_MODE.IMMEDIATE and was originally allowing fadeout, but the crash would happen eventually and the logs would have:
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBDCB1B362) 0x00007FFBDCB1B362 (fmodstudioL) (function-name not available)
and this near the end of the stack trace:
[FMOD] OutputWASAPI::mixerThread : Starvation detected in WASAPI output buffer!

This is what the cleanup method looks like.

    // Clean up sound and event instances
    private void ShutDown() {
        micStream.Close();
        decoderInput.Close();
        decoderOutput.Close();

        if(isLocalPlayer) {
            if(SteamUser.VoiceRecord) {
                SteamUser.VoiceRecord = false;
            }
        }

        isReady = false;

        if(playerVoiceInstance.hasHandle() && playerVoiceInstance.isValid()) {
            playerVoiceInstance.release();
            playerVoiceInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
        } 
    }

Can you please share a full stack trace so I can get a better idea of where this is crashing?

========== OUTPUTTING STACK TRACE ==================

0x00007FFBDCBB4BCE (fmodstudioL) FMOD_Studio_VCA_SetVolume
0x00007FFBDCBB49BD (fmodstudioL) FMOD_Studio_VCA_SetVolume
0x00007FFBDCBB4424 (fmodstudioL) FMOD_Studio_VCA_SetVolume
SymInit: Symbol-SearchPath: '.;C:\UnityProjects\MPVCG\Builds\Mimosa Simulator;C:\UnityProjects\MPVCG\Builds\Mimosa Simulator;C:\WINDOWS;C:\WINDOWS\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 534, UserName: 'Myles'
OS-Version: 10.0.0
C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\Mimosa Simulator.exe:Mimosa Simulator.exe (00007FF754150000), size: 675840 (result: 0), SymType: '-exported-', PDB: 'C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\Mimosa Simulator.exe', fileVersion: 2022.1.0.16888
C:\WINDOWS\SYSTEM32\ntdll.dll:ntdll.dll (00007FFC3E470000), size: 2052096 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\ntdll.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\KERNEL32.DLL:KERNEL32.DLL (00007FFC3DD80000), size: 778240 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\KERNEL32.DLL', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\KERNELBASE.dll:KERNELBASE.dll (00007FFC3BE70000), size: 2916352 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\KERNELBASE.dll', fileVersion: 10.0.19041.1566
C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\UnityPlayer.dll:UnityPlayer.dll (00007FFBC7480000), size: 49475584 (result: 0), SymType: '-exported-', PDB: 'C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\UnityPlayer.dll', fileVersion: 2021.2.2.11038
C:\WINDOWS\System32\USER32.dll:USER32.dll (00007FFC3C7B0000), size: 1703936 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\USER32.dll', fileVersion: 10.0.19041.1503
C:\WINDOWS\System32\win32u.dll:win32u.dll (00007FFC3C4A0000), size: 139264 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\win32u.dll', fileVersion: 10.0.19041.1586
C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\WinPixEventRuntime.dll:WinPixEventRuntime.dll (00007FFC35840000), size: 45056 (result: 0), SymType: '-exported-', PDB: 'C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\WinPixEventRuntime.dll', fileVersion: 1.0.1812.6001
C:\WINDOWS\System32\GDI32.dll:GDI32.dll (00007FFC3C4D0000), size: 176128 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\GDI32.dll', fileVersion: 10.0.19041.1202
C:\WINDOWS\System32\gdi32full.dll:gdi32full.dll (00007FFC3C240000), size: 1093632 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\gdi32full.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\msvcp_win.dll:msvcp_win.dll (00007FFC3C350000), size: 643072 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\msvcp_win.dll', fileVersion: 10.0.19041.789
C:\WINDOWS\System32\ucrtbase.dll:ucrtbase.dll (00007FFC3C140000), size: 1048576 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\ucrtbase.dll', fileVersion: 10.0.19041.789
C:\WINDOWS\System32\ole32.dll:ole32.dll (00007FFC3D090000), size: 1220608 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\ole32.dll', fileVersion: 10.0.19041.1202
C:\WINDOWS\System32\RPCRT4.dll:RPCRT4.dll (00007FFC3CE60000), size: 1200128 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\RPCRT4.dll', fileVersion: 10.0.19041.1466
C:\WINDOWS\System32\ADVAPI32.dll:ADVAPI32.dll (00007FFC3C500000), size: 712704 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\ADVAPI32.dll', fileVersion: 10.0.19041.1466
C:\WINDOWS\System32\combase.dll:combase.dll (00007FFC3E0D0000), size: 3489792 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\combase.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\msvcrt.dll:msvcrt.dll (00007FFC3CFF0000), size: 647168 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\msvcrt.dll', fileVersion: 7.0.19041.546
C:\WINDOWS\System32\SHLWAPI.dll:SHLWAPI.dll (00007FFC3CF90000), size: 348160 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\SHLWAPI.dll', fileVersion: 10.0.19041.1023
C:\WINDOWS\SYSTEM32\VERSION.dll:VERSION.dll (00007FFC35B20000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VERSION.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\sechost.dll:sechost.dll (00007FFC3C950000), size: 638976 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\sechost.dll', fileVersion: 10.0.19041.1586
C:\WINDOWS\System32\SETUPAPI.dll:SETUPAPI.dll (00007FFC3C9F0000), size: 4653056 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\SETUPAPI.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\cfgmgr32.dll:cfgmgr32.dll (00007FFC3BE20000), size: 319488 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\cfgmgr32.dll', fileVersion: 10.0.19041.1151
C:\WINDOWS\System32\bcrypt.dll:bcrypt.dll (00007FFC3BCF0000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\bcrypt.dll', fileVersion: 10.0.19041.1023
C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll:VCRUNTIME140.dll (00007FFC20510000), size: 110592 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll', fileVersion: 14.29.30135.0
C:\WINDOWS\SYSTEM32\MSVCP140.dll:MSVCP140.dll (00007FFC1FD40000), size: 577536 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\MSVCP140.dll', fileVersion: 14.29.30135.0
C:\WINDOWS\System32\SHELL32.dll:SHELL32.dll (00007FFC3D460000), size: 7618560 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\SHELL32.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\VCRUNTIME140_1.dll:VCRUNTIME140_1.dll (00007FFC20500000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VCRUNTIME140_1.dll', fileVersion: 14.29.30135.0
C:\WINDOWS\System32\OLEAUT32.dll:OLEAUT32.dll (00007FFC3DC10000), size: 839680 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\OLEAUT32.dll', fileVersion: 10.0.19041.985
C:\WINDOWS\System32\IMM32.dll:IMM32.dll (00007FFC3DCF0000), size: 196608 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\IMM32.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\OPENGL32.dll:OPENGL32.dll (00007FFBFFA20000), size: 1204224 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\OPENGL32.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\WINMM.dll:WINMM.dll (00007FFC2CC50000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WINMM.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\CRYPT32.dll:CRYPT32.dll (00007FFC3BB90000), size: 1400832 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\CRYPT32.dll', fileVersion: 10.0.19041.1320
C:\WINDOWS\System32\WS2_32.dll:WS2_32.dll (00007FFC3DED0000), size: 438272 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\WS2_32.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL:IPHLPAPI.DLL (00007FFC3A950000), size: 241664 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\IPHLPAPI.DLL', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\WINHTTP.dll:WINHTTP.dll (00007FFC2CC80000), size: 1085440 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WINHTTP.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\GLU32.dll:GLU32.dll (00007FFC21090000), size: 180224 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\GLU32.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\HID.DLL:HID.DLL (00007FFC39DF0000), size: 53248 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\HID.DLL', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\dwmapi.dll:dwmapi.dll (00007FFC38BE0000), size: 192512 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dwmapi.dll', fileVersion: 10.0.19041.746
C:\WINDOWS\SYSTEM32\kernel.appcore.dll:kernel.appcore.dll (00007FFC38DC0000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\kernel.appcore.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\bcryptPrimitives.dll:bcryptPrimitives.dll (00007FFC3BD20000), size: 532480 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\bcryptPrimitives.dll', fileVersion: 10.0.19041.1415
C:\WINDOWS\system32\uxtheme.dll:uxtheme.dll (00007FFC389A0000), size: 647168 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\uxtheme.dll', fileVersion: 10.0.19041.1266
C:\WINDOWS\System32\shcore.dll:shcore.dll (00007FFC3E020000), size: 708608 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\shcore.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\windows.storage.dll:windows.storage.dll (00007FFC38FC0000), size: 7946240 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\windows.storage.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\Wldp.dll:Wldp.dll (00007FFC3AF00000), size: 180224 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\Wldp.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\profapi.dll:profapi.dll (00007FFC3BAD0000), size: 126976 (result: 0), SymType: '-nosymbols-', PDB: 'C:\WINDOWS\SYSTEM32\profapi.dll', fileVersion: 10.0.19041.844
C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\MonoBleedingEdge\EmbedRuntime\mono-2.0-bdwgc.dll:mono-2.0-bdwgc.dll (00007FFBE8F80000), size: 11177984 (result: 0), SymType: '-exported-', PDB: 'C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\MonoBleedingEdge\EmbedRuntime\mono-2.0-bdwgc.dll'
C:\WINDOWS\system32\mswsock.dll:mswsock.dll (00007FFC3AC50000), size: 434176 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\mswsock.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\NSI.dll:NSI.dll (00007FFC3C5B0000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\NSI.dll', fileVersion: 10.0.19041.610
C:\WINDOWS\SYSTEM32\dhcpcsvc6.DLL:dhcpcsvc6.DLL (00007FFC35B00000), size: 94208 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dhcpcsvc6.DLL', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\dhcpcsvc.DLL:dhcpcsvc.DLL (00007FFC35C10000), size: 118784 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dhcpcsvc.DLL', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\DNSAPI.dll:DNSAPI.dll (00007FFC3A990000), size: 827392 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\DNSAPI.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\system32\napinsp.dll:napinsp.dll (00007FFC1E380000), size: 94208 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\napinsp.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\system32\pnrpnsp.dll:pnrpnsp.dll (00007FFC1E360000), size: 110592 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\pnrpnsp.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\system32\wshbth.dll:wshbth.dll (00007FFC1E0B0000), size: 86016 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\wshbth.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\system32\NLAapi.dll:NLAapi.dll (00007FFC36980000), size: 118784 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\NLAapi.dll', fileVersion: 10.0.19041.1151
C:\WINDOWS\System32\winrnr.dll:winrnr.dll (00007FFC1E090000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\winrnr.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\MSCTF.dll:MSCTF.dll (00007FFC3C5C0000), size: 1138688 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\MSCTF.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\d3d11.dll:d3d11.dll (00007FFC37180000), size: 2506752 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\d3d11.dll', fileVersion: 10.0.19041.1202
C:\WINDOWS\SYSTEM32\dxgi.dll:dxgi.dll (00007FFC39E30000), size: 995328 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dxgi.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_3b12ac0f95b18b9d\nvldumdx.dll:nvldumdx.dll (00007FFC31280000), size: 1077248 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_3b12ac0f95b18b9d\nvldumdx.dll', fileVersion: 30.0.15.1179
C:\WINDOWS\SYSTEM32\msasn1.dll:msasn1.dll (00007FFC3B340000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\msasn1.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\cryptnet.dll:cryptnet.dll (00007FFC34EA0000), size: 200704 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\cryptnet.dll', fileVersion: 10.0.19041.906
C:\WINDOWS\SYSTEM32\drvstore.dll:drvstore.dll (00007FFC33670000), size: 1343488 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\drvstore.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\devobj.dll:devobj.dll (00007FFC3B960000), size: 208896 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\devobj.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\cryptbase.dll:cryptbase.dll (00007FFC3AD40000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\cryptbase.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\WINTRUST.DLL:WINTRUST.DLL (00007FFC3BDB0000), size: 425984 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\WINTRUST.DLL', fileVersion: 10.0.19041.1566
C:\WINDOWS\System32\imagehlp.dll:imagehlp.dll (00007FFC3C6E0000), size: 118784 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\imagehlp.dll', fileVersion: 10.0.19041.1415
C:\WINDOWS\SYSTEM32\CRYPTSP.dll:CRYPTSP.dll (00007FFC3B910000), size: 98304 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\CRYPTSP.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\system32\rsaenh.dll:rsaenh.dll (00007FFC3A600000), size: 212992 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\rsaenh.dll', fileVersion: 10.0.19041.1052
C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_3b12ac0f95b18b9d\nvwgf2umx.dll:nvwgf2umx.dll (00007FFC0D400000), size: 43175936 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_3b12ac0f95b18b9d\nvwgf2umx.dll', fileVersion: 30.0.15.1179
C:\WINDOWS\system32\nvspcap64.dll:nvspcap64.dll (00007FFC0D130000), size: 2895872 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\nvspcap64.dll', fileVersion: 3.23.0.74
C:\WINDOWS\SYSTEM32\ntmarta.dll:ntmarta.dll (00007FFC3B7F0000), size: 208896 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\ntmarta.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\dxcore.dll:dxcore.dll (00007FFC31390000), size: 241664 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dxcore.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\System32\clbcatq.dll:clbcatq.dll (00007FFC3C700000), size: 692224 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\clbcatq.dll', fileVersion: 2001.12.10941.16384
C:\WINDOWS\system32\wbem\wbemprox.dll:wbemprox.dll (00007FFC342A0000), size: 69632 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\wbem\wbemprox.dll', fileVersion: 10.0.19041.1320
C:\WINDOWS\SYSTEM32\wbemcomn.dll:wbemcomn.dll (00007FFC30120000), size: 589824 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\wbemcomn.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\system32\wbem\wbemsvc.dll:wbemsvc.dll (00007FFC2C5A0000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\wbem\wbemsvc.dll', fileVersion: 10.0.19041.1320
C:\WINDOWS\system32\wbem\fastprox.dll:fastprox.dll (00007FFC2C790000), size: 1093632 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\wbem\fastprox.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\amsi.dll:amsi.dll (00007FFC22750000), size: 102400 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\amsi.dll', fileVersion: 10.0.19041.746
C:\WINDOWS\SYSTEM32\USERENV.dll:USERENV.dll (00007FFC3BA50000), size: 188416 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\USERENV.dll', fileVersion: 10.0.19041.572
C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.2203.5-0\MpOav.dll:MpOav.dll (00007FFC21D30000), size: 503808 (result: 0), SymType: '-exported-', PDB: 'C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.2203.5-0\MpOav.dll', fileVersion: 4.18.2203.5
C:\WINDOWS\SYSTEM32\xinput1_3.dll:xinput1_3.dll (0000000000400000), size: 122880 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\xinput1_3.dll', fileVersion: 9.18.944.0
C:\WINDOWS\SYSTEM32\dcomp.dll:dcomp.dll (00007FFC37AF0000), size: 1986560 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dcomp.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\textinputframework.dll:textinputframework.dll (00007FFC31530000), size: 1019904 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\textinputframework.dll', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\CoreMessaging.dll:CoreMessaging.dll (00007FFC383C0000), size: 991232 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\CoreMessaging.dll', fileVersion: 10.0.19041.746
C:\WINDOWS\SYSTEM32\CoreUIComponents.dll:CoreUIComponents.dll (00007FFC38060000), size: 3530752 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\CoreUIComponents.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\wintypes.dll:wintypes.dll (00007FFC37990000), size: 1392640 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\wintypes.dll', fileVersion: 10.0.19041.1348
C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\Mimosa Simulator_Data\Plugins\x86_64\steam_api64.dll:steam_api64.dll (00007FFC354A0000), size: 278528 (result: 0), SymType: '-exported-', PDB: 'C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\Mimosa Simulator_Data\Plugins\x86_64\steam_api64.dll', fileVersion: 5.69.73.98
C:\WINDOWS\System32\PSAPI.DLL:PSAPI.DLL (00007FFC3DCE0000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\PSAPI.DLL', fileVersion: 10.0.19041.546
C:\Program Files (x86)\Steam\gameoverlayrenderer64.dll:gameoverlayrenderer64.dll (00007FFBFC790000), size: 1953792 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Steam\gameoverlayrenderer64.dll', fileVersion: 7.15.2.67
C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\Mimosa Simulator_Data\Plugins\x86_64\fmodstudioL.dll:fmodstudioL.dll (00007FFBDCA60000), size: 4415488 (result: 0), SymType: '-exported-', PDB: 'C:\UnityProjects\MPVCG\Builds\Mimosa Simulator\Mimosa Simulator_Data\Plugins\x86_64\fmodstudioL.dll', fileVersion: 0.2.2.4
C:\WINDOWS\SYSTEM32\MSACM32.dll:MSACM32.dll (00007FFC2C080000), size: 122880 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\MSACM32.dll', fileVersion: 10.0.19041.1
C:\WINDOWS\SYSTEM32\winmmbase.dll:winmmbase.dll (00007FFC09DA0000), size: 155648 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\winmmbase.dll', fileVersion: 10.0.19041.1
C:\WINDOWS\System32\MMDevApi.dll:MMDevApi.dll (00007FFC34DC0000), size: 544768 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\MMDevApi.dll', fileVersion: 10.0.19041.1503
C:\WINDOWS\SYSTEM32\AUDIOSES.DLL:AUDIOSES.DLL (00007FFC35010000), size: 1581056 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\AUDIOSES.DLL', fileVersion: 10.0.19041.1566
C:\WINDOWS\SYSTEM32\powrprof.dll:powrprof.dll (00007FFC3B7A0000), size: 307200 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\powrprof.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\UMPDC.dll:UMPDC.dll (00007FFC3B240000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\UMPDC.dll'
C:\WINDOWS\SYSTEM32\resourcepolicyclient.dll:resourcepolicyclient.dll (00007FFC38AB0000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\resourcepolicyclient.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\wlanapi.dll:wlanapi.dll (00007FFC34EE0000), size: 475136 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\wlanapi.dll', fileVersion: 10.0.19041.1266
C:\Program Files (x86)\Steam\steamclient64.dll:steamclient64.dll (00007FFBC5F60000), size: 22147072 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Steam\steamclient64.dll', fileVersion: 7.15.2.67
C:\Program Files (x86)\Steam\tier0_s64.dll:tier0_s64.dll (00007FFC35510000), size: 1527808 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Steam\tier0_s64.dll', fileVersion: 7.15.2.67
C:\Program Files (x86)\Steam\vstdlib_s64.dll:vstdlib_s64.dll (00007FFC34D30000), size: 528384 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Steam\vstdlib_s64.dll', fileVersion: 7.15.2.67
C:\WINDOWS\SYSTEM32\Secur32.dll:Secur32.dll (00007FFC204A0000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\Secur32.dll', fileVersion: 10.0.19041.546
C:\WINDOWS\SYSTEM32\SSPICLI.DLL:SSPICLI.DLL (00007FFC3BA80000), size: 204800 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\SSPICLI.DLL', fileVersion: 10.0.19041.1586
C:\WINDOWS\SYSTEM32\dbghelp.dll:dbghelp.dll (00007FFC3B5B0000), size: 1982464 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dbghelp.dll', fileVersion: 10.0.19041.867
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBDCB1B362)
0x00007FFBDCB1B362 (fmodstudioL) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBDCB195BF)
0x00007FFBDCB195BF (fmodstudioL) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBDCB2C2B6)
0x00007FFBDCB2C2B6 (fmodstudioL) (function-name not available)
  ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBDCAF7FDF)
0x00007FFBDCAF7FDF (fmodstudioL) (function-name not available)
0x00007FFBDCBAF46A (fmodstudioL) FMOD_Studio_VCA_SetVolume
0x00007FFBDCBB003A (fmodstudioL) FMOD_Studio_VCA_SetVolume
0x00007FFBDCCBD241 (fmodstudioL) FMOD_File_SetDiskBusy
0x00007FFBDCCC6B57 (fmodstudioL) FMOD_Thread_SetAttributes
0x00007FFBDCD501A4 (fmodstudioL) FMOD::SystemI::createMemoryFile
0x00007FFC3DD97034 (KERNEL32) BaseThreadInitThunk
0x00007FFC3E4C2651 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========


A crash has been intercepted by the crash handler. For call stack and other details, see the latest crash report generated in:
 * C:/Users/Myles/AppData/Local/Temp/Confusionware LLC/Mimosa Simulator/Crashes
[FMOD] OutputWASAPI::mixerThread : Starvation detected in WASAPI output buffer!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeUtils:DebugLogWarning (string) (at C:/UnityProjects/MPVCG/Assets/Plugins/FMOD/src/RuntimeUtils.cs:533)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at C:/UnityProjects/MPVCG/Assets/Plugins/FMOD/src/RuntimeManager.cs:86)

(Filename: C:/UnityProjects/MPVCG/Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 533)

[FMOD] OutputWASAPI::mixerThread : Starvation detected in WASAPI output buffer!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)
FMODUnity.RuntimeUtils:DebugLogWarning (string) (at C:/UnityProjects/MPVCG/Assets/Plugins/FMOD/src/RuntimeUtils.cs:533)
FMODUnity.RuntimeManager:DEBUG_CALLBACK (FMOD.DEBUG_FLAGS,intptr,int,intptr,intptr) (at C:/UnityProjects/MPVCG/Assets/Plugins/FMOD/src/RuntimeManager.cs:86)

(Filename: C:/UnityProjects/MPVCG/Assets/Plugins/FMOD/src/RuntimeUtils.cs Line: 533)

Thank you for the extra info, it looks like the programmer sound isn’t being destroyed. This aligns with what you were saying before about the DESTROY_PROGRAMMER_SOUND callback not firing, which is the next question to figure out.
Can you please try re-implementing DESTROY_PROGRAMMER_SOUND inside your callback and confirm whether it ever gets hit?

The DESTROY_PROGRAMMER_SOUND callback is firing now because its no longer being garbage collected. However I eventually get the same errors after joining and exiting game sessions in the build.

I’ve noticed that I need to use FMOD.Studio.STOP_MODE.ALLOWFADEOUT otherwise I get this warning in the console which leads me to believe its not actually releasing the sounds.

This happens when I call eventInstance.release() in both cases of before or after stopping the instance

[FMOD] EventInstance::flushReleaseQueue : Event instance has programmer sounds pending release, update thread will be blocked until programmer sounds are released.

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)

The callback in my code isn’t static because I’m creating the sound using info from when the script starts.
Could this be causing the issue or should it technically work?

The AOT.MonoPInvokeCallback attribute, which is needed to safely access unmanaged memory, does have a requirement to be on static methods. Any local data you need in this callback can be passed into EventInstance.setUserData- you can see how data is passed in and retrieved from the dialogueInstance in the Programmer Sounds Example.

How am I supposed to set the PcmReadCallback when the programmer callback is static? I tried setting the outputSound.handle as the user data but it still seems to not be getting released correctly.

No crashes detected so far after making that change, I only get this same warning on releasing the instance using IMMEDIATE mode:
[FMOD] EventInstance::flushReleaseQueue : Event instance has programmer sounds pending release, update thread will be blocked until programmer sounds are released.

I am not sure I understand the issue here, can you please clarify what you mean? You can still have non-static instances of a static callback. The Programmer Sounds Example, for example has:

class ScriptUsageProgrammerSounds : MonoBehaviour
{
    FMOD.Studio.EVENT_CALLBACK dialogueCallback;
    ...
    Start()
    {
        dialogueCallback = new FMOD.Studio.EVENT_CALLBACK(DialogueEventCallback);
    }
    ...
    static FMOD.RESULT DialogueEventCallback(FMOD.Studio.EVENT_CALLBACK_TYPE type, IntPtr instancePtr, IntPtr parameterPtr)
    {
        ...
    }
    ...
}

You can release most things safely in the FMOD.Studio.EVENT_CALLBACK_TYPE.DESTROYED callback since nothing else should be needing it anymore.

Edit: The crashes still seem to be happening but very infrequently when leaving a game.

I’m still also getting this in the console when using IMMEDIATE stop mode and calling release before it. [FMOD] EventInstance::flushReleaseQueue : Event instance has programmer sounds pending release, update thread will be blocked until programmer sounds are released.

Right now I am calling RuntimeManager.CoreSystem.CreateSound() when the script initializes and outputting the sound to a private member variable.

Then im using instance.SetUserData() to send the sound handle intptr to the callback where I assign it as properties.sound.

Should I be calling CreateSound() within the static VoiceEventCallback instead of sending the int ptr from my unity script? If so, how am I supposed to assign the PcmReadCallback to it?