User-mode mixer drivers send IOCTL_MIX_REQUEST_NOTIFY messages to kernel-mode drivers to request notification of changes to line and control information. If a user-mode driver uses drvlib.lib, code in drvlib.lib begins continually calling DeviceIoControl, sending IOCTL_MIX_REQUEST_NOTIFY messages, after MXDM_OPEN is received. (This assumes the client has stipulated change notification when sending MXDM_OPEN.) Functions are provided in soundlib.lib to assist kernel-mode drivers in responding to IOCTL_MIX_REQUEST_NOTIFY messages. Code in soundlib.lib’s SoundMixerDispatch queues the IRPs associated with these notification requests.
Kernel-mode drivers call the SoundMixerChangedItem function to queue information about line and control changes. This function, in turn, dequeues the queued IRPs, writes changed information into each IRP structure, and calls IoCompleteRequest to complete the I/O request and pass the changed information back to drvlib.lib, in user mode.
Kernel-mode drivers call SoundSetLineNotify to register a routine that soundlib.lib calls whenever the status of a line changes. For wave devices, soundlib.lib calls this routine whenever the device state should change from inactive to active, or vice versa. The routine typically sets hardware appropriately and calls SoundMixerChangedItem.
To use soundlib.lib for handling mixer devices, you must:
Mixer drivers should save their settings in the registry before system shutdown. To register for shutdown notification, call IoRegisterShutdownNotification. Drivers can save mixer settings in the registry in any format, but the most efficient registry data type for saving the settings is REG_BINARY. When the driver initializes, it can use either the stored settings or default settings.