how i detect mic is pluuged or unplugged to a system port
any api or any port for detection
if yes then plz explain with sort of brief example.
Posted on 2006-06-14 08:16:38 by sihotaamarpal
I don't know if there's a 'correct' way to do this, but I'll explain how I achieved something very close to it.
Create a small application which uses either DSound or the wav api to capture a small 8-bit audio sample, then examine the data.
If there's no microphone plugged in, or if the device is muted, your audio buffer will be full of bytes that contain 80h... why?
If we consider that an 8 bit wav data can only range between 00h and FFh, and that audio waves can go above and below the 'zero line', then it becomes clear that 80h is the 'zero line', and that lots of 80h means 'silence' :)

Note that the bytes in the buffer can contain a little 'jitter' ie perhaps some bytes will be 7Fh or 81h or similar - this is due to the imperfect nature of analog to digital converters as well as many other technical contributing factors (electromagnetic hum, crappy soundcard, etc) but compared to an ACTUAL audio recording, it's 'damn close to silence'.
Posted on 2006-06-14 09:30:17 by Homer
hi homer
          if in this case if mic if attached and in mute mode then again the same result what u think of 80H,my main aim to acheive  mic is attached to port or not.
can i send some data to mic port and if working after some polling period i got a response and if not in working stage then no data comes or data comes in both cases but different.but how i acheive this all any idea.app like yahoo msg how detects mic availabilty.
Posted on 2006-06-14 09:46:16 by sihotaamarpal
As far as I know, Yahoo Messenger simply *does not* detect the microphone - it *does* detect the presence of audio capture hardware (ie a soundcard).. when using that client, when joining a room I automatically join Voice regardless of whether a mic is plugged into my soundcard or not.

Try it for yourself :)
Posted on 2006-06-15 00:43:35 by Homer
Simply: there is no ability to detect if a microphone is physically plugged in to the jack or not.
Posted on 2006-06-15 03:32:59 by comrade