Partager via


IAudioSessionControl::GetLastActivation

Previous Next

IAudioSessionControl::GetLastActivation

The GetLastActivation method retrieves the time that the audio session last changed to the active state.

HRESULT GetLastActivation(
  DATE  *pRetVal
);

Parameters

pRetVal

[out]  Pointer to a caller-allocated DATE variable into which the method writes the time of the last activation. The time is expressed in Universal Coordinated Time (UTC) format. For more information about DATE and UTC, see the Windows SDK documentation.

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
E_POINTER Parameter pRetVal is NULL.
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.

Remarks

An audio session is active if it contains one or more active audio streams. An active stream is in the running state. An inactive stream is in the stopped state. A session becomes active when its first stream becomes active. A session becomes inactive when its last active stream becomes inactive. The session state changes to expired when the client destroys the last stream in the session by releasing all references to the stream object.

The client assigns a stream to a session when it calls the IAudioClient::Initialize method to create the stream.

The client can determine the time at which the session last became inactive by calling the IAudioSessionControl::GetLastInactivation method. The client can determine whether the session is currently active or inactive by calling the IAudioSessionControl::GetState method.

Requirements

Client: Windows Vista

Header: Include Audiopolicy.h.

See Also

Previous Next