Skip to content

Commit

Permalink
Additional documentation and a few more API updates while I was at it.
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychlist1972 committed Feb 9, 2024
1 parent 31e7977 commit d5d2ca2
Show file tree
Hide file tree
Showing 27 changed files with 518 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build/staging/version/BundleInfo.wxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Include>
<?define SetupVersionName="Developer Preview 5" ?>
<?define SetupVersionNumber="1.0.24039.1932" ?>
<?define SetupVersionNumber="1.0.24039.2143" ?>
</Include>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ You can learn more about high-resolution timestamps in Windows at [https://aka.m
| --------------- | ----------- |
| `Now` | Returns the current timestamp |
| `TimestampFrequency` | Returns the number of timestamp ticks per second. This is calculated the first time it is called, and then cached for future calls. |
| `TimestampConstantSendImmediately` | Returns the constant to use when you want to send messages immediately and bypass outgoing message scheduling. Developers may use this value or simply provide `0` in place of the timestamp when sending messages. |

## Static Functions

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
layout: api_page
title: IMidiEndpointConnectionSource
parent: Connections
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# IMidiEndpointConnectionSource

Marker interface which is used to prevent circular references in the API, specifically with message processing plugins. This interface is only supported when used by the `MidiEndpointConnection` class.

## IDL

[IMidiEndpointConnectionSource IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/IMidiEndpointConnectionSource.idl)

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
layout: api_page
title: IMidiMessageReceivedEventSource
parent: Connections
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# IMidiMessageReceivedEventSource

Interface which contains the event definition used by any class which raises the `MessageReceived` event. This is defined in an interface so that message processing plugins and the `MidiEndpointConnection` type can be used interchangeably in an event handler.

## Events

| Event | Description |
| -------- | ----------- |
| `MessageReceived(source, args)` | The main message received event definition. |

## IDL

[IMidiMessageReceivedEventSource IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/IMidiMessageReceivedEventSource.idl)

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
layout: api_page
title: MidiSendMessageResult
parent: Connections
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiSendMessageResult

When an application sends a message, it should check the result of sending to ensure that the message was transmitted. Each of the message sending functions returns a `MidiSendMessageResult` flags enum. Values in this enum are OR'd together to indicate success or failure, and in the case of failure, the reason.

The `MidiEndpointConnection` type includes static helper functions to process the `MidiSendMessageResult` and determine success or failure. The application may then optionally look at the remaining data to see which failure reason(s) apply.

```cpp
auto sendResult = myConnection.SendMessageWords(MidiClock::TimestampConstantSendImmediately(), 0x28675309);

if (MidiEndpointConnection::SendMessageSucceeded(sendResult))
{
// do something in the case of success
}
else
{
// one or more failure reasons in the result. Use bitwise AND `&` operator to decipher.
}

```

## Properties

| Property | Value | Description |
| -------- | ----- | ----------- |
| `Succeeded` | `0x80000000` | Indicates success. |
| `Failed` | `0x10000000` | Indicates failure. The actual failure reason will be combined with the result. |
| `BufferFull` | `0x00010000` | The message could not be sent because the outgoing buffer to the service was full |
| `EndpointConnectionClosedOrInvalid` | `0x00040000` | The endpoint connection was closed or invalidated before the message could be sent. |
| `InvalidMessageTypeForWordCount` | `0x00100000` | The number of words sent does not match the message type of the first word. |
| `InvalidMessageOther` | `0x00200000` | The message sent was invalid for another reason. |
| `DataIndexOutOfRange` | `0x00400000` | Reading a full message would result in overrunning the provided array, collection, or buffer. |
| `TimestampOutOfRange` | `0x00800000` | The provided timestamp is too far in the future to be scheduled. |
| `MessageListPartiallyProcessed` | `0x00A00000` | The message list was only partially processed. Not all messages were sent. |
| `Other` | `0x01000000` | Other reason that cannot be determined. |

## IDL

[MidiSendMessageResult IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiSendMessageResult.idl)

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: api_page
title: MidiEndpointDeviceInformationFilter
parent: Endpoint Enumeration
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiEndpointDeviceInformationFilter Enumeration

When enumerating devices, it is helpful to be able to filter for different types of devices. For example, an application providing diagnostic or development services may want to enumerate the diagnostic loopback endpoints. A Digital Audio Workstation, on the other hand, would only want to enumerate the normal UMP and Byte Stream native endpoints.

## Properties

| Property | Value | Description |
| --------------- | ---------- | ----------- |
| `IncludeClientUmpNative` | `0x00000001` | Include endpoints which are MIDI UMP endpoints natively. These are typically considered MIDI 2.0 devices even if they only send MIDI 1.0 messages in UMP. |
| `IncludeClientByteStreamNative` | `0x00000002` | Include endpoints which are MIDI 1.0 byte stream endpoints natively. These are converted to UMP internally in Windows MIDI Services. |
| `IncludeVirtualDeviceResponder` | `0x00000100` | Include endpoints which are virtual devices. Note that this is the device side of the endpoint, not the side available to other applications. Typically, you would not use this. |
| `IncludeDiagnosticLoopback` | `0x00010000` | Use this value only when providing development, test, or diagnostic services for MIDI. |
| `IncludeDiagnosticPing` | `0x00020000` | You would not normally include this in an enumeration. This endpoint is internal. |
| `AllTypicalEndpoints` | `IncludeClientUmpNative | IncludeClientByteStreamNative` | This is the value most applications should use, and is the default. |

## IDL

[MidiEndpointDeviceInformationFilterEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiEndpointDeviceInformationFilterEnum.idl)

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
layout: api_page
title: MidiEndpointDeviceInformationSortOrder
parent: Endpoint Enumeration
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiEndpointDeviceInformationSortOrder Enumeration

Specifies the sort order to use when enumerating a static list of devices.

## Properties

| Property | Value | Description |
| --------------- | ---------- | ----------- |
| `None` | `0` | No sort. Return in default order |
| `Name` | `1` | Sort by the name of the endpoint |
| `EndpointDeviceId` | `2` | Sort by the id of the endpoint (the SWD id) |
| `DeviceInstanceId` | `3` | Sort by the device instance id |
| `ContainerThenName` | `11` | Sort by the container and then by name. This is helpful when you want endpoints grouped by parent. |
| `ContainerThenEndpointDeviceId` | `12` | Sort by the container and then by the endpoint id |
| `ContainerThenDeviceInstanceId` | `13` | Sort by the container and then by the device instance id |
| `TransportMnemonicThenName` | `21` | Sort by the transport mnemonic (example: "DIAG") and then by the device instance id |
| `TransportMnemonicThenEndpointDeviceId` | `22` | Sort by the transport mnemonic and then by the endpoint id |
| `TransportMnemonicThenDeviceInstanceId` | `23` | Sort by the transport mnemonic and then by the device instance id |

## IDL

[MidiEndpointDeviceInformationSortOrderEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiEndpointDeviceInformationSortOrderEnum.idl)

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: api_page
title: MidiEndpointDevicePurpose
parent: Endpoint Enumeration
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiEndpointDevicePurpose Enumeration

Indicates the intended purpose of the endpoint. Use this to help classify endpoints you show to users in your application. This value is also used internally when filtering endpoints per the `MidiEndpointDeviceInformationFilter` enumeration.

## Properties

| Property | Value | Description |
| --------------- | ---------- | ----------- |
| `NormalMessageEndpoint` | `0` | The endpoint is any number of normal messaging endpoint types. |
| `VirtualDeviceResponder` | `100` | The endpoint is the device-side of an app-to-app MIDI connection. Only the device app should use this endpoint. |
| `InBoxGeneralMidiSynth` | `400` | The endpoint represents the internal General MIDI Synthesizer |
| `DiagnosticLoopback` | `500` | The endpoint is one of the static system-wide diagnostics loopback endpoints. These are not normally used in applications |
| `DiagnosticPing` | `510` | The endpoint is the internal diagnostics ping endpoint. This endpoint should never be used by applications as it is reserved for the `MidiService` ping feature. |

## IDL

[MidiEndpointDevicePurposeEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiEndpointDevicePurposeEnum.idl)

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: api_page
title: Midi1ChannelVoiceMessageStatus
parent: Messages
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# Midi1ChannelVoiceMessageStatus Enumeration

Status to use for MIDI 1.0 Channel Voice messages. Note that not all MIDI 1.0 messages are channel voice messages, so this is not an exhaustive list of MIDI 1.0 messages. However, this is the total set of MIDI 1.0 messages which can be used in a MIDI Universal MIDI Packet Message type 2.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `NoteOff` | `0x8` | MIDI 1.0 Note Off message |
| `NoteOn` | `0x9` | MIDI 1.0 Note On message |
| `PolyPressure` | `0xA` | MIDI 1.0 polyphonic pressure message |
| `ControlChange` | `0xB` | MIDI 1.0 control change message |
| `ProgramChange` | `0xC` | MIDI 1.0 program change message |
| `ChannelPressure` | `0xD` | MIDI 1.0 channel pressure message |
| `PitchBend` | `0xE` | MIDI 1.0 pitch bend message |

## IDL

[Midi1ChannelVoiceMessageStatusEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/Midi1ChannelVoiceMessageStatusEnum.idl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: api_page
title: Midi2ChannelVoiceMessageStatus
parent: Messages
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# Midi2ChannelVoiceMessageStatus Enumeration

Status to use for MIDI 2.0 Channel Voice messages. These are message type 4 messages.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `RegisteredPerNoteController` | `0x0` | MIDI 2.0 Registered per-note controller message |
| `AssignablePerNoteController` | `0x1` | MIDI 2.0 Assignable per-note controller message |
| `RegisteredController` | `0x2` | MIDI 2.0 Registered controller message |
| `AssignableController` | `0x3` | MIDI 2.0 Assignable controller message |
| `RelativeRegisteredController` | `0x4` | MIDI 2.0 Relative registered controller message |
| `RelativeAssignableController` | `0x5` | MIDI 2.0 Relative assignable controller message |
| `PerNotePitchBend` | `0x6` | MIDI 2.0 per-note pitch bend message |
| `NoteOff` | `0x8` | MIDI 2.0 Note Off message |
| `NoteOn` | `0x9` | MIDI 2.0 Note On message |
| `PolyPressure` | `0xA` | MIDI 2.0 polyphonic pressure message |
| `ControlChange` | `0xB` | MIDI 2.0 control change message |
| `ProgramChange` | `0xC` | MIDI 2.0 program change message |
| `ChannelPressure` | `0xD` | MIDI 2.0 channel pressure message |
| `PitchBend` | `0xE` | MIDI 2.0 pitch bend message |
| `PerNoteManagement` | `0xF` | MIDI 2.0 per-note management message |

## IDL

[Midi2ChannelVoiceMessageStatusEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/Midi2ChannelVoiceMessageStatusEnum.idl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: api_page
title: MidiEndpointDiscoveryFilterFlags
parent: Messages
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiEndpointDiscoveryFilterFlags Enumeration

Used to indicate which endpoint discovery messages you want to receive when you query an endpoint.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `None` | `0x00000000` | Request nothing. |
| `RequestEndpointInformation` | `0x00000001` | Request the details of the endpoint. |
| `RequestDeviceIdentity` | `0x00000002` | Request identity information including System Exclusive Ids and version information |
| `RequestEndpointName` | `0x00000004` | Request endpoint name messages |
| `RequestProductInstanceId` | `0x00000008` | Request product instance id messages |
| `RequestStreamConfiguration` | `0x00000010` | Request the stream configuration |


## IDL

[MidiEndpointDiscoveryFilterFlagsEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiEndpointDiscoveryFilterFlagsEnum.idl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
layout: api_page
title: MidiFunctionBlockDiscoveryFilterFlags
parent: Messages
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiFunctionBlockDiscoveryFilterFlags Enumeration

Used to indicate which function block messages you want to receive when you request function blocks.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `None` | `0x00000000` | No information requested |
| `RequestFunctionBlockInformation` | `0x00000001` | Request the core function block information |
| `RequestFunctionBlockName` | `0x00000002` | Request a set of function block name messages |

## IDL

[MidiFunctionBlockDiscoveryFilterFlagsEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryFilterFlagsEnum.idl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: api_page
title: MidiSystemExclusive8Status
parent: Messages
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiSystemExclusive8Status Enumeration

Used to indicate the type of System Exclusive 8 Universal MIDI Packet (UMP) as per the MIDI 2.0 UMP specification.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `CompleteMessageInSingleMessagePacket` | `0x0` | |
| `StartMessagePacket` | `0x1` | |
| `ContinueMessagePacket` | `0x2` | |
| `EndMessagePacket` | `0x3` | |

## IDL

[MidiSystemExclusive8StatusEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiSystemExclusive8StatusEnum.idl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: api_page
title: MidiFunctionBlockDirection
parent: Metadata
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiFunctionBlockDirection Enumeration

Indicates the message flow for a function block. Note that this is, per the specification, from the function block's point of view. So, for example, a function block specifying `BlockOutput` would be a sender of messages, and therefore used as an input in the API.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `Undefined` | `0x0` | Unknown or undefined |
| `BlockInput` | `0x1` | This block represents an input function, from the block's point of view. |
| `BlockOutput` | `0x2` | This block represents an output function, from the block's point of view. |
| `Bidirectional` | `0x3` | This block represents a bidirectional function. |

## IDL

MidiFunctionBlockDirectionEnum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiFunctionBlockDirectionEnum.idl)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
layout: api_page
title: MidiFunctionBlockMidi10
parent: Metadata
grand_parent: Windows.Devices.Midi2 API
has_children: false
---

# MidiFunctionBlockMidi10 Enumeration

Indicates the MIDI 1.0 capability restrictions for a function block. Note that Windows MIDI Services does not currently throttle the speed of outbound messages, even if the block indicates it has restricted bandwidth.

## Properties

| Property | Value | Description |
| -------- | ------- | ------ |
| `Not10` | `0x0` | This function block is not a MIDI 1.0 function. |
| `YesBandwidthUnrestricted` | `0x1` | This block represents a MIDI 1.0 function, but has the ability to receive messages faster than the original MIDI 1.0 protocol speed. |
| `YesBandwidthRestricted` | `0x2` | This block represents a MIDI 1.0 function, and applications should take care to send messages to it at the normal MIDI 1.0 protocol speed. |
| `Reserved` | `0x3` | Reserved for future use. |

## IDL

MidiFunctionBlockMidi10Enum IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiFunctionBlockMidi10Enum.idl)
Loading

0 comments on commit d5d2ca2

Please sign in to comment.