Page 6 of 6

Re: AudioEndpoint

Posted: Mon Jun 26, 2017 10:13 am
by Snowbird
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 ?

Re: AudioEndpoint

Posted: Mon Jun 26, 2017 12:07 pm
by jonib
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

Re: AudioEndpoint

Posted: Mon Jun 26, 2017 12:51 pm
by Snowbird
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

Re: AudioEndpoint

Posted: Mon Jun 26, 2017 5:20 pm
by jonib
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

Re: AudioEndpoint

Posted: Wed Aug 16, 2017 10:53 am
by Luca Brasi
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.

Re: AudioEndpoint

Posted: Wed Aug 16, 2017 9:15 pm
by Sem;colon
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

Re: AudioEndpoint

Posted: Wed Aug 16, 2017 10:10 pm
by Luca Brasi
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)

Re: AudioEndpoint

Posted: Wed Sep 20, 2017 7:40 am
by Xepo
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