0

I would like to enumerate all Audio Sessions with Windows Audio Core APIs and be able to manipulate the Sessions Volumes, but I can't find a way to enumerate the audio sessions and get some Interface like the ISimpleAudioVolume Interface. I can only enumerate the IAudioSessionManager2 to get the IAudioSessionControl Interfaces for all running sessions. But this interface only enables me to get the icons and descriptions. But no option to get the session guid. In order to get the ISimpleAudioVolume of a session I need the session guid to make use of IAudioSessionManager::GetSimpleAudioVolume.

Edit: I may get the proper guid from IAudioSessionControl::GetGroupingParam but I get 12 audio sessions. Why do I get so many sessions, when sndvol only displays 3 outputs?

How do I enumerate all running audio sessions and get the ISimpleAudioVolume Interfaces for them?

I've got instances of IAudioSessionManager and IAudioSessionManager2 available.

Brainiac
  • 191
  • 1
  • 12
  • Related: [How can I programmatically set the default input and output audio device for an application?](https://stackoverflow.com/questions/57778069/how-can-i-programmatically-set-the-default-input-and-output-audio-device-for-an) – Mitch Dec 15 '19 at 16:20
  • @Mitch Unfortunately this only enumerates devices, not the sessions – Brainiac Dec 15 '19 at 16:37
  • https://learn.microsoft.com/en-us/windows/win32/api/audiopolicy/nf-audiopolicy-iaudiosessionmanager2-getsessionenumerator – Hans Passant Dec 15 '19 at 20:38
  • @HansPassant thank you, but as I stated above, I have used it and still cannot get the correct interfaces – Brainiac Dec 16 '19 at 07:04
  • I don't see you mention it anywhere. Show your code. – Hans Passant Dec 16 '19 at 07:57
  • @HansPassant Quote from above: > I can only enumerate the IAudioSessionManager2 to get the IAudioSessionControl Interfaces for all running sessions. But this interface only enables me to get the icons and descriptions. – Brainiac Dec 17 '19 at 08:32
  • 1
    [If you call `QueryInterface` on the `IAudioSessionControl` interface, you can often get access to an `ISimpleAudioVolume`.](https://stackoverflow.com/a/6084029/868014) – Roman R. Dec 17 '19 at 17:02
  • @RomanR. You are my hero, thank you! – Brainiac Dec 17 '19 at 20:21

0 Answers0