IMMNotificationClient::OnDefaultDeviceChanged Method

The OnDefaultDeviceChanged method notifies the client that the default audio endpoint device for a particular device role has changed.

Syntax

public:
HRESULT OnDefaultDeviceChanged(
         EDataFlow flow,
         ERole role,
         LPCWSTR pwstrDefaultDeviceId
)  

Parameters

flow
Type: EDataFlow 

[in]

The data-flow direction of the endpoint device. This parameter is set to one of the following EDataFlow enumeration values:

eRender

eCapture

The data-flow direction for a rendering device is eRender. The data-flow direction for a capture device is eCapture.

role
Type: ERole 

[in]

The device role of the audio endpoint device. This parameter is set to one of the following ERole enumeration values:

eConsole

eMultimedia

eCommunications

pwstrDefaultDeviceId
Type: LPCWSTR 

[in] Pointer to the endpoint ID string that identifies the audio endpoint device. This parameter points to a null-terminated, wide-character string containing the endpoint ID. The string remains valid for the duration of the call. If the user has removed or disabled the default device for a particular role, and no other device is available to assume that role, then pwstrDefaultDevice is NULL.

Return value

Type: HRESULT 

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Refer to WASAPI error codes.

Remarks

The three input parameters specify the data-flow direction, device role, and endpoint ID string of the new default audio endpoint device.

For a code example that implements the OnDefaultDeviceChanged method, see Device Events.

Requirements

Header: Declared in mmdeviceapi.h.

Library: Use MMDevApi.lib.

See also

IMMNotificationClient

IMMNotificationClient Members