tomchuk

a little place for me to write things down so I don't forget them

Changing the Default Playback Device on Windows 7 (with less clicking)

I use speakers to listen to music while I work during the day, and a headset to play a little Battlefield 3 in the evening. I've been looking to an alternative to opening up the playback devices control panel every time I make the switch. I found that Dave Amenta had done all the hard work of uncovering the undocumented APIs and writing a console application. I did make a couple changes to his code so that the default playback device would be applied across all roles. Here's the modified code.

Download the above and drop Release\EndPointController.exe somewhere on your %PATH% (I chose C:\Windows\System32) and run it from a command prompt. It'll give you a list of devices and their IDs, remember the IDs for the devices you want shortcuts to.

Right-click and drag EndPointController.exe to your desktop and select Create Shortcuts Here. Right-click the shortcut and choose properties and add a space and the device ID to the end of the Target. You can change the icon as well (Grab audio device icons from %SystemRoot%\system32\mmres.dll). You might as well change Run: to Minimized so the console window doesn't flash when you run the shortcut.

I've also set up AutoHotKey (download AutoHotkey_L, not Basic) to change devices with a keyboard shortcut:

; Cycle through playback devices with Ctrl+Alt+S
^!s::
if not TotalEndPoints {
    TotalEndPoints = 0
    RunWait, %comspec% /c EndPointController > %A_Temp%\endpoints.txt,, Hide
    Loop, Read, %A_Temp%\endpoints.txt
        TotalEndPoints++
    FileDelete, %A_Temp%\endpoints.txt
}
CurrentEndPoint++
CurrentEndPoint := Mod(CurrentEndPoint, TotalEndPoints)
RunWait, %comspec% /c EndPointController %CurrentEndPoint% ,, Hide
return

; Switch to playback device 0 with Ctrl+Alt+0
^!0::
RunWait, %comspec% /c EndPointController 0 ,, Hide
return

; Switch to playback device 1 with Ctrl+Alt+2
^!1::
RunWait, %comspec% /c EndPointController 1 ,, Hide
return

; Switch to playback device 2 with Ctrl+Alt+2
^!2::
RunWait, %comspec% /c EndPointController 2 ,, Hide
return

Alek Davis

I found it helpful to add a shortcut to the taskbar via a new toolbar. First, create a folder, and place the shortcuts there (if you keep the EndPointController.exe in the same folder, you can make it hidden so it does not appear along with shortcuts). Give this folder a descriptive name, e.g. "Sounds" (the name of the folder will appear in the taskbar, so keep it short). Then right-click on the taskbar, select Toolbars - New toolbar..., and pick the folder you created in the previous step. Place the newly created toolbar, next to the system tray (or wherever you find it more convenient). Now you can click the toolbar and pick the appropriate shortcut.

Caunch Umish

From a Tomchuk

How do you get Tomchuk from Thomas Achtemichuk?

Nicholas Tomchuk
Nicholas@Nexes.com

Darren F

Dude, thanks so much for your work on this. I found this from the AHK forum where you posted the release file. Was looking for exactly something like this (where it doesnt popup a UI window). Now just need a systray icon to show current audio output status...

Pete Sullivan

Thanks so much for this post. I was able to create a shortcut for my headset and my speakers, and assign them to the G keys on my G15 keyboard. A single key-press switches the default device!

David Michaels

EndPointController is a fantastic utility but I have a problem that I don't know how to handle...
When I run it from a command prompt, it returns 2 devices
1 is my headset
2 is the speakers
This works fine.
I also have an HDMI output; but it is only visible after setting my video output to HDMI. When I do that,
1 is my headset
2 is the HDMI
2 are the speakers

Is there any solution that you can think of that would address this?

Thanks,David

David Michaels

Sorry, I meant to say:

I also have an HDMI output; but it is only visible after setting my video output to HDMI. When I do that,
1 is my headset
2 is the HDMI
3 are the speakers

Darren F

So in the spirit of writing things down so I don't forget them later...

I had this awesome setup using AHK and endpointcontroller in 2012 that worked flawlessly... until i reformatted. Imported in the same AHK scripts and everything, but they no longer worked. After 2 and a half days of pulling my hair out, I've isolated the issue.

Apparently endpointcontroller.exe does NOT like windows 7 x64 or something. It needs to be run in COMPATIBILITY MODE by going to properties and setting it to WinXPSP3 mode (or as I would imagine, any 32 bit mode). After that, everything works as normal.

If compatibility mode is NOT set, it will run, but will not output the list of entries into the text file, thereby breaking the AHK script (I'm using a keyboard hotkey to change the default sound output to either headphones or speakers).

Hope this saves some headaches for anyone else out there wondering why it stops working after a reformat (with any luck, it'll be me again in 3 years).

To comment, please sign in with your Google, AOL or Yahoo account.