Enumerating inactive volume sessions


In my last blog post on this topic I showed how to get all kinds of information for the active audio sessions, including the Windows 8 Store package identifier for the process (if there was one.)

However, I recently had a need to pull information for inactive sessions too – and it needed to run downlevel as far as possible (in particular, to Windows 7.) This meant I couldn’t use the Store APIs, since they were new for Windows 8. I actually wanted to go down to Windows Vista, but I needed the IAudioSessionControl2 interface, and that was new for windows 7.

Source and binaries attached.

Output on my system:

>volume-sessions.exe

— Devices of EDataFlow eRender (0) —
Speakers (Realtek High Definition Audio)
Peak: 0
Peak, channel 1 of 2: 0
Peak, channel 2 of 2: 0
Not muted
Volume range: 0% to 100% (-46.5 dB to 0 dB in steps of 0.03125 dB)
Master (%): 65.7804%
Master (dB): -6 dB
Volume, channel 1 of 2: 65.7804%
Volume, channel 2 of 2: 65.7804%
Volume, channel 1 of 2: -6 dB
Volume, channel 2 of 2: -6 dB

Session #1 of 3
    State: AudioSessionStateInactive (0)
    Icon path:
    Display name:
    Grouping parameter: {a68c25a9-fb30-4144-8002-d8c7615e81ed}
    Session identifier: {0.0.0.00000000}.{2cbea9df-ca93-4e17-9708-e14139fd7044}|\Device\HarddiskVolume1\Program Files (x86)\Internet Explorer\iexplore.exe%b{00000000-0000-0000-0000-000000000000}
    Session instance identifier: {0.0.0.00000000}.{2cbea9df-ca93-4e17-9708-e14139fd7044}|\Device\HarddiskVolume1\Program Files (x86)\Internet Explorer\iexplore.exe%b{00000000-0000-0000-0000-000000000000}|1%b10288
    Process ID: 10288 (single-process)
    System sounds session: no
    Peak value: 0
ERROR: IAudioMeterInformation::GetMeteringChannelCount() reports zero channels
    Master volume: 1 (0 dB FS)
    Not muted
    Volume, channel #1 of 2: 100% (0 dB FS)
    Volume, channel #2 of 2: 100% (0 dB FS)

Session #2 of 3
    State: AudioSessionStateInactive (0)
    Icon path:
    Display name:
    Grouping parameter: {8bd029a1-b7da-48ed-bf89-0094a5961dd0}
    Session identifier: {0.0.0.00000000}.{2cbea9df-ca93-4e17-9708-e14139fd7044}|\Device\HarddiskVolume1\Windows\System32\WWAHost.exe%b{00000000-0000-0000-0000-000000000000}
    Session instance identifier: {0.0.0.00000000}.{2cbea9df-ca93-4e17-9708-e14139fd7044}|\Device\HarddiskVolume1\Windows\System32\WWAHost.exe%b{00000000-0000-0000-0000-000000000000}|1%b220
    Process ID: 220 (single-process)
    System sounds session: no
    Peak value: 0
    Peak, channel 1 of 2: 0
    Peak, channel 2 of 2: 0
    Master volume: 1 (0 dB FS)
    Not muted
    Volume, channel #1 of 2: 100% (0 dB FS)
    Volume, channel #2 of 2: 100% (0 dB FS)

Session #3 of 3
    State: AudioSessionStateInactive (0)
    Icon path: @%SystemRoot%\System32\AudioSrv.Dll,-203
    Display name: @%SystemRoot%\System32\AudioSrv.Dll,-202
    Grouping parameter: {f12ec33c-5337-4bed-8bb5-2114e7d91d23}
    Session identifier: {0.0.0.00000000}.{2cbea9df-ca93-4e17-9708-e14139fd7044}|#%b{A9EF3FD9-4240-455E-A4D5-F2B3301887B2}
    Session instance identifier: {0.0.0.00000000}.{2cbea9df-ca93-4e17-9708-e14139fd7044}|#%b{A9EF3FD9-4240-455E-A4D5-F2B3301887B2}|1%b#
    Process ID: 0 (multi-process)
    System sounds session: yes
    Peak value: 0
ERROR: IAudioMeterInformation::GetMeteringChannelCount() reports zero channels
    Master volume: 1 (0 dB FS)
    Not muted
    Volume, channel #1 of 2: 100% (0 dB FS)
    Volume, channel #2 of 2: 100% (0 dB FS)
— Devices of EDataFlow eCapture (1) —
No such devices.

EDIT September 22 2015: moved source to github https://github.com/mvaneerde/blog/tree/master/inactive-volume-sessions

volume-sessions.zip

Comments (3)

  1. Patrik says:

    Hey Matthew,

    Do you know if there is anyway to record in 5.1 or binaural stereo using the Windows Phone API's (slim WASAPI, MF)?

    I've got a Lumia 930 and it does support Dolby surround in the Lumia Camera app. In Visual Studio however, WASAPI doesn't seem to be able to list all capture channels available.

    Thanks, and nice blog!

  2. First-party apps like the Lumia Camera app frequently have access to private APIs that are not available in the SDK.

  3. Patrik says:

    I guess that the Dolby Surround encoder isn't licensed for third-party apps or something. Had some ideas for an app utilizing the binaural capabilities of the 930 but I'll have to scrap them then.

Skip to main content