views:

273

answers:

1

I want to be notified when a microphone jack is plugged in. What is the event fired by the OS(particularly Vista) The audio panel shows no recording device active if no mic plugged in(vista). This never happened in XP.

Also if my microphone had a "advance control" for eg Bass Boost, Mic Boost(AGC) etc, how can I get the mixer control for the same to control it.

I'm using MFC for development. Thanks

A: 

I believe that you want to implement IMMNotificationClient and handle the OnDeviceAdded event.
If you want the various controls in Vista, you're better off using the Device Topology API to get the controls (IAudioLoudness, etc.) Otherwise, you need to enumerate the mixer device IDs & ask them for their endpoint IDs, then compare the endpoint ID to find the real device you're interested in.

Eric Brown
Hi Eric! Thanks for the reply! Now I'm struggling to find out the same for XP. I'm not using the Vista SDK, but the older version, hence cannot get IMMNotificationClient. Is there a way to do this in the old SDK? Also, is there a system query if I can make out if the microphone/speaker is even plugged in(that is whether it is attached or not)?Thanks
mots_g
I'm not terribly familiar with the XP-level APIs, so I can't help that much. Sorry.
Eric Brown
Not a problem Eric! Do you know of a way through which I can detect the power/decibel of the user while he is recording using the mic. I wish to calibrate mic volume depending on the users input. The algorithm I'm using calculates power level by applying some FFT on the waveInbuffer values. However, on different machines, I'm getting different power levels (as on sensitive sound cards I'm getting higher power level, even while there is not mic attached)Is there another way to do this?Thanks.
mots_g
Different sound cards will have different power levels. (That's why SAPI makes you run microphone training - it sets the microphone volume level at a point where it's not too high and not too low.)You could do something similar - adjust the microphone volume and see if the power level changes. If there's no microphone, the power level typically won't change.
Eric Brown
This question is out of the topic, but is there any way to install SAPI 5.3 English language pack on Vista Home/Prof (German). I am facing problems after installing SAPI 5.1 (English) SDK, and I am not able to launch sample SR application (reco). Also my Inproc SR application is not working.
mots_g
The supported way to install the English recognizer is to install the Vista English language pack. However, that requires Vista Ultimate, not Home Premium or Professional.As far as Inproc SR applications go, the first thing I'd check is to verify that you're getting audio to the recognizer; you have to explicitly connect an audio source to the inproc engine. Then I'd set the interest handler to SR_ALL_EVENTS and make sure you're getting an audio start event, phrase start, etc.
Eric Brown