I’d like to execute some code when an audio device is disconnected. Currently, I’m using a timer to poll the devices count, but it’s always more elegant to wait for an event.
My problem is: I can’t find any class that provides such events (I searched in the MBS plugin). Christian, do you think this is something that could be added in a future release, please?
Oh, good idea. I was focused at the audio level but was not thinking out of the box (actually, it’s an HDMI device connected using an USB adaptor).
Thank you.
Great, I’ll take a look. Thank you.
P.S.: I don’t know which answer I should mark as the solution in such cases (there are two), but it’s also bad to not mark either of them .
I agree - if it works, the AudioListener should be more specific than a USB notification. But make sure it works before marking it as the solution All you get is a “Changed” event for an instance of the class, so if you’re not already using the class who knows how much effort it will take.
Thanks for your answers.
I used both solutions, because monitoring the HDMI display is also a nice addition to the app.
I’m marking Christian’s answer as the solution, since it’s all based on his plugin; Julia’s answer would also be a candidate, hope you don’t mind .