Jump to content

Switch Default Playback Device with G-Keys

Use a headset as well as speakers?
Like to use to your headset for gaming but like to use your 5.1 speaker system to watch movies?
Sick of changing the default device manually?

Well if you have programmable keys you can assign them to switch your device.

 

Tutorial as followed:

 

If you don't have programmable keys, use option 2.

 

Option 1: NirCmd

 

1) Download NirCmd from <a href="http://www.nirsoft.net/ and place "nircmdc.exe" in a folder somewhere convenient.

Create two text files like below and place them within the same folder as the exe file:

File 1

Text file name:SwitchToSpeakers.nclContents:setdefaultsounddevice "speakers"setdefaultsounddevice "speakers" 2

//Note, quotes ARE used in code.

 

File 2

Text file name:SwitchToHeadphones.nclContents:setdefaultsounddevice "headphones"setdefaultsounddevice "headphones" 2

You may have to adjust the text inside the quotes to match your systems audio devices.

 

3) Then go to the G-key setup and choose shortcut (If your keyboard software does not support shortcuts, use option 2). Here you want to put the following: (remember to adjust the path)

Key that switches to speakers:

X:PATH/TO/nircmdc.exe script SwitchTo"Your Speaker Name".ncl

//e.g. switchTo"Speaker".ncl

 

Key that switches to headphones:

X:PATH/TO/nircmdc.exe script SwitchTo"Your Headset Name".ncl

//e.g. switchTo"Headset".ncl

 

Save, Done!

 

Option 2: AutoHotkey

 

1) Download AutoHotkey from here:"http://www.autohotkey.com/">http://www.autohotkey.com/ and install it.

 

2) Run AutoHotkey, right click it on your program tray and select "Edit This Script" and paste this code.

#+a::    Run, mmsys.cpl    WinWait,Sound    ControlSend,SysListView321,{Down 1}    ControlClick,&Set Default    ControlClick,OK    return #+z::    Run, mmsys.cpl    WinWait,Sound    ControlSend,SysListView321,{Down 2}    ControlClick,&Set Default    ControlClick,OK    return

Note: "#+a::" (Windows+Shift+a) is the shortcut to run that section of code, feel free to change it to whatever you like.

 

3) Open your Audio Devices and take note of their position in the menu. Edit where it says "{Down 2}" and "{Down} 1}" to match the position or your devices.

post-515-0-53928000-1373112269.png

When I press "Windows+Shift+a", the first audio device is selected (my headset). When I press "Windows+Shift+z" the second device is selected, (my speakers).

 

You can add more devices by adding:

#+a::    Run, mmsys.cpl    WinWait,Sound    ControlSend,SysListView321,{Down 1}    ControlClick,&Set Default    ControlClick,OK    return

and changing the shortcut and position.

 

4) Save the text file, right click AutoHotkey in the icon tray and select "Reload This Script". Your edited script is now running.

 

5) Open your keyboard software and create that key combination when you press a G-key. For both "Windows+Shift+a" and "Windows+Shift+z" or whatever you used.

 

6) Create system start-up.

AutoHotkey might not start with system start-up, add it by creating a shortcut to AutoHotkey and putting it in the start-up folder.

The location of the folders is as follows:

 

For an individual user:

C:\users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

For all users:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

 

Here C: is the drive letter of your computers System Drive (Where the Windows folder is located)

 

Enjoy!

Edited by ChaoticWolf

"Mentally Unstable Like a Fox!"

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×