How do you change the sound device a particular application is using for its audio output? I never bothered to think about this question, until the times of the shared home office.
True, in Windows you can change the default sound device, and an application that is started afterwards will use that device. But changing the sound device for a running application? It seems there is no built-in way to do that.
For Windows 7 and higher, I found the SoundSwitch applet (GitHub), which does just that. Located in the notification area, it lets you select the sound device the current application outputs its audio to. Simply click on its icon and select the device, or press a customizable hotkey.
Problems solved 😉
During preparation of this post, I tried to figure out how SoundSwitch actually switches the audio device.
It turns out that it uses the function call
SetPersistedDefaultAudioEndpoint() which is also used by an application called EarTrumpet (GitHub) that tags itself as “Volume control for Windows”, but also seems to allow switching audio devices.
A review of this application by Scott Hanselman indicates that the method and its interface are not officially documented:
Internal Audio Interface: IAudioPolicyConfigFactory
Gets them access to new APIs (GetPersistedDefaultAudioEndpoint / SetPersistedDefaultAudioEndpoint) in RS4 that let’s them ‘redirect’ apps to different playback devices. Same API used in modern sound settings.
Code here with no public API yet?