# Prevent audio switching to PS4 controller when plugged in

**URL:** <https://qa.fmod.com/t/prevent-audio-switching-to-ps4-controller-when-plugged-in/18599>\
**Category:** FMOD Engine\
**Created:** [March 30, 2022, 6:06pm UTC](https://qa.fmod.com/t/prevent-audio-switching-to-ps4-controller-when-plugged-in/18599 "2022-03-30T18:06:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rustymoyher](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/rustymoyher/32/981_2.png) [@rustymoyher](https://qa.fmod.com/u/rustymoyher)\
**Post date:** [March 30, 2022, 6:06pm UTC](https://qa.fmod.com/t/prevent-audio-switching-to-ps4-controller-when-plugged-in/18599/1 "2022-03-30T18:06:55Z")

</div>

When we plug in a PS4 or PS5 controller, the audio for our game switches to the speaker on the controller. Normally using the default audio device seems like a good idea, like if we plug in or remove headphones. However using the PS4 or PS5 controller speaker for audio on PC/Mac is rarely ever desired (I think). Is there a way to disable this or work around it?

We’ve seen this issue on Windows, but may happen on Mac too. I believe the device in Windows calls this “Speaker (Wireless Controller)”.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [March 31, 2022, 1:20am UTC](https://qa.fmod.com/t/prevent-audio-switching-to-ps4-controller-when-plugged-in/18599/2 "2022-03-31T01:20:11Z")

</div>

You need to override the automatic device switching feature. You can read more about how to do this here:

[https://www.fmod.com/resources/documentation-api?version=2.02&page=core-guide.html#audio-devices-automatic-detection-of-device-insertion-removal](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-guide.html#audio-devices-automatic-detection-of-device-insertion-removal)

---

<div class="post-metadata">

**Author:** ![rustymoyher](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/rustymoyher/32/981_2.png) [@rustymoyher](https://qa.fmod.com/u/rustymoyher)\
**Post date:** [March 31, 2022, 6:06pm UTC](https://qa.fmod.com/t/prevent-audio-switching-to-ps4-controller-when-plugged-in/18599/3 "2022-03-31T18:06:33Z")

</div>

Hi Richard,

Thanks for the reply! Hmm, yes, I could see hooking into `FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED`. However if I go this path I think it’s in full manual mode. According to the documentation:

> FMOD\_SYSTEM\_CALLBACK\_DEVICELISTCHANGED will disable any automated device ejection/insertion handling. Use this callback to control the behavior yourself.

I want to replicate this automatic behavior, but just override it slightly. Something like this pseudo code:

```
if (newDevice == PS4/PS5 controller) {
	Don’t switch to it
} else {
	Do the normal switching
}

```

How complex is the normal behavior? Can you share the implementation so I can replicate it in the override? (No worries if that’s not something you want to share.)

I wonder if I should instead report this as an FMOD bug? Seems like an issue with most any game. Or perhaps as a Windows bug? Curious about anyone else’s thoughts on this too.

---

<div class="post-metadata">

**Author:** ![richard\_simms](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/richard_simms/32/261_2.png) [@richard\_simms](https://qa.fmod.com/u/richard_simms)\
**Post date:** [April 4, 2022, 2:32am UTC](https://qa.fmod.com/t/prevent-audio-switching-to-ps4-controller-when-plugged-in/18599/4 "2022-04-04T02:32:11Z")

</div>

It’s not overly complicated, it uses the `FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED` callback and then you can use `getDriverInfo` to pull the name from it.

[https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-system.html#system\_getdriverinfo](https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-system.html#system_getdriverinfo)

Check if the name is “Speaker (Wireless Controller” and stick to the current output device if it is.

We unfortunately can’t share the implementation as that is part of the source code.

This isn’t exactly a bug - both Windows and FMOD are designed to automatically swap to a new audio output device if it’s plugged in after starting (for example, plugging in headphones). The issue is that the speakers are part of the controller being plugged in (the same thing happens for the microphone on the controller).
