Copyright © 2005-2019 MultiMedia Soft

CoreAudioDeviceDefaultChange event

Previous pageReturn to chapter overviewNext page

Remarks

 

Occurs when the system defined default audio endpoint device changes. The current system default device can be also queried using the CoreAudioDevices.DefaultGet method..

 

By design this event is only sent to the first instance of the component.

 

This event is only generated in Windows Vista and later versions: further information about management of audio devices in Windows Vista and later versions can be found inside the How to access settings of audio devices in Windows Vista and later versions tutorial.

 

For further details about synchronization through Events see the How to synchronize the container application through events tutorial.

 

 

Syntax

 

[Visual Basic]

Public Event CoreAudioDeviceDefaultChange As CoreAudioDeviceDefaultChangeEventHandler


 

[C#]

public event CoreAudioDeviceDefaultChangeEventHandler CoreAudioDeviceDefaultChange;


 

[C++]

public: __event CoreAudioDeviceDefaultChangeEventHandler CoreAudioDeviceDefaultChange;


 

 

Event Data

 

The event handler receives an argument of type CoreAudioDeviceStateChangeEventArgs having the following parameters:

 

Parameters

Description

 

 

nDeviceIndex

Zero-based index of the audio endpoint which is now the system default for the role set into the nRole parameter. The total number of audio endpoint devices can be obtained through the CoreAudioDevices.CountGet method.

This parameter may be set to -1 in case the device should have been unplugged from the system when the previous enumeration occurred, for example because an USB device was installed but not plugged in.

nDataFlow

Direction in which audio data flows between an audio endpoint device and an application.

Supported values are the following:

Mnemonic Value

Value

Meaning

DEVICE_DATA_FLOW_RENDER

0

Audio rendering stream. Audio data flows from the application to the audio endpoint device, which renders the stream

DEVICE_DATA_FLOW_CAPTURE

1

Audio capture stream. Audio data flows from the audio endpoint device that captures the stream, to the application.

nRole

The role that the system has assigned to the audio endpoint device that became the new system default.

Supported values are the following:

Mnemonic Value

Value

Meaning

DEVICE_ROLE_CONSOLE

0

Games, system notification sounds, and voice commands

DEVICE_ROLE_MULTIMEDIA

1

Music, movies, narration, and live music recording

DEVICE_ROLE_COMMUNICATIONS

2

Voice communications