Prevent audio switching to PS4 controller when plugged in

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)”.

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

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.

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

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).