次の方法で共有


AudioSessionState Enumeration

Previous Next

AudioSessionState Enumeration

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

typedef enum _AudioSessionState {
  AudioSessionStateInactive = 0,
  AudioSessionStateActive = 1,
  AudioSessionStateExpired = 2
} AudioSessionState;

Members

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

Client: Windows Vista

Header: Include Audiosessiontypes.h

See Also

Previous Next