Windows Driver Kit: WDM Devices
FMSynth Sample Driver
Description
The FMSynth sample driver is a MIDI miniport driver that allows applications that use the Microsoft Windows multimedia midiOutXxx functions to access a device that implements OPL3-style FM synthesis. Theory of Operation
Because the sample is a synthesizer, it handles MIDI output only.
The MIDI port driver, which is implemented in the PortCls system driver module, portcls.sys, serves as a wrapper for the FMSynth sample miniport driver. Because the sample driver is a PortCls client, PortCls handles Plug and Play (PnP) and power management on behalf of the sample driver.
There are two GUIDs that an adapter driver can instantiate this miniport driver with:
- CLSID_MiniportDriverFmSynth
- CLSID_MiniportDriverFmSynthWithVol
The first is the standard mode that most clients use. However, if the audio device does not provide an analog volume control in the data path following the FM synthesizer (for example, the WSS device lacks a volume control), the second GUID, which implements an FM synthesizer with a built-in volume control, can be used instead.
The FMSynth sample driver is identical to the system-supplied FMSynth miniport driver in portcls.sys. The source code for this sample can serve as a starting point for developers who need to augment it, as well as for those who need to write completely new MIDI miniport drivers.
The sample is a miniport driver that interfaces to the MIDI port driver, which is available in all versions of portcls.sys, including the version in Windows 98 Gold. The MIDI port driver lacks support for the advanced MIDI features in Microsoft DirectMusic, which are supported by the DMus port driver. The DMus port driver was introduced into portcls.sys in Microsoft Windows 98 Second Edition (SE) and is available in Windows Me and in Microsoft Windows 2000 and later.
If you are creating your own miniport driver, consider the advantages of interfacing to DMus instead of MIDI:
- The DMus port driver provides higher functionality than the MIDI port driver.
- DMus miniport drivers are visible to DirectMusic applications, unlike MIDI miniport drivers. In addition, DMus miniport drivers are still visible to the older, Windows multimedia midiXxx functions.
In short, DMus miniport drivers have the benefits of backward compatibility and advanced functionality.
Please refer to the Sound Blaster 16 (SB16) sample to learn how to use the system-supplied FMSynth miniport driver in portcls.sys.
DirectMusic kernel support is not available in Windows 98. It is available only in Windows 98 SE and Windows Me and in Windows 2000 and later.
Building the Sample
Note This sample cannot be built for 64-bit targets.
To build the sample driver, run the build command in the WDK's src\wdm\audio\miniport\fmsynth directory. If the build succeeds, it produces the fmsynth.lib library module, which can be linked into an audio adapter driver.
Code Tour
File Manifest
| File | Description |
| fmsynth.htm | This sample documentation file |
| makefile | Make file |
| miniport.cpp | Implementation of FMSynth miniport driver |
| miniport.h | Parameter definitions for FM synthesizer |
| patch.h | Patch value definitions for FM synthesizer |
| private.h | Private definitions for FMSynth miniport driver |
| sources | Sources for build |
Build machine: CAPEBUILD