IAudioSessionManager::GetAudioSessionControl method (audiopolicy.h)

The GetAudioSessionControl method retrieves an audio session control.

Syntax

HRESULT GetAudioSessionControl(
  LPCGUID              AudioSessionGuid,
  DWORD                StreamFlags,
  IAudioSessionControl **SessionControl
);

Parameters

AudioSessionGuid

Pointer to a session GUID. If the GUID does not identify a session that has been previously opened, the call opens a new but empty session. The Sndvol program does not display a volume-level control for a session unless it contains one or more active streams. If this parameter is NULL or points to the value GUID_NULL, the method assigns the stream to the default session.

StreamFlags

Specifies the status of the flags for the audio stream.

SessionControl

Pointer to a pointer variable into which the method writes a pointer to the IAudioSessionControl interface of the audio session control object. The caller is responsible for releasing the interface, when it is no longer needed, by calling the interface's Release method. If the call fails, *SessionControl is NULL.

Return value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return code Description
AUDCLNT_E_NOT_INITIALIZED
The audio stream has not been successfully initialized.
AUDCLNT_E_DEVICE_INVALIDATED
The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured, disabled, removed, or otherwise made unavailable for use.
AUDCLNT_E_SERVICE_NOT_RUNNING
The Windows audio service is not running.
E_POINTER
Parameter SessionControl is NULL.
E_MEMORY
Out of memory.

Remarks

For a code example that calls this method, see Audio Events for Legacy Audio Applications.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header audiopolicy.h

See also

IAudioSessionControl Interface

IAudioSessionManager Interface