IAudioSessionManager2::RegisterSessionNotification method
The RegisterSessionNotification method registers the application to receive a notification when a session is created.
Syntax
HRESULT RegisterSessionNotification( IAudioSessionNotification *SessionNotification );
Parameters
- SessionNotification
-
A pointer to the application's implementation of the IAudioSessionNotification interface. If the method call succeeds, it calls the AddRef method on the application's IAudioSessionNotification interface.
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 value | Description |
|---|---|
|
SessionNotification is NULL. |
|
Internal object could not be created due to insufficient memory. |
Remarks
The application can register to receive a notification when a session is created, through the methods of the IAudioSessionNotification interface. The application implements the IAudioSessionNotification interface. The methods defined in this interface receive callbacks from the system when a session is created. For example code that shows how to implement this interface, see IAudioSessionNotification Interface.
To begin receiving notifications, the application calls the IAudioSessionManager2::RegisterSessionNotification method to register its IAudioSessionNotification interface. When the application no longer requires notifications, it calls the IAudioSessionManager2::UnregisterSessionNotification method to delete the registration.
CoInitializeEx(NULL, COINIT_MULTITHREADED) in a non-UI thread. If MTA is not initialized, the application does not receive session notifications from the session manager.
Threads that run the user interface of an application should be initialized apartment threading model.
Requirements
|
Minimum supported client |
Windows 7 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2008 R2 [desktop apps only] |
|
Header |
|
See also