Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

[SOLVED] Sound device selection via an alternate identifier

Got a good idea? You can suggest new features here.
Post Reply
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

[SOLVED] Sound device selection via an alternate identifier

Post 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.
Last edited by blackwind on Mon Jun 10, 2013 4:46 pm, edited 2 times in total.
/bw
DefeX
Posts: 2
Joined: Wed Mar 06, 2013 7:32 pm

Re: Sound device selection via an alternate identifier

Post 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!
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Sound device selection via an alternate identifier

Post 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.
/bw
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Sound device selection via an alternate identifier

Post 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?
Last edited by blackwind on Fri Aug 09, 2013 11:58 am, edited 2 times in total.
/bw
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: Sound device selection via an alternate identifier

Post 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.
/bw
User avatar
blackwind
Experienced User
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada
Contact:

Re: [SOLVED] Sound device selection via an alternate identif

Post 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.
Attachments
patch.zip
(27.77 KiB) Downloaded 378 times
/bw
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: [SOLVED] Sound device selection via an alternate identif

Post 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!
If you like my work, Image me a drink :wink:
Post Reply