FMOD.System.getDriver is unreliable after the default device is changed on Windows

Hello everyone !

I think I’ve encountered a bug if FMOD.System when changing the default device on Windows when setCallback is used to handle FMOD.SYSTEM_CALLBACK_TYPE.DEVICELISTCHANGED.

Our setup in Unity lets users choose on which device they want the sound to be output to.
Let’s say they chose “system default” which means the device we want to output to will always be the first one in the drivers list.

The drivers list initially looks like this:

  • 0: DEVICE A
  • 1: DEVICE B
  • 2: DEVICE C

The user then changes the default device from DEVICE A to DEVICE C through the Windows OS UI.

Once the system callback is called with type=DEVICELISTCHANGED, the drivers list now looks like this.

  • 0: DEVICE C
  • 1: DEVICE A
  • 2: DEVICE B

After the callback is called, I enumerate the drivers with getNumDrivers and getDriverInfo and the list is as expected: the first driver is the new default device (DEVICE C).

FMOD still outputs sounds on the previous device (DEVICE A) which is expected since I didn’t do anything to change the output device yet.

But getDriver doesn’t return the new index of DEVICE A (which should be 1 in this example), it continues to return 0.

The only way I could find to have getDriver return the correct value is to call setOutput(None) and setOutput(whatever the previous value was). But this is not ideal since it cuts off the sound every time something happens with the device configuration.

I hope someone can have a look at this and check if it is indeed a bug or if I’m missing something regarding custom device handling.

Thanks in advance.

PS: we’re using version 2.01.10

System::getDriver is supposed to reflect System::setDriver rather than the currently used output device. Ie. The default for setDriver is zero which represents the default OS device. Calling getDriver will return zero which means you are using the default output device for the OS, instead of specifying a particular output.

FMOD will normally use the same output as the OS when using the default, the exception is when you override the FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED callback:

FMOD_SYSTEM_CALLBACK_TYPE

Using FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED (Windows only) will disable any automated device ejection/insertion handling. Use this callback to control the behavior yourself.

Thank you for your answer.

As a follow-up, is there any way to ask the FMOD system which device or driver is currently used as an output? Or must it be tracked by our own code?