AudioSessionState enumeration (audiosessiontypes.h)

The AudioSessionState enumeration defines constants that indicate the current state of an audio session.

Syntax

typedef enum _AudioSessionState {
  AudioSessionStateInactive,
  AudioSessionStateActive,
  AudioSessionStateExpired
} AudioSessionState;

Constants

 
AudioSessionStateInactive
The audio session is inactive. (It contains at least one stream, but none of the streams in the session is currently running.)
AudioSessionStateActive
The audio session is active. (At least one of the streams in the session is running.)
AudioSessionStateExpired
The audio session has expired. (It contains no streams.)

Remarks

When a client opens a session by assigning the first stream to the session (by calling the IAudioClient::Initialize method), the initial session state is inactive. The session state changes from inactive to active when a stream in the session begins running (because the client has called the IAudioClient::Start method). The session changes from active to inactive when the client stops the last running stream in the session (by calling the IAudioClient::Stop method). 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 system volume-control program, Sndvol, displays volume controls for both active and inactive sessions. Sndvol stops displaying the volume control for a session when the session state changes to expired. For more information about Sndvol, see Audio Sessions.

The IAudioSessionControl::GetState and IAudioSessionEvents::OnStateChanged methods use the constants defined in the AudioSessionState enumeration.

For more information about session states, see Audio Sessions.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Header audiosessiontypes.h

See also

Core Audio Constants

Core Audio Enumerations

IAudioClient::Initialize

IAudioClient::Start

IAudioClient::Stop

IAudioSessionControl::GetState

IAudioSessionEvents::OnStateChanged