Music Technology GUIDs

A MIDI or DMus miniport driver must specify the range of stream formats that each of its pins is capable of handling. As described in Pin Factories, the driver specifies this information as an array of one or more data range descriptors, each of which is a structure of type KSDATARANGE_MUSIC. This structure's Technology member indicates what type of synthesizer technology the MIDI or DirectMusic device uses. A miniport driver can set the Technology member to one of the GUID values shown in the following table (left column).

KSDATARANGE_MUSIC Technology GUID MIDIOUTCAPS wTechnology Value Meaning

KSMUSIC_TECHNOLOGY_PORT

MOD_MIDIPORT

The device is an MPU-401 device.

KSMUSIC_TECHNOLOGY_SYNTH

MOD_SYNTH

The device is a synthesizer.

KSMUSIC_TECHNOLOGY_SQSYNTH

MOD_SQSYNTH

The device is a square-wave synthesizer.

KSMUSIC_TECHNOLOGY_FMSYNTH

MOD_FMSYNTH

The device is an FM synthesizer.

KSMUSIC_TECHNOLOGY_MAPPER

MOD_MAPPER

The device is the Microsoft MIDI mapper.

KSMUSIC_TECHNOLOGY_WAVETABLE

MOD_WAVETABLE

The device is a hardware wavetable synthesizer.

KSMUSIC_TECHNOLOGY_SWSYNTH

MOD_SWSYNTH

The device is a software synthesizer.

The midiOutGetDevCaps function translates the technology GUID that it receives from the driver to an index that it writes to the wTechnology member of the MIDIOUTCAPS structure that it outputs to the caller. The preceding table shows the wTechnology value (center column) corresponding to each technology GUID. For more information about midiOutGetDevCaps and MIDIOUTCAPS, see the Microsoft Windows SDK documentation.

When enumerating devices, a MIDI application that uses the Windows multimedia midiOut or midiIn API can see MIDI pins, but not DirectMusic pins. A DirectMusic application can see both MIDI and DirectMusic pins. A MIDI or DMus miniport driver identifies a MIDI pin by setting the subtype GUID in the pin's data ranges to KSDATAFORMAT_SUBTYPE_MIDI. A DMus miniport driver identifies a DirectMusic pin by setting the subtype GUID to KSDATAFORMAT_SUBTYPE_DIRECTMUSIC. For examples of data ranges for MIDI and DirectMusic pins, see MIDI Stream Data Range and DirectMusic Stream Data Range.

As explained in MIDI and DirectMusic Filters, an adapter driver calls the PcNewMiniport function to create an instance of one of the system-supplied miniport drivers in Portcls.sys. The caller specifies one of the driver GUIDs in the following table to specify which miniport driver to instantiate.

Driver GUID Technology GUID

CLSID_MiniportDriverDMusUART

KSMUSIC_TECHNOLOGY_PORT

CLSID_MiniportDriverDMusUARTCapture

KSMUSIC_TECHNOLOGY_PORT

CLSID_MiniportDriverFmSynth

KSMUSIC_TECHNOLOGY_FMSYNTH

CLSID_MiniportDriverFmSynthWithVol

KSMUSIC_TECHNOLOGY_FMSYNTH

CLSID_MiniportDriverUart

KSMUSIC_TECHNOLOGY_PORT

The right column of the preceding table indicates the technology GUID that the corresponding miniport driver specifies in its pins' data ranges. For example, the FmSynth miniport driver assigns the technology GUID KSMUSIC_TECHNOLOGY_FMSYNTH to its pins.

Some wavetable synthesizer devices expose themselves to applications as MPU-401 devices (with technology GUID KSMUSIC_TECHNOLOGY_PORT). In the absence of an external synthesizer, they are able to play a raw MIDI byte stream through the wavetable synthesizer.

However, the midiOut API prefers wavetable synthesizer devices (with technology GUID KSMUSIC_TECHNOLOGY_WAVETABLE) when selecting the default (preferred) MIDI playback device. It explicitly avoids selecting an MPU-401 device to be the default device.

To make itself eligible to be the default device, a wavetable device that can play raw MIDI should expose itself as a wavetable device, not an MPU-401 device. However, if an adapter driver is using the system-supplied MPU-401 miniport driver, DMusUART, to manage its wavetable synthesizer device, that miniport driver statically assigns the technology GUID KSMUSIC_TECHNOLOGY_PORT to its pins.

By calling the IMusicTechnology::SetTechnology method, an adapter driver can overwrite the technology GUIDs in a miniport driver's data ranges. In the following code example, an adapter driver changes the technology GUID in the DMusUART miniport driver's data ranges from its default value, KSMUSIC_TECHNOLOGY_PORT, to the value KSMUSIC_TECHNOLOGY_WAVETABLE. With this new setting, the MPU-like wavetable device is eligible to be selected by the midiOut API as the default MIDI device.

  // Create the miniport object.
  PUNKNOWN miniport;

  ntStatus = PcNewMiniport((PMINIPORT*)&miniport, CLSID_MiniportDriverDMusUART);

  // Query the miniport driver for the IMusicTechnology interface.
  IMusicTechnology* pMusicTechnology;

  if (NT_SUCCESS(ntStatus))
  {
      ntStatus = miniport->QueryInterface(IID_IMusicTechnology, (PVOID*)&pMusicTechnology);
  }

  // Set the Technology members in the DirectMusic data-range entries
  // for all the pins that are exposed by this miniport.
  // SetTechnology should be called before initializing the miniport.
  if (NT_SUCCESS(ntStatus))
  {
      ntStatus = pMusicTechnology->SetTechnology(&KSMUSIC_TECHNOLOGY_WAVETABLE);
  }

As indicated in the comment in the preceding code example, the adapter driver should call SetTechnology before calling the port driver's Init method (which, in turn, calls the miniport driver's Init method). The system-supplied DMusUART and UART miniport drivers both support the IMusicTechnology interface. For other miniport drivers, support for IMusicTechnology is optional. For more information, see the implementation of the SetTechnology method in the DMusUART sample audio driver in the Microsoft Windows Driver Kit (WDK).