Audio device switcher for Windows 7

Discussion in 'Computer Audio' started by bdr529, Dec 4, 2011.

  1. bdr529

    bdr529 Limp Gawd

    Messages:
    500
    Joined:
    Nov 9, 2001
    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.

    [​IMG]

    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.
     
  2. djoye

    djoye 2[H]4U

    Messages:
    2,773
    Joined:
    Aug 31, 2004
    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.

    [​IMG]

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

    bdr529 Limp Gawd

    Messages:
    500
    Joined:
    Nov 9, 2001
    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.
     
  4. Impulse

    Impulse [H]ardForum Junkie

    Messages:
    10,232
    Joined:
    Apr 5, 2001
    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.
     
  5. extide

    extide 2[H]4U

    Messages:
    3,424
    Joined:
    Dec 19, 2008
    What is this written in? Are you willing to share the source?
     
  6. bdr529

    bdr529 Limp Gawd

    Messages:
    500
    Joined:
    Nov 9, 2001
    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.
     
  7. vsboxerboy

    vsboxerboy 2[H]4U

    Messages:
    3,662
    Joined:
    Oct 17, 2005
    Awesome, thanks. I have headphones and speakers on different sound cards so this is what I need.
     
  8. hoonu

    hoonu n00b

    Messages:
    33
    Joined:
    Jun 8, 2010
    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!
     
  9. pwrusr

    pwrusr 2[H]4U

    Messages:
    3,116
    Joined:
    Jul 30, 2009
    I'd also be interested in seeing the source if you ever publish it :cool:
     
  10. DG25

    DG25 Gawd

    Messages:
    544
    Joined:
    Dec 15, 2006
    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.
     
  11. agent154

    agent154 n00b

    Messages:
    1
    Joined:
    Dec 30, 2011
    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)
     
  12. Ruahrc

    Ruahrc Limp Gawd

    Messages:
    445
    Joined:
    Mar 8, 2009
    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.
     
  13. bali723

    bali723 n00b

    Messages:
    1
    Joined:
    Jan 1, 2012
    can we get the source ? :rolleyes:
     
  14. Fenris_Ulf

    Fenris_Ulf [H]ard|Gawd

    Messages:
    1,653
    Joined:
    Nov 29, 2004
    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?
     
  15. JoeUser

    JoeUser 2[H]4U

    Messages:
    3,919
    Joined:
    Mar 30, 2010
    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?!
     
  16. hoonu

    hoonu n00b

    Messages:
    33
    Joined:
    Jun 8, 2010
    Seriously... I use this thing day in and day out. I would gladly donate.
     
  17. daddy-o

    daddy-o [H]Lite

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

    Valaire Gawd

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

    Geronimo [H]ard|Gawd

    Messages:
    1,614
    Joined:
    Jun 7, 2001
    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.
     
  20. ultra

    ultra [H]Lite

    Messages:
    79
    Joined:
    Mar 1, 2011
    wow, thanks it's fast by switching to my speakers to headphones.
     
  21. Henchman24

    Henchman24 n00b

    Messages:
    44
    Joined:
    Jan 17, 2011
    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!
     
  22. tboo

    tboo Gawd

    Messages:
    569
    Joined:
    Dec 4, 2003
    Nice!

    Thanks
     
  23. D-Wiz

    D-Wiz [H]Lite

    Messages:
    121
    Joined:
    Feb 17, 2012
    Awesome, always thought the output switching rigmarole was the worst thing about Win7.
     
  24. stranded

    stranded n00b

    Messages:
    1
    Joined:
    Jun 4, 2012
    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?
     
  25. Cliff Couser

    Cliff Couser [H]ard|Gawd

    Messages:
    1,818
    Joined:
    Dec 22, 2003
    thanks for this!

    put in my start up folder and now can easily switch between USB speakers and headphones.
     
    Last edited: Jun 14, 2012
  26. DG25

    DG25 Gawd

    Messages:
    544
    Joined:
    Dec 15, 2006
    This is not my writing and i haven't tested it yet, i've just found it on lifehacker.
     
  27. m4rc1n

    m4rc1n n00b

    Messages:
    1
    Joined:
    Jul 27, 2012
    Awesome, great job bdr529. Thanks for the app.
     
  28. grandinferno

    grandinferno n00b

    Messages:
    1
    Joined:
    Aug 13, 2012
    Dude, I signed up at these forums just to say thanks. Rad program. Just what I was looking for.

    :)
     
  29. StatutoryApe

    StatutoryApe Limp Gawd

    Messages:
    309
    Joined:
    Apr 25, 2011
    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.
     
  30. samops03

    samops03 Gawd

    Messages:
    775
    Joined:
    Oct 18, 2007
    Very useful tool, good job and thanks!
     
  31. mope54

    mope54 [H]ardness Supreme

    Messages:
    7,437
    Joined:
    Oct 2, 2004
    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.
     
  32. Flossabe

    Flossabe n00b

    Messages:
    1
    Joined:
    Sep 10, 2012
    I've been looking for this for so long! Thanks for the killer program!
     
  33. Iguanaman

    Iguanaman n00b

    Messages:
    1
    Joined:
    Sep 27, 2012
    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: Sep 27, 2012
  34. PCMusicGuy

    PCMusicGuy [H]ard|Gawd

    Messages:
    1,178
    Joined:
    Feb 9, 2006
    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.
     
  35. Sean

    Sean [H] for Life

    Messages:
    5,285
    Joined:
    Nov 16, 2000
    Just want to bump this to the top. I love this program, lost it a while ago, but just re-installed it.
     
  36. |Tch0rT|

    |Tch0rT| [H]ard|Gawd

    Messages:
    1,240
    Joined:
    Jan 11, 2007
    Yes, this needs a sticky. Great program. :)
     
  37. bmoney9

    bmoney9 Limp Gawd

    Messages:
    236
    Joined:
    Jan 16, 2006
    Thank you OP, it's awesome
     
  38. PedroStephano

    PedroStephano n00b

    Messages:
    1
    Joined:
    Nov 7, 2012
    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....
     
  39. PAo_ReVoLT

    PAo_ReVoLT [H]ard|Gawd

    Messages:
    2,036
    Joined:
    Apr 4, 2008
  40. raynich

    raynich [H]Lite

    Messages:
    91
    Joined:
    Nov 13, 2006
    Amazing, I love this.
    Works great on Windows 8, 64-bit.