Changing Default Playback Device

Post your working scripts, libraries and tools
Driedman
Posts: 3
Joined: 16 Nov 2015, 18:17

Changing Default Playback Device

04 Dec 2015, 21:30

If you want the below code to work, download nircmd

- Once downloaded extract files and run nircmd.exe.
A window will pop up asking if you want to copy files
to the windows directory so you don't have to specify
full path. Choose "Copy to windows directory".

The hotkey for this to work is Ctrl+NumpadSub (Minus key on the keypad side)
There are plenty of other things you can do with nirc and this is just one of them.

Syntax for changing sound device to default is setdefaultsoundevice {Device name} {1 for multimedia OR 2 for communications}
More about nirc http://nircmd.nirsoft.net/

Here is the code

Code: Select all

#SingleInstance, Force
#NoTrayIcon
;-----------------------Variables & AUTORUN-----------------------
CoordMode, ToolTip, Screen

;------------------------Snippets of Code------------------------
^NumpadSub::
Toggle := !Toggle
If Toggle {
	run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "Speakers" 1
	ToolTip, Device: "Speakers", 1250, 707
	SetTimer, RemoveToolTip, 2000
	return
}
Else {
	run %ComSpec% /c nircmd.exe SetDefaultSoundDevice "Turtle Beach" 1
	ToolTip, Device: "Turtle Beach", 1234, 707
	SetTimer, RemoveToolTip, 2000
	return
}

RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
I have the hotkey to toggle between two playback devices. If you have more than two you'll have to tweak it to cycle though them.

Tip: You may need to change the x and y values of Tooltip as they are not coded to fit snuggly on all pc screens.
(Mine is intended to be right up against the top of tray and right of screen)
lexikos
Posts: 7085
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Changing Default Playback Device

05 Dec 2015, 20:33

nircmd has a number of useful functions, but if you just want to change the default playback device, you can use a script (VA.ahk) instead.

Code: Select all

VA_SetDefaultEndpoint("Speakers", 1)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: thebat and 14 guests