# Crash on FMOD\_System\_Close with ASIO

**URL:** <https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036>\
**Category:** FMOD Engine\
**Created:** [August 25, 2024, 9:09pm UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036 "2024-08-25T21:09:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Controller1](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Controller1](https://qa.fmod.com/u/Controller1)\
**Post date:** [August 25, 2024, 9:09pm UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/1 "2024-08-25T21:09:10Z")

</div>

Everything works fine in the project, except it crashes with FMOD\_OUTPUTTYPE\_ASIO when quitting. Switching to FMOD\_OUTPUTTYPE\_WASAPI, the issue is gone.

I stripped almost all code to find the issue. Crashes about 50% when testing:

```auto
EnableExplicit

#FMOD_VERSION = $00020223
Enumeration
  #FMOD_OUTPUTTYPE_AUTODETECT
  #FMOD_OUTPUTTYPE_UNKNOWN
  #FMOD_OUTPUTTYPE_NOSOUND
  #FMOD_OUTPUTTYPE_WAVWRITER
  #FMOD_OUTPUTTYPE_NOSOUND_NRT
  #FMOD_OUTPUTTYPE_WAVWRITER_NRT
  #FMOD_OUTPUTTYPE_WASAPI
  #FMOD_OUTPUTTYPE_ASIO
  #FMOD_OUTPUTTYPE_PULSEAUDIO
  #FMOD_OUTPUTTYPE_ALSA
  #FMOD_OUTPUTTYPE_COREAUDIO
  #FMOD_OUTPUTTYPE_AUDIOTRACK
  #FMOD_OUTPUTTYPE_OPENSL
  #FMOD_OUTPUTTYPE_AUDIOOUT
  #FMOD_OUTPUTTYPE_AUDIO3D
  #FMOD_OUTPUTTYPE_WEBAUDIO
  #FMOD_OUTPUTTYPE_NNAUDIO
  #FMOD_OUTPUTTYPE_WINSONIC
  #FMOD_OUTPUTTYPE_AAUDIO
  #FMOD_OUTPUTTYPE_AUDIOWORKLET
  #FMOD_OUTPUTTYPE_PHASE
; #FMOD_OUTPUTTYPE_MAX
  EndEnumeration

#FMOD_OK = 0

CoInitializeEx_(0, #COINIT_APARTMENTTHREADED)
Define *hDLL = OpenLibrary(#PB_Any, "fmod.dll")
If *hDLL
  Define *hSystem
  If CallFunction(*hDLL, "FMOD_System_Create", @*hSystem, #FMOD_VERSION) = #FMOD_OK
    If *hSystem
      Sleep_(1)
      If CallFunction(*hDLL, "FMOD_System_SetOutput", *hSystem, #FMOD_OUTPUTTYPE_ASIO) = #FMOD_OK
        Sleep_(1)
        If CallFunction(*hDLL, "FMOD_System_SetDriver", *hSystem, 0) = #FMOD_OK
          Sleep_(1)
          If CallFunction(*hDLL, "FMOD_System_Init", *hSystem, 256, 0, 0) = #FMOD_OK
            Sleep_(1)
            Define.i hWin = OpenWindow(#PB_Any, 0, 0, 1024, 264, "LineSpec Test Window")
            Repeat
              Select WindowEvent()
                Case #PB_Event_CloseWindow
                  Break
                EndSelect
              ForEver
            EndIf
          EndIf
        EndIf
      Sleep_(1)
Debug "Releasing..."
      CallFunction(*hDLL, "FMOD_System_Close", *hSystem)
Debug "Released"
      Sleep_(1)
      CallFunction(*hDLL, "FMOD_System_Release", *hSystem)
      Sleep_(1)
      EndIf
    EndIf
  CloseLibrary(*hDLL)
  EndIf
CoUninitialize_()
Debug "Quit"

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 26, 2024, 6:02am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/2 "2024-08-26T06:02:50Z")

</div>

Hi,

Thank you for bringing this to our attention.

Unfortunately, testing in our core API examples I couldn’t reproduce the issue. Are you able to reproduce the issue in our examples? On a windows they can be found here: `"C:\Program Files (x86)\FMOD SoundSystem\FMOD Studio API Windows\api\core\examples\vs2019\examples.sln"`.

How would I test your code? Any reproduction steps would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Controller1](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Controller1](https://qa.fmod.com/u/Controller1)\
**Post date:** [August 26, 2024, 11:14am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/3 "2024-08-26T11:14:15Z")

</div>

Seems this error (sometimes?) has some big impact.  
Didn’t crash anymore, but had no sound at all with the ASIO audio device. Sometimes no playback progress, or progress stopping after some time due no reason. After switching the device off, playback progress continued _bumb_

Finally decided to reboot the PC to fix this.

Now another reboot, immediately running VS…

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/2X/e/e31db581c3d0d0298b627a8e12a292645ba921ea.png)

I’d guess this could be some driver issue? Maybe any idea, or some info what’s the exact issue, so I can contact the vendor - so I wonder if the device is supported anymore.

```auto
/*==============================================================================
Play Sound Example
Copyright (c), Firelight Technologies Pty, Ltd 2004-2024.

This example shows how to simply load and play multiple sounds, the simplest 
usage of FMOD. By default FMOD will decode the entire file into memory when it
loads. If the sounds are big and possibly take up a lot of RAM it would be
better to use the FMOD_CREATESTREAM flag, this will stream the file in realtime
as it plays.

For information on using FMOD example code in your own programs, visit
https://www.fmod.com/legal
==============================================================================*/
#include "fmod.hpp"
#include "common.h"

int FMOD_Main()
{
    FMOD::System *system;
    FMOD_RESULT result;
    void *extradriverdata = 0;
    
    Common_Init(&extradriverdata);

    /*
        Create a System object and initialize
    */
    result = FMOD::System_Create(&system, FMOD_VERSION);
    ERRCHECK(result);

    /* Changes ... Running VS22 community with VS19 build tools ... running x64 */
    // Added...
    result = system->setOutput(FMOD_OUTPUTTYPE_ASIO);
    ERRCHECK(result);

    // Added...
    result = system->setDriver(0);
    ERRCHECK(result);

    /* End changes */

    result = system->init(32, FMOD_INIT_NORMAL, extradriverdata);
    ERRCHECK(result);

// Common_Update();
// result = system->update();
// ERRCHECK(result);

// Common_Sleep(50);

    /*
        Shut down
    */
    result = system->close();
    ERRCHECK(result);
    result = system->release();
    ERRCHECK(result);

    Common_Close();

    return 0;
}

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 27, 2024, 1:09am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/4 "2024-08-27T01:09:54Z")

</div>

Thank you for the information and the code.

Would it be possible to run DxDiag? Instructions can be found here: [Open and run DxDiag.exe - Microsoft Support](https://support.microsoft.com/en-au/windows/open-and-run-dxdiag-exe-dad7792c-2ad5-f6cd-5a37-bf92228dfd85). The results can be uploaded to your profile here: [FMOD | Profile - Upload](https://fmod.com/profile#uploads). Please note you will have to register a project with us to be able to upload files.

What device are you trying to output to with the call `result = system->setDriver(0);`? What version of the FMOD engine are you using?

---

<div class="post-metadata">

**Author:** ![Controller1](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Controller1](https://qa.fmod.com/u/Controller1)\
**Post date:** [August 27, 2024, 1:29pm UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/5 "2024-08-27T13:29:54Z")

</div>

> [@](#):
>
> Would it be possible to run DxDiag?

DxDiag download link here:  
[Link](https://2024.shared.ctstudio.net/DxDiag_20240827.txt)

**Notes:**  
Think this after the VS test crash issue. Did a quick check after the DxDiag, and sound output was ok, crash as usual. If you need a specific DxDiag.txt - before a crash, after a crash or when in no-sound-state - Let me know.

**Page File: 16907MB used, 81577MB available**  
Aktually, Windows is set to: “Total paging file size for all drives: 386 MB”, and there only is a page file on drive C: with around 386 MB. No pagefile on any other drive. Guess this number includes the physical RAM? Have such wrong values since Windows XP.

**+++ WER4 +++ Event Name: GDIObjectLeak P1: explorer.exe**  
Before having 96 GB Ram, the system sometimes had out of memory issues with explorer reserving up to 40 GB Ram. I want upgrade to 128 GB, but the BIOS has huge issues with RAM making it hard to get the latest setup working without memory corruptions occurring. No out of memory issues unless when heavy surfing with Firefox 🙂 !

> [@](#):
>
> What device are you trying to output to with the call `result = system->setDriver(0);`? What version of the FMOD engine are you using?

Due the ASIO issues, the fmod.dll for the project was recently updated (from 2.02.18) to 2.02.23. The Visual Studio project test is 2.02.23 (fmodstudioapi20223win-installer.exe)

The device is “ADJ ASIO” (American Audio 14MXR)  
[09:31:54] [Debug] FMOD: ASIO-device 0: ADJ ASIO  
[09:31:54] [Debug] FMOD: ASIO-device 1: DUO-CAPTURE EX  
[Log excerp, modified](https://2024.shared.ctstudio.net/FMod%20TestApp%20Log%20-%20excerpt,%20minor%20changes.txt)

Some positive news: Tried the project yesterday when visiting a friend on a more professional gear, and there were no issues (so far). 😃

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 28, 2024, 3:21am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/6 "2024-08-28T03:21:49Z")

</div>

Thank you for the DxDiag, I was mainly looking into your connected output devices which FMOD may be trying to access. As you mentioned there are two that FMOD has identified.

Where did you get the log file from? I can see two FMOD systems attempting to initialize using both the `ADJ ASIO` device and the `DUO-CAPTURE EX` device.

```auto
FMOD: Creating system on ASIO-device 0: ADJ ASIO (channels 0/1)
FMOD: Creating system on AUTODETECT-device 0: OUT (DUO-CAPTURE EX)

FMOD: Closing system on AUTODETECT-device 0: OUT (DUO-CAPTURE EX)
FMOD: Closing system on ASIO-device 0: ADJ ASIO (channels 2/3)

```

Would it be possible that having two systems running simultaneously could be causing the issue?

> [@Controller1](#):
>
> Some positive news: Tried the project yesterday when visiting a friend on a more professional gear, and there were no issues (so far).

That is good to hear! Is there anything immediately obvious that would not cause the crash on their device?

---

<div class="post-metadata">

**Author:** ![Controller1](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Controller1](https://qa.fmod.com/u/Controller1)\
**Post date:** [August 28, 2024, 9:46pm UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/7 "2024-08-28T21:46:33Z")

</div>

The real project uses FMOD multiple times. First temporarily for enumerating, two for audio players, two for tag reading / getting wave-data (no output, separate threads). No issues so far, except since the change to ASIO. BTW; using two ASIO system with FMOD.

> [@](#):
>
> Would it be possible that having two systems running simultaneously could be causing the issue?

To find the issues, we ended up creating the small test program. as posted above.  
Could be a driver issue. Only had the device for a few days (for testing / coding ASIO subchannels support and reusing ASIO device / sound system) and will give it back on Thursday.  
Are there some debug info files (pdb or so) to get further info?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 29, 2024, 1:50am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/8 "2024-08-29T01:50:09Z")

</div>

Thank you for the information. Sounds like the multiple systems are not the issue.

> [@Controller1](#):
>
> To find the issues, we ended up creating the small test program.

Would it be possible to upload this program to your profile?

> [@Controller1](#):
>
> Are there some debug info files (pdb or so) to get further info?

Unfortunately, we cannot share the PDBs. Rather, could I get a crash dump to go through on my side?

---

<div class="post-metadata">

**Author:** ![Controller1](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Controller1](https://qa.fmod.com/u/Controller1)\
**Post date:** [August 29, 2024, 3:05am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/9 "2024-08-29T03:05:22Z")

</div>

Here you go!  
[Minidump](https://2024.shared.ctstudio.net/play_soundL_Minidump.dmp)  
[Minidump with heap](https://2024.shared.ctstudio.net/play_soundL_MinidumpWithHeap.dmp)

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [September 4, 2024, 4:25am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/10 "2024-09-04T04:25:43Z")

</div>

Thank you, I have been able to confirm the issue is with the 14 MXR drivers. I will pass on the issue to our development team to investigate further. Are you able to use any other drivers in the meantime?

---

<div class="post-metadata">

**Author:** ![Controller1](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@Controller1](https://qa.fmod.com/u/Controller1)\
**Post date:** [September 21, 2024, 12:42am UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/11 "2024-09-21T00:42:51Z")

</div>

Hello, only had the device for a few days for testing. If needed I can lend the device again. If you want I can contact the manufacturer about the issue, maybe with a link to this forum post. As it’s pretty obviously a driver issue, I don’t want to bother you to much with the issue.

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [September 22, 2024, 10:44pm UTC](https://qa.fmod.com/t/crash-on-fmod-system-close-with-asio/22036/12 "2024-09-22T22:44:19Z")

</div>

The issue is indeed with a non-compliant ASIO driver, but I have found a sufficient workaround. 2.02.25 will include the fix/workaround allowing interaction with the driver without crash.
