Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default audio device on Windows 7

Tags:

I want to be able to change the default audio output device on Windows 7 programatically using C# (and probably some underlying Win32 API calls, as well). I've already done my homework, and I've heard a lot of mixed comments from different sources, so I wanted to ask this question again to get a straight answer. Is this actually possible (through any means)? If so, how would I go about doing this?

And please do not suggest a solution with "AutoIt" or some other similar program... this is a C#/.NET-specific question.

like image 861
qJake Avatar asked May 30 '11 17:05

qJake


People also ask

How do I change my primary audio device?

Here's how: In the search box on the taskbar, type control panel, then select it from the results. Select Hardware and Sound from the Control Panel, and then select Sound. On the Playback tab, select and hold (or right-click) the listing for your audio device, select Set as Default Device, and then select OK.


1 Answers

A little up-to-date answer, which is compatible with Windows 10.

This program is able to do it in a beautiful manner (hotkey to switch between pre-selected devices) and is written on C# : SoundSwitch on GitHub

Some reverse engineering should get you there (for my use this program was just perfect as it is).

It makes use of that library (same author) which is in C++ : AudioEndpointLibrary on GitHub

So if you know C++ (which I don't enough), you might go further in the analysis of how it works. Or just use the library like SoundSwitch does.

like image 139
Mickael V. Avatar answered Sep 21 '22 18:09

Mickael V.