Windows Driver Kit: WDM Devices
DMusUART Sample Driver
Description
The DMusUART sample driver is a DMus miniport driver that enables applications that use Microsoft DirectMusic or the Microsoft Windows multimedia midiInXxx and midiOutXxx functions to access an MPU-401 device. Theory of Operation
The DMusUART sample driver is identical to the system-supplied DMusUART miniport driver in portcls.sys. The source code for this sample can serve as a starting point for developers who need to write simple DMus miniport drivers. The DMusUART miniport driver interfaces to the DMus port driver in portcls.sys.
For more complex DirectMusic devices, including those that have downloadable sounds (DLS) functionality, please instead refer to the DirectMusic kernel-mode software synthesizer sample in the ddksynth sample directory.
In addition to the DMus port driver, portcls.sys contains a MIDI port driver that provides basic MIDI functions but lacks support for the advanced MIDI features in DirectMusic. Unlike the DMus port driver, the MIDI port driver is available in Microsoft Windows 98. The DMus port driver provides higher functionality than the MIDI port driver, so if you are creating your own miniport driver, consider interfacing to DMus instead of MIDI. A DMus miniport driver has the following advantages:
- A DMus miniport driver is visible to the DirectMusic API, unlike a MIDI miniport driver, which is not visible to DirectMusic.
- A DMus miniport driver is visible to the older, Windows multimedia midiInXxx and midiOutXxx functions if the driver includes a legacy pin descriptor.
In short, DMus miniport drivers have the benefits of both backward compatibility and advanced functionality.
Please refer to the Sound Blaster 16 (SB16) sample to learn how to include and use the system-supplied DMusUART miniport driver in portcls.sys.
DirectMusic kernel support is available in Windows 98 Second Edition and in Windows 2000 and later.
Implementation and Design
The DMus port driver, which is implemented in the PortCls system driver module, portcls.sys, performs the generic KS filter functions for the MPU-401 sample miniport driver and connects it to the rest of the system. The sample driver handles the following:
One input stream that is visible to either DirectMusic or the midiInXxx functions.
One output stream that is visible to the midiOutXxx functions.
Multiple output streams that are visible to DirectMusic.
The PortCls system driver automatically handles Plug and Play (PnP) and power management on behalf of the miniport driver.
Building the Sample
To build the sample, execute the build command in the WDK sample directory (src\wdm\audio\dmusuart). If the build succeeds, it produces the dmusuart.lib library module, which can be linked into an audio adapter driver.
The sample driver compiles in both 32-bit and 64-bit environments and is compatible with both the x86 and Alpha platforms.
Code Tour
File Manifest
| File | Description |
| dmusuart.htm | This sample documentation file |
| makefile | Make file |
| miniport.cpp | Miniport driver implementation |
| mpu.cpp | MPU-401 device-specific implementation |
| private.h | Miniport and stream interface definitions |
| sources | Sources for build |
Build machine: CAPEBUILD