FMOD_System_Init fails in presence of USB MIDI device

When I try to run an application that makes use of FMOD 5 while I have my USB MIDI adapter plugged in, FMOD_System_Init returns FMOD_ERR_OUTPUT_INIT and produces the following output:

[LOG] SystemI::init : FMOD Studio Version: 00010904 (86084) [LOG] SystemI::init : maxchannels = 50, flags = 00000000, extradriverdata = (nil) [LOG] SystemI::setOutputInternal : Setting output to type 0 [LOG] SystemI::setOutputInternal : Setting output to type 11 [LOG] OutputALSA::registerLib : Loaded ALSA version 1.0.24.1. [LOG] OutputALSA::enumerate : Found device NAME:null IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:default:CARD=NVidia IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:front:CARD=NVidia,DEV=0 IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:surround40:CARD=NVidia,DEV=0 IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:surround41:CARD=NVidia,DEV=0 IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:surround50:CARD=NVidia,DEV=0 IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:surround51:CARD=NVidia,DEV=0 IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:surround71:CARD=NVidia,DEV=0 IOID:(null). [LOG] OutputALSA::enumerate : Found device NAME:iec958:CARD=NVidia,DEV=0 IOID:Output. [LOG] OutputALSA::enumerate : Found device NAME:hdmi:CARD=NVidia,DEV=0 IOID:Output. [LOG] OutputALSA::enumerate : Found device NAME:default:CARD=VIEWCON IOID:(null). [LOG] SystemI::setOutputInternal : Setting output to type 11 ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave [ERR] OutputALSA::init : snd_pcm_open returned -2 = No such file or directory. [LOG] SystemI::close : [LOG] SystemI::close : Stop all sounds [LOG] SystemI::close : Free software output. [LOG] SystemI::close : done.

As you can see, there are two devices called defaut. The second is the USB MIDI adapter.
With strace I can see that FMOD tries to open /dev/pcmC1D0p, but card 1 is MIDI only.

Thanks for the bug report, it looks like FMOD is finding the last instance of “default” and making that our default. I believe we should be using the first instance to follow the best practice for defaults with ALSA.

I’ll have this fixed for a future release.

If you’re in a position to make changes to the code base, using System::setDriver will allow you to direct FMOD to any attached device.

The problem is not that FMOD picks the last “default”.
The problem is that it sticks to devices which are unsuitable.
It should simply skip all devices which don’t support PCM output.

FMOD will enumerate all devices ALSA refers to as PCMs capable of output. This should be consistent with the output from aplay --list-pcms the ALSA helper utility. In this case it looks like ALSA is telling us the device supports output but for whatever reason it fails in your case. This could be a configuration issue with the ALSA setup or driver.