You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use RegisterEndpointNotificationCallback to get information about device additions/removals
But unfortunately, i am getting a program crash where i am trying to implement it.
Crash dump says
0xc0000005
The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
I wrote the following code:
import comtypes
from pycaw.api.mmdeviceapi import IMMDeviceEnumerator
from pycaw.constants import CLSID_MMDeviceEnumerator
from pycaw.callbacks import MMNotificationClient
class MyCallback(MMNotificationClient):
def on_device_added(self, added_device_id):
#print(added_device_id)
def on_device_removed(self, removed_device_id):
#print(removed_device_id)
@Invisi First of all, thank you for example.
I wanted to ask, maybe you know, why on_device_added/removed are not fired when plugging/unplugging audio devices?
on_device_added did not fire immediately, but only after Windows loaded the necessary drivers
on_device_removed did not fire at all, not even after manually uninstalling the device via devmgr.msc
on_device_state_changed did fire when (un)plugging
I'm very much not an expert on Windows' audio shenanigans, but here are my two cents:
If you're trying to build something listening for devices being plugged in/unplugged, try listening via on_device_state_changed with new_state=Active & new_state_id=1 and new_state=NotPresent and new_state_id=4.
Hello.
I am trying to use RegisterEndpointNotificationCallback to get information about device additions/removals
But unfortunately, i am getting a program crash where i am trying to implement it.
Crash dump says
0xc0000005
The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
I wrote the following code:
and then, in the main programm class:
What i am doing wrong? could you please give me a hint?
thanks.
The text was updated successfully, but these errors were encountered: