Skip to content

I wanted to touch base with ya. #37

@kdschlosser

Description

@kdschlosser

I hope you are doing well. I haven't seen you that active in the EG forums. But here is some brain gravy for ya.

This is going to be EG directed. but it is an issue outside of EG as well
There have been reports of a few anomalies.

These issues are kind of tricky to try and replicate But they do exist I can toss ya out some EG log files if ya like.

Problem 1 Remote Desktop sessions. They cause the installation of a virtual sound card and the removal of the physical one. As you can see this would cause an issue if the person logs into the machine remotely and an Action that specifies a device that is no longer there. This is easily fixed in EG by using the System.RemoteConnect to disable all actions pertaining to the hardware sound card and the System.RemoteDisconnect to enable them again.

Problem 2 Remote Desktop sessions, If you connect and for some reason get a drop and an automatic reconnect kicks in and while the process of adding back in the physical sound card drivers is taking place. windows will stop the install of the physical ones and remove them and install the virtual ones. if it so happens that the sound card is being processed by AudioEndpoint at that time you will get a traceback because all of a sudden in the middle of gathering information from windows about the card it is deleted and then another call is made to windows for more information about a non existent card.

Problem 3 This has to deal more so with how your library is accessed rather then an issue with the library it's self. But I wanted to make mention of it in any case. This issues causes phantom bugs and weird unrelated issues that don't point to a cause. I ran into the same problem and it took me a while to figure out what it was. You have to start your library from the main thread for a process this is due to the use of the Notifications and callbacks. Windows only likes to deal with the main thread because of reduced overhead. As an example in EG when __start__ is called it is not called from the main thread. it is called from the action thread. Now there are no guarantees on even having an issue. it's very strange about when it decides to cause problems. solution is to move all initialization code for the library to a method/function that we can have the main thread run instead of the action thread.

import threading
import wx

class MyPlugin(eg.PluginBase):
    def __start__(self, **kwargs):
        err = [None]
        event = threading.Event()
        def run():
            try:
                # Do code here
            except Exception as e:
                err.insert(0, e)
            event.set()
        wx.CallAfter(run)
        event.wait(5.0)
        if err[0] is not None:
            raise err[0]
        if not event.isSet():
            raise eg.Exceptions.InitFailed

This will cause the plugin to wait until the main thread has has finished processing the init of the lib. and because if any errors take place in a different thread they will not populate properly and the plugin will continue along it merry way. This allows for proper handling of an Exception and also if the thread simply gets stuck and never returns. Tho this would cause EG to crash because it's the main thread that would get stuck So there is not much we can do about this. as there is no way to terminate the thing from running. The use of wx.CallAfter is what injects the code to be run into the main thread. the main thread is in a looping cycle caused by wx.APP.MainLoop.

On another note. I looked at some of the issues you have posted up. I have been doing some tinkering. I have completely mapped out the whole Core Audio API into python code. and I do mean all of it. I am just tidying up the code and making sure I didn't miss something. But this code removes the need for the tbl files and the use of comtypes to generate the code. It end up being self contained in that respect. You will still need the comtypes lib in order for this to run otherwise you would have to add the bits that comtypes provides into the library. I am not sure if you can grab the most recent version of comtypes from pypi or not. Buy you can include it if ya wanted to i guess.

I should be able to shoot the code for the Core Audio API over to ya if ya want within the next few days.

Happy New Year as well..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions