AudioEndpoint

Questions and comments specific to a particular plugin should go here.

AudioEndpoint

Postby Sem;colon » Sat Jul 19, 2014 11:16 am

Hello everyone,

I created a new AWESOME plugin I'd like to share with you; it's called "AudioEndpoint"

What does it do?
-It monitors your audio devices:
(That means it generates an event when an audio device changes:
-Attach headphone to PC -> generates event
-The default audio capture or render device changes -> generates event
-An audio device becomes deactivated or activated -> generates event
...)
-It can also set the system default audio render device:
(e.g. you have a TV connected via HDMI and some headphones connected via jack, now you can use this plugin to switch your PC audio output between Headphones and TV speakers.)

It only works with Windows Vista or higher!

Now, have fun with the plugin :-)

Change-log:
v2.2.1:
-Replaced action "Set Default Audio Render" with "Set Default Audio Device" (you can now choose the role and flow direction of the default device you would like to set)(your configured actions will still work, but you'll need to add the new one if you like to add or change something)
-Replaced action "Next Default Audio Render" with "Next Default Audio Device" (you can now choose the role and flow direction of the default device you would like to set)(your configured actions will still work, but you'll need to add the new one if you like to add or change something)
-Replaced action "Previous Default Audio Render" with "Previous Default Audio Device" (you can now choose the role and flow direction of the default device you would like to set)(your configured actions will still work, but you'll need to add the new one if you like to add or change something)
-Extended actions "Get Mute", "Set Mute", "Get Volume" and "Set Volume" by the possibility to set settings for capture devices
-Extended actions "Get Mute", "Set Mute", "Get Volume" and "Set Volume" by the possibility to use the output of the "Get Default Audio Device" action to determine which audio device should be changed
v2.1.2:
-Added options to the plugin what events you like the plugin to be triggered (volume/mute events, device state events and advanced device state events(new))
-Some bug fixes
-Modified version of the AudioEndpointControl by jonib, should work with EG 0.4 and 0.5
v2.1.0:
-Added action "Get Mute": Returns True if a specific audio endpoint is muted, and False if not
-Added action "Set Mute": Set mute for a specific audio endpoint (ON, OFF or TOGGLE)
-Added action "Get Volume": Returns the current volume of a specific audio endpoint
-Added action "Set Volume": Set the volume for a specific audio endpoint. Can be absolute or relative
-Events are generated if the volume changes on any audio endpoint
-Events are generated if the mute state changes on any audio endpoint
-Updated AudioEndpointControl by jonib with the latest sources
-Plugin is now in the .egplugin format for easy installation
v2.0:
-The plugin now uses the AudioEndpointControl library provided by jonib and not uses external tools any more.
-Replaced action "Get Default Audio Render" with "Get Default Audio Device" (you can now choose the role and flow direction of the default device you would like to get)
-Extended actions "Set Default Render", "Next Default Audio Render" and "Previous Default Audio Render" (It's now possible to select a role for the default render device you set (Console, Communication, Multimedia))
-Some responses may have changed, check your macros after updating!
v1.4:
-Added guid
-Added action "Get Default Audio Render"
-Added action "Next Default Audio Render"
-Added action "Previous Default Audio Render"
-Bug fixes
v1.2:
-Added support link
-Added icon
-Fixed a bug: Audio output was sometimes wrongly notified as "cannot be found" when trying to set it as default device
Attachments
AudioEndpoint.egplugin
AudioEndpoint v2.2.1
(38.66 KiB) Downloaded 123 times
AudioEndpoint.egplugin
AudioEndpoint v2.1.2
(39.45 KiB) Downloaded 157 times
AudioEndpoint.egplugin
AudioEndpoint v2.1.0
(28.56 KiB) Downloaded 121 times
AudioEndpoint.zip
AudioEndpoint v2.0
(34.21 KiB) Downloaded 296 times
AudioEndpoint.zip
AudioEndpoint v1.4
(107.55 KiB) Downloaded 236 times
AudioEndpoint.zip
AudioEndpoint v1.2
(109.7 KiB) Downloaded 258 times
Last edited by Sem;colon on Mon May 22, 2017 9:17 pm, edited 17 times in total.
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Postby kalia » Sat Jul 19, 2014 4:39 pm

Thanks Sem;colon. Definitely something that I can utilize.

Thanks,

kalia
kalia
Experienced User
 
Posts: 109
Joined: Wed Aug 12, 2009 1:10 am

Re: AudioEndpoint

Postby EpicCyndaquil » Sat Jul 19, 2014 10:34 pm

Awesome work, I can already see the default audio device changes appearing in the log - exactly what I needed. :D
EpicCyndaquil
 
Posts: 7
Joined: Tue Jul 15, 2014 12:53 am

Re: AudioEndpoint

Postby blaher » Wed Jul 23, 2014 7:43 am

Very nice. Works well in Win 7. :)
blaher
Experienced User
 
Posts: 463
Joined: Thu Nov 17, 2011 1:27 am

Re: AudioEndpoint

Postby V_J » Thu Jul 24, 2014 9:19 am

Nice one! Might be interesting in my case, when playing back audio through hdmi, but it stops when the screen goes to sleep. Rather than keep the pc awake, I might opt to switch audio device...
V_J
Experienced User
 
Posts: 155
Joined: Tue Mar 04, 2014 9:00 am

Re: AudioEndpoint

Postby Sem;colon » Fri Jul 25, 2014 9:55 pm

Thank you all for the positive feedback! :)

New version! (v1.2):
-Added support link
-Added icon
-Fixed a bug: Audio output was sometimes wrongly notified as "cannot be found" when trying to set it as default device
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Postby blaher » Thu Aug 14, 2014 1:54 am

V_J wrote:Nice one! Might be interesting in my case, when playing back audio through hdmi, but it stops when the screen goes to sleep. Rather than keep the pc awake, I might opt to switch audio device...


Another option is to have 2 macros, each triggered by events from the creating and ending of whatever audio program you use, and then use powercfg to either enable monitor sleeping (after 15 minutes in the example below), or disable it.

Edit: Oops, I see you've already list the idea of keeping the PC awake, but I will leave this here in case it helps someone else.
Attachments
bCapture.PNG
aCapture.PNG
blaher
Experienced User
 
Posts: 463
Joined: Thu Nov 17, 2011 1:27 am

Re: AudioEndpoint

Postby blaher » Mon Aug 18, 2014 2:08 am

I'm getting a notpresent event, but it seems to be there and working. Is this normal?

12:04:02 AudioEndpoint.State.ACTIVE.AMD HDMI Output (AMD High Definition Audio Device) ['{0.0.0.00000000}.{2be0ffbe-14b9-4650-9a51-e6d01e1351d3}']
12:04:02 AudioEndpoint.Default.Render.Console.AMD HDMI Output (AMD High Definition Audio Device) ['{0.0.0.00000000}.{2be0ffbe-14b9-4650-9a51-e6d01e1351d3}']
12:04:02 AudioEndpoint.Default.Render.Multimedia.AMD HDMI Output (AMD High Definition Audio Device) ['{0.0.0.00000000}.{2be0ffbe-14b9-4650-9a51-e6d01e1351d3}']
12:04:02 AudioEndpoint.State.NOTPRESENT.AMD HDMI Output (AMD High Definition Audio Device) ['{0.0.0.00000000}.{7017985c-9584-4724-b112-4957cbac262d}']
blaher
Experienced User
 
Posts: 463
Joined: Thu Nov 17, 2011 1:27 am

Re: AudioEndpoint

Postby Sem;colon » Mon Aug 18, 2014 11:19 am

Well, the plugin shows you events that are created by Windows OS - I guess this can have a lot of reasons, if it works I wouldn't pay much attention.
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Postby mitchelltrout » Wed Apr 08, 2015 2:48 pm

Hmmm, not sure if I am maybe using it wrong. But it does not detect when my headphones are plugged in or unplugged.

Image

And I am just unplugging it and plugging it back in to see if it generates an event.
Image
mitchelltrout
 
Posts: 6
Joined: Tue Apr 07, 2015 6:30 pm

Re: AudioEndpoint

Postby Sem;colon » Thu Apr 09, 2015 6:57 pm

Hello mitchelltrout,

looks like the audio chip Lenovo uses doesn't notify the OS if you plug/unplug headphones - or at least not the way it happens with my Realtek chip.

However, there are some system events that are currently not transferred into EG.
The good news:
I verified on a Lenovo Notebook that these events are triggered if you plug/unplug the headphones .
The bad news:
Those events look the same for if you plug or unplug the headphones...
Also they look "ugly".

If you like to try, replace the __init__.py in the plugin folder with this one:
__init__.py
(5.3 KiB) Downloaded 151 times
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Postby mitchelltrout » Thu Apr 09, 2015 7:23 pm

Thank you! It is working perfectly. When I disconnect the headphones no event fires, which is fine. And when I connect headphones it fires a few events, one of which was all I needed to automatically set the volume. Thanks again, I have had some great help from you guys on these forums!
mitchelltrout
 
Posts: 6
Joined: Tue Apr 07, 2015 6:30 pm

Re: AudioEndpoint

Postby blackwind » Tue Sep 29, 2015 7:59 am

Can I get a "Get Default Audio Renderer" action so I can take action based on the current default?
/bw
User avatar
blackwind
Experienced User
 
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada

Re: AudioEndpoint

Postby Sem;colon » Tue Sep 29, 2015 4:33 pm

Yes, it would not be difficult to implement that.

I currently use a variable in eg.globals that is filled by the events the plugin generates.
But the information is also stored in the plugin itself, e.g. the id of your default render device is stored in eg.plugins.AudioEndpoint.plugin.activeAudioEndpoint
If you would prefer the name over the id, you can get it via eg.plugins.AudioEndpoint.plugin.audioEndpointIDToNameDict[eg.plugins.AudioEndpoint.plugin.activeAudioEndpoint]
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Postby blackwind » Tue Sep 29, 2015 9:40 pm

It seems eg.plugins.AudioEndpoint.plugin.activeAudioEndpoint isn't being updated. The following code, which I believe should work, doesn't:

Code: Select all
curId = eg.plugins.AudioEndpoint.plugin.activeAudioEndpoint
curIndex = eg.plugins.AudioEndpoint.plugin.audioEndpointIDs.index(curId)
newIndex = (curIndex + 1 if curIndex + 1 < len(eg.plugins.AudioEndpoint.plugin.audioEndpointIDs) else 0)
newId = eg.plugins.AudioEndpoint.plugin.audioEndpointIDs[newIndex]
newName = eg.plugins.AudioEndpoint.plugin.audioEndpointIDToNameDict[newId]
eg.plugins.AudioEndpoint.SetRender(newId)

activeAudioEndpoint keeps returning the original value, so it doesn't cycle through as I wanted.
/bw
User avatar
blackwind
Experienced User
 
Posts: 182
Joined: Wed Sep 12, 2012 2:59 am
Location: Canada

Next

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 6 guests