IAudioSessionManager2::GetSessionEnumerator method (audiopolicy.h)

The GetSessionEnumerator method gets a pointer to the audio session enumerator object.

Syntax

HRESULT GetSessionEnumerator(
  [out] IAudioSessionEnumerator **SessionEnum
);

Parameters

[out] SessionEnum

Receives a pointer to the IAudioSessionEnumerator interface of the session enumerator object that the client can use to enumerate audio sessions on the audio device. Through this method, the caller obtains a counted reference to the interface. The caller is responsible for releasing the interface, when it is no longer needed, by calling the interface's Release method.

Return value

If the method succeeds, it returns S_OK.

Remarks

The session manager maintains a collection of audio sessions that are active on the audio device by querying the audio engine. GetSessionEnumerator creates a session control for each session in the collection. To get a reference to the IAudioSessionControl interface of the session in the enumerated collection, the application must call IAudioSessionEnumerator::GetSession. For a code example, see IAudioSessionEnumerator Interface.

The session enumerator might not be aware of the new sessions that are reported through IAudioSessionNotification. So if an application exclusively relies on the session enumerator for getting all the sessions for an audio endpoint, the results might not be accurate. To work around this, the application should manually maintain a list. For more information, see IAudioSessionEnumerator.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header audiopolicy.h

See also

IAudioSessionManager2