[wdmaudiodev] Re: RegisterControlChangeNotify doesn't work when MMDevice is obtained through GetDevice call

  • From: "Edward Abramian" <edwabr123@xxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Mon, 9 Mar 2020 16:15:10 -0700

I found the root cause of this issue. IAudioEndpointVolumeCallback::OnNotify
is only called when the endpoint's id is in lowercase. If you call GetDevice
on endpoint id in upper case and then subsequently
RegisterControlChangeNotify, OnNotify  won't get called, although
GetMasterVolumeLevel works perfectly fine. Weird and seems to be a bug.

 

From: Edward Abramian [mailto:edwabr123@xxxxxxxxx] ;
Sent: Monday, March 9, 2020 10:40 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] RegisterControlChangeNotify doesn't work when
MMDevice is obtained through GetDevice call

 

I started off Microsoft's example on how to use IAudioEndpointVolume (see
the link below). It worked perfectly fine until I replaced
GetDefaultAudioEndpoint with GetDevice called on the same endpoint. After
that, IAudioEndpointVolumeCallback::OnNotify is never called when I change
system level. Is there something I am missing here? The below is the only
change to the sample code:

 

  hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);

  EXIT_ON_ERROR(hr)

  wchar_t* epID;

  pDevice->GetId(&epID);

  SAFE_RELEASE(pDevice);

  hr = pEnumerator->GetDevice(epID, &pDevice);

  CoTaskMemFree(epID);

  EXIT_ON_ERROR(hr)

 

https://docs.microsoft.com/en-us/windows/win32/coreaudio/endpoint-volume-con
trols

 

Thanks,

Edward

Other related posts: