The DirectMusic port driver, PortDMus, is involved on the front and back sides of the miniport driver's synthesizer work. PortDMus inputs a MIDI stream that consists of time-stamped MIDI data and routes the stream to the sequencer. The sequencer removes the time stamps and passes the raw MIDI messages to the miniport driver when their time stamps are due. (DLS data passes right through PortDMus to the miniport driver with no preprocessing.)
When miniport driver input gets converted to wave data, its output is managed by the synth sink (also called a "render sink" or "wave sink") in PortDMus.
PortDMus is a kernel-streaming filter with an input pin that accepts DirectMusic data from the DirectMusic user-mode component, dmusic.dll. PortDMus also has a wave-output pin that emits the synthesized audio stream. The synth sink manages this pin and tells the synth where in memory to write its data. This arrangement insulates the synth from the details of kernel streaming. Your DMus miniport driver needs only to deal with the details of synthesizing wave data from the input MIDI stream. PortDMus sends the wave data out to the system, and SysAudio's filter graph connects the filters to make everything flow correctly.

Flow of MIDI and DLS Data Through PortDMus Driver
As shown in the preceding diagram, MIDI data comes into the port driver (PortDMus) and, after sequencing, is passed to the miniport driver. The miniport driver converts the MIDI data to wave format, which is rendered into a buffer that is designated by another part of the PortDMus, the synth sink. Then, instead of going out to DirectSound as it does in user mode, the wave output goes to the audio hardware through the KMixer system driver. DirectSound is really just an API that exposes KMixer, and DirectSound acceleration consists of the mixer functions being accelerated in hardware instead of emulated in software by KMixer.
The SysAudio system driver, which builds the audio filter graph, connects PortDMus to a piece of hardware. The synth sink portion of the PortDMus hands the data out through its wave-out pin, which SysAudio can connect to the hardware device. It pulls wave data from the miniport driver (without regard to whether it is a hardware or software synth), and handles all timing issues. Compared to user mode, the miniport driver is analogous to the synth, whereas the synth sink is just part of PortDMus.
If a miniport driver can provide its output back to the host, it exposes a wave pin with a data direction of KSPIN_DATAFLOW_OUT (see KSPIN), which SysAudio recognizes and connects to KMixer.