Audio device switcher for Windows 7

bdr529

Limp Gawd
Joined
Nov 9, 2001
Messages
500
I made a program for Windows 7 to make it easier to switch between audio output devices and thought I would share. It really bugged me that you needed so many clicks to change audio devices.

My goal was to make it look like the Windows 7 flyout widget programs like when you click the volume icon. When you open the program it will add an icon to your system tray that when clicked will list your audio device. Click on a device and it will be changed to your preferred playback device. I am pretty new to C#, but it works on the few people i shared it with. If you open it in anything but Windows 7 it will crash because I am using a new Windows 7 API to get the system tray icon location and I am too lazy to make a warning popup.

Nk2P0.jpg


You can download it here

If anyone has a better hosting site let me know, never really had to host a zip file before.

Credit goes to this guy for figuring out the undocumented API for setting prefered audio devices http://www.daveamenta.com/2011-05/p...e-default-sound-playback-device-in-windows-7/. I just made it into a DLL and gave it a pretty front end.
 

djoye

2[H]4U
Joined
Aug 31, 2004
Messages
2,935
SUGGESTION: I run 7.1 analog from my X-Fi soundcard to my receiver. I like to run with my speakers set as "full-range" speakers so that games and media players can redirect low frequencies without other stuff being unnecessarily redirected, however, some games don't at all send low frequencies to the subwoofer (SHAME ON YOU OPENAL) so I have to go in and uncheck these settings so that Windows will work with my Creative crap and redirect bass to the subwoofer for the slacker games.

XfzXL.png


I could find use in your program if you could make it toggle these settings.
 

bdr529

Limp Gawd
Joined
Nov 9, 2001
Messages
500
Yeah, I have no idea how to do that :p, but thanks for the suggestion. This is just a solution to a problem I had after buying a USB headset. At first I used some AutoIt script to change the devices by a mouse macro but eventually found this guys blog with a programmatic way. I am not sure what you want may even be possible. MS was pretty sneaky hiding the API to change the preferred device, don't know if they expose that stuff.
 

Impulse

[H]F Junkie
Joined
Apr 5, 2001
Messages
10,232
Interesting, thanks for sharing, an app like that but to change the playback setting from speakers to headphones would be cool but like you said, not sure if it's possible at all.
 

bdr529

Limp Gawd
Joined
Nov 9, 2001
Messages
500
What is this written in? Are you willing to share the source?

The DLL is written in C++ and is responsible for retrieving the audio device list and setting the preferred device. The main program is a simple C# app that is just a window and a list box with a bunch of tweaks to make it look and behave like the windows flyouts. I might be willing to share it later, but the code isn't really presentable now.
 

vsboxerboy

2[H]4U
Joined
Oct 17, 2005
Messages
3,661
Awesome, thanks. I have headphones and speakers on different sound cards so this is what I need.
 

hoonu

n00b
Joined
Jun 8, 2010
Messages
34
Thanks so much for this. I was looking for something just like this and I kept stumbling across some bloated apps that I was afraid to even touch. Thanks for keeping it simple and clean!
 

pwrusr

2[H]4U
Joined
Jul 30, 2009
Messages
3,116
The DLL is written in C++ and is responsible for retrieving the audio device list and setting the preferred device. The main program is a simple C# app that is just a window and a list box with a bunch of tweaks to make it look and behave like the windows flyouts. I might be willing to share it later, but the code isn't really presentable now.

I'd also be interested in seeing the source if you ever publish it :cool:
 

DG25

Gawd
Joined
Dec 15, 2006
Messages
550
Thanks for this, i was looking for something similar. :)

I would suggest adding custom shortcut key support (ie: ctrl + alt + "key", or alt + "key", or just "key"), for switching between available audio devices. Or maybe just left clicking on the icon would automatically switch, without showing the menu; right click on icon for menu.

And make the icon white, just the like the default win7 volume icon. :p

Anyway, thanks again.
 

agent154

n00b
Joined
Dec 30, 2011
Messages
1
I too am eagerly waiting to see the source if you post it. I've been wanting to make this exact tool myself but couldn't figure out how. My dream is to do almost exactly as you did, though to ultimately extend the built-in volume control app instead of having a separate tool just for this (failing that, a separate app that also controls the volume)
 

Ruahrc

Limp Gawd
Joined
Mar 8, 2009
Messages
451
Neat little program. Fortunately for me since I use a USB soundcard to hook to my headset, and onboard audio for my desktop speakers, I just unplug my USB soundcard when I don't need the headphones. It's easy to do since I use one of my front USB ports to connect the external card. Windows switches automatically from the USB soundcard to the onboard because it's the only sound device in the system. When I plug the USB stick back in, it becomes the output device since it is the default sound device.
 

Fenris_Ulf

[H]ard|Gawd
Joined
Nov 29, 2004
Messages
1,817
Good idea. I can't seem to get it to do anything though. After running the exe, I click on the tray icon (smart making it distinctive from the default Windows one BTW) and nothing happens. I really want this to work since my HDMI audio routinely drops and isn't restored to default when it comes back and I'd like a quick two click restore of the default. Is there anything that I'm missing?
 

JoeUser

2[H]4U
Joined
Mar 30, 2010
Messages
3,919
Dude thanks so much!

I use analog audio from my onboard to a equalizer then to my receiver for my headphones (since my receiver equalizer doesn't work for the headphone output) and HDMI from my video card to my receiver for 5.1 in movies and games.

Having said that I love that you made this because I frequently switch from onboard (night listening or music) to HDMI (movies and games)...I actually looked on this thread thinking the title was a question and was looking forward to peoples suggestions when lo and behold the answer to my problems was in the first post! :-D

Thanks OP! Any PayPal for donations?!
 

daddy-o

Weaksauce
Joined
Apr 2, 2010
Messages
84
Agreed, I would definitely donate. Great app, and it's shameful that this feature isn't built into Win7.
 

Valaire

Gawd
Joined
Dec 16, 2005
Messages
846
WTB app for Xonar cpanel that lets you bind a keyboard shortcut to different headphone and speaker "profiles."
 

Geronimo

[H]ard|Gawd
Joined
Jun 7, 2001
Messages
1,703
Hey, I was wondering if you could add a feature to reroute audio just like "velbac" did to reroute x-fi audio through hdmi. While switching. I would donate.
 

Henchman24

n00b
Joined
Jan 17, 2011
Messages
44
This is awesome, however, in higher resolutions if used with larger icons/fonts, it's display is a little broken(cuts off choices due to padding I'm guessing).

Works like a charm though! Thanks a lot!
 

D-Wiz

Weaksauce
Joined
Feb 17, 2012
Messages
122
Awesome, always thought the output switching rigmarole was the worst thing about Win7.
 

stranded

n00b
Joined
Jun 4, 2012
Messages
1
Hi,

Registered just to say thanks. Also the program's pop out menu is messed up (cut off) on bigger DPI setting on Windows. Any way to fix it?
 

Cliff Couser

[H]ard|Gawd
Joined
Dec 22, 2003
Messages
1,838
thanks for this!

put in my start up folder and now can easily switch between USB speakers and headphones.
 
Last edited:

DG25

Gawd
Joined
Dec 15, 2006
Messages
550
Switch Between Sound Outputs with a Keyboard Shortcut (with AutoHotkey):

Just discovered a short autohotkey script to switch playback devices on Win 7. So I can switch from headphones to externals with a single button press. Just paste this into your AutoHotkey script:

^!s::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 2}
ControlClick,&Set Default
ControlClick,OK
return

Obviously you can change the keyboard shortcut to whatever you want; this one is Ctrl+Alt+S. This activates the 2nd device in the Sound window's list; in the above case, the speakers. Just change the number in {Down 2} to match the one you want to enable. You can then create two shortcuts, one for your speakers and one for your USB headphones or DAC.

This is not my writing and i haven't tested it yet, i've just found it on lifehacker.
 

StatutoryApe

Limp Gawd
Joined
Apr 25, 2011
Messages
309
You're my favorite person ever. I contemplated writing a program to do exactly this for exactly the same reasons.

Works in Windows 8, btw.
 

mope54

Supreme [H]ardness
Joined
Oct 2, 2004
Messages
7,442
Great job. I've been looking for something like this for years.

Any chance you could get this to work with creative's auto switcher?
Or reproduce the functionality?

It changes settings on the fly depending on the .exe that is running.
So you could have it change to settings to Gaming USB when launching BF2 and then switch to Entertainment Toslink when launching VLC, for example.
 

Iguanaman

n00b
Joined
Sep 27, 2012
Messages
1
Tested the program on a 64-bit machine but nothing pops up. I can see it was compiled as 32-bit. Any chance it could be recompiled from "AnyCPU" to "X86" in the advanced compiler options so it could work on either 32 or 64 bit? * Never mind * my own stupidity, it works fine in 64 bit.
 
Last edited:

PCMusicGuy

[H]ard|Gawd
Joined
Feb 9, 2006
Messages
1,207
Glad to see you've got it working. I've stopped using it because at 1920 x 1200, I can't click on the last audio device and that is the one that I need to switch to/from all of the time. Great free app, but not very useful for me if I can't click on what I need to easily.
 

Sean

[H] for Life
Joined
Nov 16, 2000
Messages
5,283
Just want to bump this to the top. I love this program, lost it a while ago, but just re-installed it.
 
Joined
Nov 7, 2012
Messages
1
This is just superb, and ever so much appreciated. I have two W7 machines, one with three sources, the other with two, that I'm swapping between *all*the*time* and this app is a lifesaver.
Can I award double kudos? :)
Seriously, you should market that, bdr529!! Or at least point us to a PayPal button - I'd sling you some moola for that for sure....
 
Top