1

Is there way in Windows API to be notified when audio device gets enabled or disabled?

I have source code with RegisterDeviceNotification() and WM_DEVICECHANGE; it tracks USB device insertion/removing good. But it does not track laptop's internal audio device enabling or disabling.

Of course I can make timer and use waveInGetNumDevs/waveOutGetNumDevs. But it is more interest to find way to force OS to send notifications :)

Thank you :)

Dmytro
  • 530
  • 4
  • 18
  • You're probably enabling/disabling the audio device via audio control instead of from Device Manager. They are different. – Jay Oct 19 '12 at 00:10
  • Yes. I'd get notification if I disable audio in Device Manager... – Dmytro Oct 19 '12 at 07:02

1 Answers1

0

waveIn/waveOut is legacy API you don't have notifications with. Yes you can poll with timer, of course, as you mentioned. In Vista+ the newer API does have notifications via IMMNotificationClient interface, see also this related answer: Get automatically notified on audio device connection/disconnection?

Community
  • 1
  • 1
Roman R.
  • 68,205
  • 6
  • 94
  • 158