AudioEndpoint

Questions and comments specific to a particular plugin should go here.
Snowbird
Experienced User
Posts: 360
Joined: Fri Jul 03, 2009 10:04 am

Re: AudioEndpoint

Post by Snowbird » Mon Jun 26, 2017 10:13 am

jonib wrote:
Sem;colon wrote:hmm, looks like the new lib form version 2.1 only works with EG version 0.5 and up.
You are missing the "stdole.py" and "MMDeviceAPILib.py" files that are needed for EG 0.4 as comtypes can't generate them.
The comtypes in Python 2.7 don't have the problem so it works in EG 0.5 that uses 2.7.

There is also a period missing in the "AudioEndpointControl\__init__.py" file, line 13 should be:

Code: Select all

try:
	from .MMDeviceAPILib import MMDeviceEnumerator as _MMDeviceEnumerator, IMMDeviceEnumerator as _IMMDeviceEnumerator, IMMNotificationClient
except ImportError:
Or it can't import the MMDeviceAPILib module, because I added the "absolute_import" directive. sorry about that.

jonib
for some unknown reason I'm getting this error on one of my computer :

Code: Select all

12:04:32   Error loading plugin file: C:\ProgramData\EventGhost\plugins\AudioEndpoint
12:04:32   Traceback (most recent call last) (0.5.0-rc2):
12:04:32     File "C:\ProgramData\EventGhost\plugins\AudioEndpoint\__init__.py", line 20, in <module>
12:04:32       import AudioEndpointControl
12:04:32     File "C:\ProgramData\EventGhost\plugins\AudioEndpoint\AudioEndpointControl\__init__.py", line 17, in <module>
12:04:32       from comtypes.gen.MMDeviceAPILib import MMDeviceEnumerator as _MMDeviceEnumerator, IMMDeviceEnumerator as _IMMDeviceEnumerator, IMMNotificationClient
12:04:32   ImportError: cannot import name MMDeviceEnumerator
I don't understand what went wrong it used to work perfectly, following a system crash (I think) it's not working anymore. I reinstalled EG RC2, even reinstalled the AudioEndpoint plugin (latest version, and also older) just to be on the safe side, but I still can not import this plugin... Any thoughts on this ?

jonib
Plugin Developer
Posts: 1298
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: AudioEndpoint

Post by jonib » Mon Jun 26, 2017 12:07 pm

Snowbird wrote:I don't understand what went wrong it used to work perfectly, following a system crash (I think) it's not working anymore. I reinstalled EG RC2, even reinstalled the AudioEndpoint plugin (latest version, and also older) just to be on the safe side, but I still can not import this plugin... Any thoughts on this ?
This file "_2FDAAFA3_7523_4F66_9957_9D5E7FE698F6_0_1_0.py" gets automatically generated and I'm guessing it is corrupted or wrong version, I'm not sure where it is on your system, but try to find it and delete (or move) it and try again.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

Snowbird
Experienced User
Posts: 360
Joined: Fri Jul 03, 2009 10:04 am

Re: AudioEndpoint

Post by Snowbird » Mon Jun 26, 2017 12:51 pm

jonib wrote:This file "_2FDAAFA3_7523_4F66_9957_9D5E7FE698F6_0_1_0.py" gets automatically generated and I'm guessing it is corrupted or wrong version, I'm not sure where it is on your system, but try to find it and delete (or move) it and try again.

jonib
Thanks, it worked !! :D

if this happens to anyone else, the files are located here, just delete them all and restart EG :
%LOCALAPPDATA%\Temp\comtypes_cache\EventGhost-27

jonib
Plugin Developer
Posts: 1298
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: AudioEndpoint

Post by jonib » Mon Jun 26, 2017 5:20 pm

Snowbird wrote:Thanks, it worked !! :D
Great.

I'll see if it can be fixed automatically in my AudioEndpointControl Library when I work on it next time. GitHub issue.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: AudioEndpoint

Post by Luca Brasi » Wed Aug 16, 2017 10:53 am

hey guys,
I'm struggling with checking if one specific audio device is connected. Sorry if that has been discussed here somewhere, I couldn't find any info for that.
I tried to set audio on the disconnected device hopping to get some error then but there was none. Apparently AudioEndpoint is setting the volume on the disconnected device. But of course I will not get a volume change from the system then. So I could use that for determining the connection status but I was thinking that there has to be an easier way?

[Edit:] Some more info: AudioEndpoint will even give me an event with the new volume on the disconnected device which might be a logical thing to do. It just doesn't help me with my workaround. I'm handling it now with System.Volume event which is not triggered.
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

Sem;colon
Experienced User
Posts: 609
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Post by Sem;colon » Wed Aug 16, 2017 9:15 pm

You get a state change even when you plug/unplug an audio endpoint, just write a variable on these events and check that variable when you need to know if it's connected or not

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: AudioEndpoint

Post by Luca Brasi » Wed Aug 16, 2017 10:10 pm

I'm doing that of course. It's just that this fails sometimes. I guess around sleep/wake. So I wanted to build in some kind of check if the avr is there or not because I don't want some other actions to be triggered until it is. It's no biggie I'll work around it.

Code: Select all

try:
    eg.plugins.System.ChangeMasterVolumeBy(-1.0, u'TX-SR607-14 (NVIDIA High Defini')
except:
    print 'Error for amp volume change - Amp not present'
    eg.globals.amp_connected = 0
else:
    print 'Amp Volume change succesful - Amp is connected'
    eg.globals.amp_connected = 1
    eg.plugins.System.ChangeMasterVolumeBy(1.0, u'TX-SR607-14 (NVIDIA High Defini')
Or maybe a little bit more robutst

Code: Select all

eg.globals.amp_connected = 0
from eg.WinApi import SoundMixer
print SoundMixer.GetMixerDevices()
device = "TX-SR607"
devdict = SoundMixer.GetMixerDevices()
for k in devdict:
    if device in devdict[k]:
        eg.globals.amp_connected = 1
        print 'Amp is connected'
        break
    else:
        pass
print 'eg.globals.amp_connected = '+str(eg.globals.amp_connected)
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

Xepo
Posts: 3
Joined: Tue Sep 19, 2017 3:29 pm

Re: AudioEndpoint

Post by Xepo » Wed Sep 20, 2017 7:40 am

Hi guys,

Im trying to detect when windows is playing audio. Any source, any sound, basically whenever the soundcard is transmitting a signal to the speakers.

Is this somehow possible with this plugin?

Thanks,
Bob

nYce
Posts: 42
Joined: Wed Mar 28, 2018 2:29 am

Re: AudioEndpoint

Post by nYce » Thu Aug 30, 2018 7:29 pm

Hey guys,

i want to use this plugin to change the default audio output devices.
But after some time my actions get to:

AudioEndpoint: ???

after reconfiguring it (doubleclick), i can rechoose my devices and everything is fine again..
audioendpoint01.jpg

it seems like the plugin gets messed up and doesn't remember my devices if i disconnect and connect them again or something..

anyone got an idea on that? is there even a newer plugin for my task?

LG nYce

Sem;colon
Experienced User
Posts: 609
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Post by Sem;colon » Fri Aug 31, 2018 11:46 am

Hmm, seems like the ID of your audio devices changed.

Maybe you plug your device in a different socket/port?
Make sure you always use the same port when connecting disconnecting a device!

Also this can happen sometimes after an driver update or after an OS upgrade.

pralima87
Posts: 11
Joined: Tue Sep 11, 2018 3:36 pm

Re: AudioEndpoint

Post by pralima87 » Thu Sep 13, 2018 8:43 pm

This plugin is causing some severe slowdown on my system if "state changes" is selected.

loveleejohn
Experienced User
Posts: 129
Joined: Thu Dec 10, 2015 12:09 am

Re: AudioEndpoint

Post by loveleejohn » Wed Nov 14, 2018 4:25 pm

nYce wrote:
Thu Aug 30, 2018 7:29 pm
Hey guys,

i want to use this plugin to change the default audio output devices.
But after some time my actions get to:

AudioEndpoint: ???

after reconfiguring it (doubleclick), i can rechoose my devices and everything is fine again..

audioendpoint01.jpg


it seems like the plugin gets messed up and doesn't remember my devices if i disconnect and connect them again or something..

anyone got an idea on that? is there even a newer plugin for my task?

LG nYce
I am also experiencing this exact problem in Windows 10 Professional. Not sure what might be causing the issue. I guess I'll give Nircmd a try since I have it installed anyway. Just wish there was an easier way. :cry:

Sem;colon
Experienced User
Posts: 609
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Post by Sem;colon » Sun Nov 25, 2018 4:57 pm

Hey Everyone!
A new version is here, tackling the Windows 10 - devices disappear problem!

v2.3.2:
-Fixed a bug: "Get Default Audio Device" was not working in combination with "Set Volume"
-Added action: "Get Audio Device By Name" to get an audio device by its name instead of its unique ID. You can use wildcards. The first device where the name matches will be returned to be used in one of the other actions - for example, to change the default audio device. This is useful when running Windows 10, as after OS upgrades and/or driver updates the IDs that are used to reference an AudioEndpoint can change, but the name usually stays the same.
-Some small bugfixes
-Updated AudioEndpointControl lib by jonib with the latest sources, this (hopefully) increased the stability
This version is not tested with EG 0.4 and therefore may not work with it!

As always, get it from the first post!

User avatar
Neytrino-OnLine
Experienced User
Posts: 97
Joined: Tue Aug 20, 2013 7:14 pm
Location: Moscow, Russia

Re: AudioEndpoint

Post by Neytrino-OnLine » Sun Nov 25, 2018 7:13 pm

Sem;colon, hi . Is there a way to get full list of audio devices (by Python)? I understand that I could make it by switching default device to the next (collecting ID's), but it would be desirable to get the list without switching the device...
Sin©erely yours, Neytrino.

Sem;colon
Experienced User
Posts: 609
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: AudioEndpoint

Post by Sem;colon » Sun Nov 25, 2018 9:10 pm

Neytrino-OnLine wrote:
Sun Nov 25, 2018 7:13 pm
Sem;colon, hi . Is there a way to get full list of audio devices (by Python)?
sure, here you go:

All outputs by id:

Code: Select all

eg.plugins.AudioEndpoint.plugin.AudioDeviceIDs[0]
All outputs by name:

Code: Select all

eg.plugins.AudioEndpoint.plugin.AudioDeviceNames[0]
but I'm curious about your use-case? :)

Post Reply