The OnStateChanged method notifies the client that the stream-activity state of the session has changed.
HRESULT OnStateChanged( AudioSessionState NewState );
The new session state. The value of this parameter is one of the following AudioSessionState enumeration values:
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
A client cannot generate a session-state-change event. The system is always the source of this type of event. Thus, unlike some other IAudioSessionEvents methods, this method does not supply a context parameter.
The system changes the state of a session from inactive to active at the time that a client opens the first stream in the session. A client opens a stream by calling the IAudioClient::Initialize method. The system changes the session state from active to inactive at the time that a client closes the last stream in the session. The client that releases the last reference to an IAudioClient object closes the stream that is associated with the object.
|Minimum supported client||Windows Vista [desktop apps | UWP apps]|
|Minimum supported server||Windows Server 2008 [desktop apps | UWP apps]|