How to detect event headphone jack inserted/removed on Realtek ALC888?
Is there any SDK or lib?
Global question: how to detect this same event under Windows XP? Global answer: not exist universal solution. But, Realtek audio know. How?
On Windows XP there's an legacy function
waveInGetNumDevs(void)
that should return 0 unless an headphone jack is plugged in. Anyway the exact behavior depends on the actual hardware driver. See also: http://msdn.microsoft.com/en-us/library/ms713732%28VS.85%29.aspx
There are some soundcards where this won't work, but if the driver comes with an utility that starts when something is plugged in into the headphone jack (i.e. some cards have an shared jack for headphone/mic and if you insert a device, it asks you what kind of device you just plugged in) - than you could write your own 'detection application', which reports somehow (i.e. sockets, pipes, shared memory) if something was plugged in to your main application. Usually theres an exe file in the driver install directory - you could simply replace that, with your 'detection application' that starts if something was plugged in automatically this way.
I'm afraid, that besides these two 'solutions' (or better workaround for the second one), there's no way on Windows XP to detect if an device was plugged into the headphone jack. On Windows Vista and newer though, there is an new interface for these events called IKsJackDescription.
Also a WM_DEVICECHANG may be fired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With