Switching between USB and Other audio

Discussions about what to spend that hard fought for tax refund on
User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4231
Joined: Thu Dec 01, 2005 10:40 pm

Switching between USB and Other audio

Postby Mort » Mon Jun 25, 2012 11:48 pm

Just sharing my solution to the problem of having a USB headset and on-board (or sound card) audio devices. Switching between which is the default playback device is a pain.

I use a program called "nircmd" which allows for scripting changes to various things. This seems to work fine in Win7 and Win8. I use a couple of the macro keys on my G19 keyboard to switch, but you could just create shortcuts on the desktop or wherever to do the same

1. Download the following zip and extract (e.g. to C:\utils)
nircmd.zip

2. Edit the Audio devices so the name of your "speakers" and your USB "headset" are different
Right-click the speaker icon down near the clock
Select Playback Devices
Right Click the USB device and select properties
Change the name (in my scripts I use "g930")
playback.PNG

Click the Recording tab
Right click the USB microphone and select properties
Change the name (in my scripts I use "g930-mic")
recording.PNG


3. Edit the .ncl files that were extracted to match the names you changed above

4. To set the audio to output to speakers use:
nircmd script "nircmd-setspeakers.ncl"
Working directory to same as where the files have been extracted

5. To set the audio to output to the USB headset, and use the USB microphone use:
nircmd script "nircmd-setg930.ncl"
Working directory to same as where the files have been extracted

There is a "copy" ncl file that has the settings I use for my speakers with my webcam as the microphone instead

The current scripts set both the Default Audio devices, and the Default Communications Devices to the same thing.

If you want more details of what you can use nircmd for, here's the link
http://www.nirsoft.net/utils/nircmd.html

Any questions, let me know.
You do not have the required permissions to view the files attached to this post.
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4231
Joined: Thu Dec 01, 2005 10:40 pm

Re: Switching between USB and Other audio

Postby Mort » Mon Jun 25, 2012 11:58 pm

The relevant bit from the website for the command I am using

setdefaultsounddevice [Device Name] {Role}
Set the default sound device on Windows 7/Vista/2008. The [Device Name] is the name of the device, as appeared in the sound devices list of windows, for example: Speakers, Line In, Microphone, and so on...
The {Role} parameter is optional and may countain one of the following values: 0 for Console (the default value), 1 for Multimedia, and 2 for Communications.
Examples:
setdefaultsounddevice "Line In"
setdefaultsounddevice "Microphone" 2
Image

User avatar
Brad
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1194
Joined: Fri Dec 02, 2005 7:49 am
Location: planting RDX on your tank

Re: Switching between USB and Other audio

Postby Brad » Wed Jun 27, 2012 8:49 am

Works well for me.
Note that if a program has picked up one sound device, it wont necessarily switch instantly (in Win 8 at least). I was playing a movie in VLC and it didn't swap sound devices until VLC was restarted.

B
I thought I had an appetite for destruction, but all I wanted was a club sandwich.

User avatar
Piers
Comfortable with my sexuality
Comfortable with my sexuality
Posts: 1408
Joined: Fri Dec 02, 2005 7:57 am
Location: Horse country

Re: Switching between USB and Other audio

Postby Piers » Wed Jun 27, 2012 12:19 pm

Likewise re not picking up a different device automatically (Win7).
I'm lazy though, I just unplug the usb dongle of the headphones before I fire up the app I want (discovered that when playing Portal2 with Tara).
Image

User avatar
Mort
Alpha-Forum Whore
Alpha-Forum Whore
Posts: 4231
Joined: Thu Dec 01, 2005 10:40 pm

Re: Switching between USB and Other audio

Postby Mort » Thu Jun 28, 2012 10:22 pm

Depends on the app. Some will change, some won't. Check they are set to use the default audio device, but it really depends on the app, and is a damn sight easier than unplugging all the time.
Image


Return to “Hardware”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests