rlxone / MultiSoundChanger

🎧 🔈 A small tool for changing sound volume even for aggregate devices cause native sound volume controller can't change volume of aggregate devices
Apache License 2.0
218 stars 24 forks source link

how can I listen to headphone plug in event? #2

Closed zhihaozhang closed 7 years ago

zhihaozhang commented 7 years ago

I cloned your code and find that before/after I plug in the headphone, the deviceID of Audio.getOutputDevices() is the same. How can I distinguish built-in audio and headphone? Thank you very much.

IchigoWalker commented 7 years ago

First of all do you use real mac or hackintosh? I think If you have hackintosh and implemented autoswitch with AppleHDA then device id should be the same cause connectors are in the same audio group. But it's not 100% info. You're free to test. If you find a solution - please share with us.

zhihaozhang commented 7 years ago

I'm using real mac. I tried my best to google an answer, but failed. Only one answer may be helpful, link: https://stackoverflow.com/questions/14483083/how-to-get-notifications-when-the-headphones-are-plugged-in-out-mac?s=1|1.3508 however, it seems to be out of date after OS X 10.9. Thank you for replying.