NOW LOADING

WinRT API Endpoint Enumeration Overview


Namespace for finding the MIDI endpoints on the PC and reading what they can do
Windows.Devices.Midi2.Enumeration

This is where an application finds out what MIDI devices are on the PC, and what each of them can do. It’s the first namespace most applications touch.

MidiEndpointDeviceWatcher is the type to use. It reports the endpoints that are there when it starts, and then keeps reporting as devices arrive, change, and go away. Listing the endpoints once and saving the result isn’t enough on a modern PC: USB devices get unplugged, Bluetooth devices come and go on their own, and network devices show up when the other end is switched on.

Each endpoint is a MidiEndpointDeviceInformation, which is both the thing you display in a device list and the source of the endpoint device id you pass to MidiSession.CreateEndpointConnection.

What an endpoint tells you about itself, and who said so

The properties of an endpoint come from several different places. The namespace keeps them apart on purpose, because they don’t all carry the same weight.

Source Type What it is
The device, in protocol MidiDeclaredEndpointInfo, MidiDeclaredDeviceIdentity, MidiDeclaredStreamConfiguration What the device said about itself when it was asked, using UMP Stream messages
The transport MidiEndpointTransportSuppliedInfo What the transport knows, such as the name Windows has for the device and how it is connected
The customer MidiEndpointUserSuppliedInfo A name, description, image, and latency compensation someone set in MIDI Settings

A name the customer typed wins over a name the device gave, and a name the device gave wins over a name the transport came up with. Use the endpoint’s Name property instead of choosing one of these yourself. It makes that choice for you.

Groups and channels

MidiFunctionBlock is how a MIDI 2.0 device says which of its sixteen groups do what, which way they send, and what to call them. MidiGroupTerminalBlock is the same idea from the USB descriptors, for a USB device that has no function blocks.

Use function blocks when a device has both. A function block is what the device is saying now, and it can change while the device is connected. A group terminal block comes from the USB descriptors, which are read once when the device is connected and don’t change.

Timing

Endpoint discovery is a back-and-forth with the device, so an endpoint’s Added event can arrive before the device has finished answering. IsEndpointDiscoveryComplete tells you whether that’s done. Use it as a hint about when function blocks and declared names are worth reading, not as something to wait for before you open a connection. A transport that doesn’t do discovery in the protocol sets it as soon as the endpoint exists.

MidiEndpointDeviceInformationUpdatedEventArgs has a set of flags that say which groups of properties changed, so your update handler can read again only what changed, instead of everything.

An endpoint’s MIDI 1.0 ports are separate Windows devices, created after the endpoint itself. They raise their own notifications, and those can come in any order compared with the endpoint’s. An application that needs the ports has to watch for the ports, using MidiLegacyPortDeviceWatcher in Windows.Devices.Midi2.Enumeration.Legacy.

To learn what is and isn’t guaranteed here, and how to write a watcher that works anyway, see Endpoint arrival and update ordering.

Samples

Types in this namespace

Click or tap the type name to view more details.

Type Description
Midi1PortFlow Enumeration specifying the direction or flow of a MIDI 1.0 port.
Midi1PortNameTableEntry Represents the names generated when constructing a MIDI 1.0 port from a UMP device
Midi1PortNamingApproach Indicates how MIDI 1.0 port names are generated for a UMP endpoint
MidiDeclaredDeviceIdentity Endpoint-supplied identification information from MIDI 2.0 discovery or SysEx Discovery.
MidiDeclaredEndpointInfo Information declared by an endpoint during the MIDI 2.0 discovery process
MidiDeclaredStreamConfiguration Configuration information supplied by the endpoint.
MidiEndpointDeviceHelper Utility class for working with Windows MIDI Services endpoint device ids and specification-compliant names
MidiEndpointDeviceInformation Class containing all the information and metadata about an endpoint you can connect to
MidiEndpointDeviceInformationAddedEventArgs Arguments supplied by the watcher when an endpoint is added to the system
MidiEndpointDeviceInformationFilters Filter used when enumerating endpoints
MidiEndpointDeviceInformationRemovedEventArgs Arguments supplied by the watcher when an endpoint is removed from the system
MidiEndpointDeviceInformationSortOrder Specifies the sort order to use when enumerating a static list of devices.
MidiEndpointDeviceInformationUpdatedEventArgs Argument supplied by the watcher when the properties of an endpoint have been updated.
MidiEndpointDevicePropertyHelper Assists with understanding the GUID-based Windows MIDI Services device properties.
MidiEndpointDevicePurpose Indicates the intended use of an endpoint
MidiEndpointDeviceWatcher Recommended class to use when enumerating endpoints
MidiEndpointNativeDataFormat The data format that the device expects to send to and receive from Windows
MidiEndpointTransportSuppliedInfo Metadata for an endpoint supplied by the transport in the MIDI Service
MidiEndpointUserSuppliedInfo Custom information supplied by the user for an endpoint
MidiFunctionBlock Represents a MIDI 2.0 Function Block per the specification
MidiFunctionBlockDirection The flow direction for a function block, from the block's point of view
MidiFunctionBlockRepresentsMidi10Connection Indicates if a function block represents a MIDI 1.0 connection on the device
MidiFunctionBlockUIHint Specifies the primary use of a function block
MidiGroupTerminalBlock An optional and static definition of the use of groups for an endpoint
MidiGroupTerminalBlockDirection The message flow for a group terminal block, from the block's point of view
MidiGroupTerminalBlockProtocol The protocol information for a Group Terminal Block
MidiParentDeviceInformation Information about the parent device of a MIDI endpoint
MidiProtocol Indicates the protocol configuration for an endpoint, group, or function block

Didn't find what you were looking for?

Windows MIDI Services is an open source project with all source available on GitHub. We have a great community on Discord as well. Between GitHub and Discord, you should find the information you are looking for.