DMus Port Driver

The DMus port driver manages a Microsoft DirectMusic synthesizer or capture device. In contrast to the MIDI port driver, which supports only simple MIDI devices, the DMus port driver supports devices with advanced MIDI capabilities such as precision sequencer timing, downloadable sounds (DLS), and channel groups. The adapter driver implements a corresponding DMus miniport driver that binds to the DMus port driver to form a DirectMusic filter (see MIDI and DirectMusic Filters) that can render or capture a MIDI stream.

The DMus port driver exposes an IPortDMus interface to the miniport driver. IPortDMus inherits the methods in base interface IPort. IPortDMus provides the following additional methods:

IPortDMus::Notify

Notifies the port driver that the MIDI synthesizer or capture device has advanced to a new position in the MIDI stream.

IPortDMus::RegisterServiceGroup

Registers a service group object with the port driver. The registered service group contains a list of one or more service routines that are called by the port driver when the miniport driver calls Notify; for more information, see Service Sink and Service Group Objects.

The DMus port driver also creates a memory allocator for each stream and exposes the allocator's IAllocatorMXF interface to the miniport driver's stream object. IAllocatorMXF inherits the methods in base interface IMXF. IAllocatorMXF provides the following additional methods:

IAllocatorMXF::GetBuffer

Gets a buffer for a MIDI event or list of events that is too large to fit within a DMUS_KERNEL_EVENT structure.

IAllocatorMXF::GetBufferSize

Gets the size in bytes of the buffer retrieved by the GetBuffer method.

IAllocatorMXF::GetMessage

Gets a message buffer containing storage for a single structure of type DMUS_KERNEL_EVENT.

IAllocatorMXF::PutBuffer

Not used. The DMus port and miniport driver objects communicate with each other through their respective IPortDMus and IMiniportMidi interfaces. In addition, the port driver communicates with the miniport driver's stream objects through their IMXF interfaces, and a miniport driver's stream object communicates with the port driver's allocator through its IAllocatorMXF interface.

For more information about driver support for DirectMusic, see Synthesizer Miniport Driver Overview.

In Windows XP and later, the IPortDMus and IPortMidi interfaces are both implemented in a single internal driver module. This consolidation is facilitated by the similarity of these two interfaces. For example, the same methods are defined for both interfaces. Applications written for previous versions of Windows should see no change in the behavior of the IPortMidi and IPortDMus interfaces resulting from consolidation of the MIDI and DMus port drivers.