osx - How to detect when an Audio Device is disconnected in CoreAudio? -


Text after "

If there is a delever for any audio device to detect it unplugged or unplugged there The way? I've found this post that helps you to care about audio-only devices:

But I have another universal solution (i.e. all devices, USB, HDMI, etc.). And it's OSX specific.

How to do this?

I figured out any thoughts! One need to add a listener to the appropriate AudioDeviceID (the device you want to monitor):

  // When a device constants Detect AudioObjectPropertyAddress live_address = {kAudioDevicePropertyDeviceIsAlive, kAudioObjectPropertyScopeGlobal is detected To add the listener, KAudioObjectPropertyElementMaster}; AudioAbjectAdvertiserListener (current_disy_i_d_, and live_address, device's elite callback, and player_);  

And then type this callback:

  OSStatus deviceIsAliveCallback (AudioObjectID inObjectID, UInt32 inNumberAddresses, Constants AudioObjectPropertyAddress inAddresses [], Zero * inClientData) {// Your Code here}  

Hope this helps someone!


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -