This project has moved and is read-only. For the latest updates, please go here.

Handling changed device event

May 28, 2011 at 5:52 PM


I'm wondering how to process the event when i insert (or extract) my headphones or another output device to soundcard jack.

I found an IMMNotificationClient interface and tried to implement it, but because of poor documentation i couldn't even find a way to attach my class to any audio device (or to what i should attach it?).

My eventual purpose is automatic controlling volume for different devices, e.g. when headphones are active - set 10% volume, and when speakers are active - set 100%;

If someone had developed such a task, i'll be very grateful for any kind of help or advice.

And, sorry for my terrible english ^^

May 28, 2011 at 5:54 PM

I'm afraid I am not an expert on using the IMMNotificationClient interface. NAudio has wrappers for it, but the main thing we support at the moment is simple playback and recording. You might find someone who can help you on, or maybe in one of the MSDN forums relating to WASAPI.


May 28, 2011 at 6:01 PM

Thank you for answer. There are already some questions on stackoverflow, and all the answers are referring to your library :)

But anyway, you made great job, and sure i'll use some features of naudio in my project.

May 28, 2011 at 6:03 PM

oh. Larry Osterman is the man who seems to know most about WASAPI. Search for his blog or answers from him in forums and you might find some useful stuff.

I don't find WASAPI to be particularly useful for my needs as all the software I write needs to work on Windows XP too.