Switching Preferred Audio Devices

The Waveform Audio interface includes functionality to query and set the preferred audio device. Messages are sent using the waveInMessage and waveOutMessage functions.

The following table shows the messages that retrieve and set the audio device ids.

Message Description
DRVM_MAPPER_PREFERRED_SET This message is sent to the audio driver to configure the device ID of an audio device.
DRVM_MAPPER_PREFERRED_GET This message is sent to the audio driver to query the current device ID of an audio device.

When an audio device is added or removed from the system, or when the preferred audio device changes, RequestDeviceNotifications is used to notify interested applications of the new device configuration. An application registers to be notified of changes by passing a GUID specifying which device class it is interested in and a message queue handle into which a message should be posted when a notification occurs.

Two GUIDs are defined for audio devices, one for wave output and one for wave input. The definitions are as follows:

// {25D535D0-5D7A-4a35-9741-ECD0B09FDB46}
0x25d535d0, 0x5d7a, 0x4a35, 0x97, 0x41, 0xec, 0xd0, 0xb0, 0x9f, 0xdb, 0x46);

// {4A7B3B17-0996-4a91-9C09-C28EB44295D7}
0x4a7b3b17, 0x996, 0x4a91, 0x9c, 0x9, 0xc2, 0x8e, 0xb4, 0x42, 0x95, 0xd7);

When an application receives a device change notification in its associated message queue, the notification will include a DEVDETAIL structure containing the GUID information.

See Also

Using the Waveform Audio Interface