Page 1 of 1
[SOLVED] Sound device selection via an alternate identifier
Posted: Wed Oct 03, 2012 1:06 am
by blackwind
EventGhost's volume mixer functions are based on index. When I plug in my USB FM transmitter, it becomes the new default sound device (index 0), and my volume mixer hotkeys begin controlling it instead of my speakers. This isn't what I want.
There are cases where the current index-based selection method is preferable; therefore, I'm proposing an alternate selection method in *addition* to the current one, even if it's only accessible via Python code and not the configuration dialog. For example, instead of "eg.plugins.System.MuteOn(0)", one could use "eg.plugins.System.MuteOn('Speakers (Realtek High Definition Audio)')" (or some other unique device identifier), thereby giving us the best of both worlds.
Re: Sound device selection via an alternate identifier
Posted: Thu Apr 11, 2013 7:19 pm
by DefeX
I would suggest you look into NirCMD:
http://www.nirsoft.net/utils/nircmd2.html#using
A very useful little command line tool which could help you achieve what you want. Look further down the page for all available commands.
In Eventghost you can use this by choosing the Start Application action under System. Then as Executable you specify the path to nircmd.exe, e.g. C:\nircmd.exe, and under Command line options you specify the nircmd command of choice.
I'm using this method to switch default sound device, which is done by it's name as it appears in Control Panel - Sound. In your case this would be done by specifying
setdefaultsounddevice "Speakers (Realtek High Definition Audio)" under Command line options.
I hope you see this post and find it useful!
Re: Sound device selection via an alternate identifier
Posted: Fri Apr 26, 2013 12:25 am
by blackwind
I've actually since come across and settled on this exact solution, but thanks for pointing it out. Someday, someone somewhere will benefit from your post.
That being said, I'd still like to see my suggestion added to EventGhost. Even if it can be replicated with other programs, this is still very important functionality in the age of the USB headset.
Re: Sound device selection via an alternate identifier
Posted: Sat May 25, 2013 10:53 pm
by blackwind
Well, we're halfway there.
Though the VistaVolEvents library is only able to control the primary sound device, this patch should do the trick under XP. I'm unable to test it as I no longer have any XP machines, so feedback would be appreciated.
For the final piece of the puzzle, I'll need the VistaVolEvents source. Does anyone know where I can find it? Has it even been released?
Re: Sound device selection via an alternate identifier
Posted: Mon May 27, 2013 12:15 am
by blackwind
Code is available
here. I'm not even going to attempt this one, as the bulk of it needs to be rewritten and, to say the least, C++ isn't my strong suit.
To anyone who takes on this task, you have my advance gratitude.
Re: [SOLVED] Sound device selection via an alternate identif
Posted: Mon Jun 10, 2013 4:53 pm
by blackwind
Okay, I lied.
XP and Vista+ patch below. Again, feedback would be appreciated -- preferably before the next EventGhost release. Your existing configuration should continue to function as usual.
Think I'm starting to get the hang of this C++ business.
Re: [SOLVED] Sound device selection via an alternate identif
Posted: Tue Dec 23, 2014 11:30 pm
by Sem;colon
blackwind wrote:feedback would be appreciated
Hi bw,
very cool, I like it!

Works great with Windows 8.1 Pro!
One thing I still miss is the "Get Master Level" action (I mean there is a "Get Mute Status" but nothing to retrieve the volume level).
It wasn't that important in the past, as the default audio device creates events if the volume changes, but the other audio devices don't...
(It would be even better to get events for the other devices as well, but I think that's more work, right?)
Anyway, good job!