# \[Win10\] FMOD 2.0 not automatically switching output / detecting device changes in certain cases, with description

**URL:** <https://qa.fmod.com/t/win10-fmod-2-0-not-automatically-switching-output-detecting-device-changes-in-certain-cases-with-description/17905>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [November 4, 2021, 6:55pm UTC](https://qa.fmod.com/t/win10-fmod-2-0-not-automatically-switching-output-detecting-device-changes-in-certain-cases-with-description/17905 "2021-11-04T18:55:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeZ1](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MikeZ1](https://qa.fmod.com/u/MikeZ1)\
**Post date:** [November 4, 2021, 6:55pm UTC](https://qa.fmod.com/t/win10-fmod-2-0-not-automatically-switching-output-detecting-device-changes-in-certain-cases-with-description/17905/1 "2021-11-04T18:55:54Z")

</div>

Hello, I have a Windows 10 laptop (ROG Ryzen 9) and I’ve encountered a case where FMOD 2.0 (October 2021 code) seems not to detect devices changing at all. FMOD both fails to automatically switch output to the new device, and doesn’t trigger either a `FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED` callback (also no `FMOD_SYSTEM_CALLBACK_DEVICELOST` callback).

Diagnosis:

- If I run the program without headphones plugged into the jack (not USB), then plug them in, FMOD correctly detects the device change. It switches output to the headphones and generates the callback.  
From there I can unplug/replug them and it works each time, FMOD switches output, etc.
- If I run the program _with_ headphones plugged in, then unplug them, FMOD will not detect the device change nor switch output to the speaker. It will also not detect plugging them in again or any further changes, so sound is completely lost until the program is closed and re-run.

All other programs (Chrome, Media Player, Winamp, etc.) correctly detect the device change and switch between speakers and headphones. This may be an internal FMOD situation?

Thank you,  
Mike

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [November 5, 2021, 6:39am UTC](https://qa.fmod.com/t/win10-fmod-2-0-not-automatically-switching-output-detecting-device-changes-in-certain-cases-with-description/17905/2 "2021-11-05T06:39:33Z")

</div>

Can you please share a code snippet of your device change callback and where you are setting it? It does sound like a bug if it isn’t behaving the same for starting plugged in and starting unplugged.  
Can you please provide a full FMOD version, i.e 2.01.11, so I can reproduce it?

---

<div class="post-metadata">

**Author:** ![MikeZ1](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@MikeZ1](https://qa.fmod.com/u/MikeZ1)\
**Post date:** [November 5, 2021, 4:40pm UTC](https://qa.fmod.com/t/win10-fmod-2-0-not-automatically-switching-output-detecting-device-changes-in-certain-cases-with-description/17905/3 "2021-11-05T16:40:45Z")

</div>

The callback is very simple, and I only added it to help diagnose the behavior of FMOD not auto-switching:

```auto
FMOD_RESULT F_CALLBACK DeviceListChangedCallback(FMOD_SYSTEM * /*system*/, FMOD_SYSTEM_CALLBACK_TYPE /*type*/, void *, void *, void *userData)
{
	OutputDebugStringA("FMOD: Device list changed.\n");
	return FMOD_OK;
}

```

```auto
	FMOD_RESULT result = pFMOD_CORE_SYSTEM->setCallback(&DeviceListChangedCallback, FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED
		| FMOD_SYSTEM_CALLBACK_DEVICELOST
		| FMOD_SYSTEM_CALLBACK_DEVICEREINITIALIZE);
	if(result != FMOD_OK)
	{
		OutputDebugStringA("FMOD error setting device-list-changed callback: (%d) %s\n", result, FMOD_ErrorString(result));
		exit(-1);
	}

```

Revision.txt has

```auto
9/9/21 2.02.03 - Studio API minor release (build 120077)

```

And [this is the laptop](https://www.bestbuy.com/site/asus-rog-zephyrus-g14-14-gaming-laptop-amd-ryzen-9-16gb-memory-nvidia-geforce-rtx-2060-max-q-1tb-ssd-moonlight-white/6403816.p?skuId=6403816).

If you’d like, I can run a debug version of the lib that you build with any extra logging info, to help diagnose the problem.

Mike

---

<div class="post-metadata">

**Author:** ![jeff\_fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/jeff_fmod/32/1766_2.png) [@jeff\_fmod](https://qa.fmod.com/u/jeff_fmod)\
**Post date:** [November 9, 2021, 3:20am UTC](https://qa.fmod.com/t/win10-fmod-2-0-not-automatically-switching-output-detecting-device-changes-in-certain-cases-with-description/17905/4 "2021-11-09T03:20:32Z")

</div>

Thanks for the extra info- all looks fine there. One thing to check is that you aren’t setting the callback before `FMOD::System_Create` otherwise it won’t be registered.  
Other than that, setting an FMOD\_SYSTEM\_CALLBACK\_DEVICELISTCHANGED or FMOD\_SYSTEM\_CALLBACK\_ALL callback means you need to handle device changes yourself. Do you have another callback somewhere set to the default of FMOD\_SYSTEM\_CALLBACK\_ALL?

If not, to work backwards from the problem I suggest you try changing your callback type to FMOD\_SYSTEM\_CALLBACK\_ALL and see if that ever gets called. If not, can you please try running the user\_created\_sound or programmer\_sound example and see if the callbacks in either of those gets fired?
