Changing the Default Sound Device

About a year ago I bought for myself a new 24-inch monitor. It is great for games work as you can work with a lot of documents/source code files together without having to scroll around and/or toggle between many windows. What was great about this monitor, was that it had an HDMI port. “So what?” you will say and you will be right, but for me it was a revelation, especially when I upgraded my graphics card and bought one which had an HDMI output.

Although regarding graphics there was no difference transitioning from DVI to HDMI the sound was a whole new experience. As with anything in this life, when you get something you have to give something in return. What happened was that there was a new sound device in my setup, so my headphones could not function in parallel to the monitor speakers.

Changing from one to the other is not very difficult, but you have to access the playback devices tab in the sound configuration and set the device you want to use as the default. Searching the net you can find many guides and solutions to this problem. Some with screenshots showing the windows way:

And some more suited to power users/programmers:

Running a command line or having a shortcut (that I usually don’t remember) is not my thing, so building upon the work of the aforementioned people I decided to create an application that lives on the tray, is easy to access and helps me change easily between my monitor speakers and headphones. Let me present you with the aptly named ChangeSoundDevice program.


Before you use the application make sure that you have downloaded and installed the Microsoft Visual C++ 2010 Redistributable Package (x86). The first time that you will launch the program, it will automatically pop up a window listing the devices it has found in your system.


You can edit the names (to make them shorter and friendlier) and hit the OK Button. By default the first time the program is launched the first device will be chosen, but you can now change it easily with two clicks. One to the tray icon and one to the device of your choice. The following screenshot shows the user interface for this window.


You can also use the find devices button to get the first window again. This can be useful if you have a new sound device or are not satisfied with the previous naming.

Warning: Geeky Stuff

After having used code that was freely given by the aforementioned sites, it would be only fair to publish the source code of my application too. Inside the source code bundle you will find a solution with 2 projects. The first is a native dll library that is mostly a copy of Dave Amenta’s code with a few changes to make it play nice with P/Invoke. The second is the main program that uses the native library and runs in the tray.

Note that there is an error with the P/Invoke signatures, that I couldn’t resolve. Even though it works, there is some problem that gets caught in the debugger.

You can get the source code here.


Get the applicationhere