A waveform audio driver is responsible for processing messages from the Wave API Manager to play and record waveform audio. Waveform audio drivers are implemented as stream interface drivers that are loaded by the Device Manager. The sample waveform audio driver is named WaveDev.dll. All audio drivers use the prefix WAV to name their stream interface functions, yielding function names such as WAV_Open, WAV_IOControl, and so on.
Audio hardware typically supports a larger set of operations than usually apply to files. For example, files commonly do not have volume controls or playing speed controls, but audio hardware can and often does have them. Fortunately, the DeviceIOControl portion of the stream interface allows arbitrary operations on files, making it possible to manipulate audio hardware by means of WAV_IOControl. To send commands to the audio hardware, the operating system passes various messages to this function. For example, to prepare the audio hardware for recording, Waveapi.dll uses WAV_IOControl to send the WIDM_PREPARE message to the audio driver. The messages sent to the audio driver are similar to those used by user-mode audio drivers on Windows-based desktop platforms, such as Mmdrv.dll.
Because audio drivers rely entirely on DeviceIOControl function messages, the implementation of the remainder of the stream interface is relatively simple. Specifically, the WAV_Read, WAV_Seek, and WAV_Write functions are merely stubs that return constant values. The other stream interface functions should be fully implemented and follow the conventions described in the Reference for those functions.
As an alternative to implementing the stream interface directly, you can use the model device driver (MDD) library—Wavemdd.lib—supplied by Microsoft. This library implements the stream interface functions in terms of the audio DDSI functions. If you use Wavemdd.lib, you must create a matching platform-dependent driver (PDD) library that implements the audio Device Driver Service-provider Interface (DDSI) functions. The PDD library is generally called Wavepdd.lib, although there is no requirement that it be called this. These two libraries can then be linked together to form Wavedev.dll.
The following illustration shows the interaction of the audio driver with the Windows CE operating system.
As shown in the illustration, the first step in playing and recording sounds is a call from an application to the operating system. The operating system translates such calls into WAV_IOControl calls to the audio driver. The operating system component that performs this translation is the Wave API Manager. The audio driver then executes the appropriate actions on the hardware. The Device Manager only loads and registers the audio driver at startup time. It is not directly involved in the operation of the driver.
Like standard stream interface drivers, the audio driver uses registry keys both to store configuration information and to advertise itself to the operating system. If the audio driver is not already listed in Platform.reg, create a key called HKEY_LOCAL_MACHINE\Drivers\Builtin\Audio to store configuration information. The Device Manager creates a key in HKEY_LOCAL_MACHINE\Drivers\Active for the audio driver when the driver is loaded at startup time. Because the Device Manager only checks for audio drivers at startup time, drivers for add-on audio hardware still need to have their registry entries in the \Builtin\Audio part of the registry, although their hardware is not built into any Windows CE–based platform.
The following table shows the stream interface functions for the audio driver.
WAV_Close | WAV_PowerDown |
WAV_Deinit | WAV_PowerUp |
WAV_Init | WAV_Read |
WAV_IOControl | WAV_Seek |
WAV_Open | WAV_Write |
For more information, see Developing Stream Interface Device Drivers.
The following table shows the DDSI functions for the audio driver.
PDD_AudioDeinitialize |
PDD_AudioGetInterruptType |
PDD_AudioInitialize |
PDD_AudioMessage |
PDD_AudioPowerHandler |
PDD_WaveProc |