Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event headphone jack ( Windows XP ) with Realtek ALC888

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?

like image 581
DQuade Avatar asked Nov 07 '12 07:11

DQuade


2 Answers

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.

like image 171
Constantin Avatar answered Oct 21 '22 00:10

Constantin


Also a WM_DEVICECHANG may be fired.

like image 27
Mauro H. Leggieri Avatar answered Oct 21 '22 01:10

Mauro H. Leggieri