Supporting Auxiliary Audio Devices

Kernel-mode drivers that support auxiliary audio devices can use the auxiliary audio message dispatcher, SoundAuxDispatch, provided by soundlib.lib. If you use soundlib.lib, the amount of customized code a driver needs to provide is minimal. If the hardware provides a mixer, then soundlib.lib calls the mixer’s HwSetControlData and HwGetControlData functions to control volume (see MIXER_INFO). If the hardware does not provide mixer hardware, the driver needs to include a HwSetVolume function for the auxiliary audio device, to control volume (see SOUND_DEVICE_INIT). A DevCapsRoutine is the only other function you need to provide (see SOUND_DEVICE_INIT).

To use soundlib.lib for handling auxiliary audio devices, you must:

·Within the driver object received by DriverEntry, assign SoundDispatch to be the driver’s main dispatcher for IRP control codes. See “Examining_DriverEntry in sndblst.sys.”

·Define a SOUND_DEVICE_INIT structure. The structures’ DispatchRoutine members must be set to the address of SoundAuxDispatch, which is the auxiliary audio dispatch routine within soundlib.lib for DeviceIoControl messages.

·Call SoundCreateDevice once for each SOUND_DEVICE_INIT structure you have defined.