Skip to content

Commit

Permalink
Merge pull request #358 from microsoft/pete-dev
Browse files Browse the repository at this point in the history
Dev Preview 6
  • Loading branch information
Psychlist1972 authored Jul 14, 2024
2 parents b584476 + 081557a commit 5ce7a5b
Show file tree
Hide file tree
Showing 230 changed files with 2,695 additions and 7,227 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,5 @@ build/dependencies/winui/WindowsAppRuntimeInstall-arm64.exe
*.zip
*.debugtarget
*.winmd
*.dll
*.exe
1 change: 1 addition & 0 deletions build/nuke_build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ class Build : NukeBuild

// MIDI diagnostics app
FileSystemTasks.CopyFileToDirectory(sdkOutputRootFolder / "mididiag" / platform / Configuration.Release / $"mididiag.exe", AppSdkStagingFolder / platform, FileExistsPolicy.Overwrite, true);
FileSystemTasks.CopyFileToDirectory(sdkOutputRootFolder / "mididiag" / platform / Configuration.Release / $"mididiag.exe.manifest", AppSdkStagingFolder / platform, FileExistsPolicy.Overwrite, true);

// sample manifest
FileSystemTasks.CopyFileToDirectory(AppSdkSolutionFolder / "MyMidiApp.exe.manifest", AppSdkStagingFolder / platform, FileExistsPolicy.Overwrite, true);
Expand Down
Binary file modified build/staging/app-sdk/Arm64EC/mididiag.exe
Binary file not shown.
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 6 x64" ?>
<?define SetupVersionNumber="1.0.24182.1741" ?>
<?define SetupVersionNumber="1.0.24194.2233" ?>
</Include>
55 changes: 55 additions & 0 deletions docs/data-translation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
layout: page
title: Data Translation
has_children: false
---

# Data Translation

In general, Windows MIDI Services translates MIDI messages only when it absolutely has to (primarily to support MIDI 1.0 devices or MIDI 1.0 APIs). This translation happens in different places, depending upon the driver in use.

Internally, the MIDI service moves messages around in the UMP format. This enables a standard format for message scheduling and processing. In addition, the `Microsoft.Windows.Devices.Midi2*` SDK and the service behind it, both treat all messages as UMP, including ones to/from devices which were MIDI 1.0 byte data format.

## A couple definitions






## Translation Scenarios involving data format changes

Windows MIDI Services supports both MIDI 1.0 and MIDI 2.0 devices.

| Device | Driver | Windows.Devices.Midi2 | Older MIDI 1.0 APIs |
| ------------------- | --------------------- | -------------------------- | ------------------------ |
| USB MIDI 1.0 Device | MIDI 2.0 Class Driver | To/From MIDI 1.0 in UMP by driver | To/from MIDI 1.0 byte data format by service |
| USB MIDI 1.0 Device | Older MIDI 1.0 Class Driver | To/From MIDI 1.0 in UMP by service | To/from MIDI 1.0 byte data format by service |
| USB MIDI 1.0 Device | Vendor MIDI 1.0 driver | To/From UMP by service | To/From MIDI 1.0 byte data format by service |
| USB MIDI 2.0 Device | MIDI 2.0 Class Driver | No translation required | To/from MIDI 1.0 byte data format by service |
| Any other MIDI 2.0 Device | (no driver. ex Virtual, Network 2.0) | No translation required | To/from MIDI 1.0 byte data format by service |
| Any other MIDI 1.0 Device | (no driver. ex BLE) | To/From UMP by service | To/From MIDI 1.0 byte data format by service |

### Translation between Message type 2 (MIDI 1.0 Channel Voice) and Message type 4 (MIDI 2.0 Channel Voice)

Currently, Windows MIDI Services does not translate messages based on negotiated protocol or Function Block declared protocol. Instead, for native UMP endpoints, applications should send the correct protocol messages (message type 2 for MIDI 1.0-compatible and message type 4 for MIDI 2.0-compatible messages) based upon the information provided by the `MidiEndpointDeviceInformation` class. In addition, for native MIDI 1.0 byte data format endpoints, applications should send the appropriate MIDI 1.0 messages in UMP.

If a MIDI 1.0 device is connected to the new MIDI 2.0 Class Driver, Windows MIDI Services *will* downscale Message Type 4 to Message Type 2 before sending to the driver. This is because the driver, when working with a MIDI 1.0 device, only handles UMP messages which can be directly translated to MIDI 1.0 data format.

### Translation based on declared protocol for a Function Block or Group Terminal

As mentioned above, Windows MIDI Services does not filter out or translate messages based on the declared protocol. Applications should use the Function Block (preferred) or Group Terminal Block (backup) data to decide which protocol to use when sending messages. However, Windows will not stop an application from sending a MIDI 2.0 Protocol in UMP message to a Group in a Function Block which specifies MIDI 1.0 Protocol.

To learn more about metadata like Function Blocks, see the section on Enumerating endpoints.

### Translation of Note On with zero velocity to Note Off

Windows MIDI Services does not, by default, translate a MIDI 1.0 Note On with zero velocity to a MIDI 1.0 Note Off message. Doing so would break the Mackie protocol and possibly others.

When translating between MIDI 2.0 Protocol in UMP and MIDI 1.0 protocol (MIDI 1.0 byte data format, or MIDI 1.0 protocol in UMP), Windows MIDI Services follows the MIDI 2.0 UMP specification and translates a MIDI 1.0 Note On with a zero velocity to a MIDI 2.0 Note On with a velocity of 1. However, there is no code, outside of the SDK helper functions, which does this today, as incoming MIDI 1.0 byte data format messages are always translated into MIDI 1.0 protocol in UMP. We do, however, downscale MIDI 2.0 Protocol in UMP to MIDI 1.0 byte data format when required, as per above.

## Resources for translation

Windows MIDI Services makes use of publicly-available open source libraries for protocol and data format translation.

* [midi2.dev](https://midi2.dev) contains a number of libraries which include translation.
36 changes: 0 additions & 36 deletions docs/other-developer-docs/data-translation.md

This file was deleted.

8 changes: 4 additions & 4 deletions samples/cpp-winrt/basics/client-basics-cpp.vcxproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" />
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" />
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
Expand Down Expand Up @@ -167,15 +167,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" />
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets'))" />
</Target>
</Project>
2 changes: 1 addition & 1 deletion samples/cpp-winrt/basics/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.24173.1521-preview.6" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.24193.2220-preview.6" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" />
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" />
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<CppWinRTOptimized>true</CppWinRTOptimized>
Expand Down Expand Up @@ -157,15 +157,15 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" />
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" />
<Import Project="..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets" Condition="Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24173.1521-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.Devices.Midi2.1.0.24193.2220-preview.6\build\native\Microsoft.Windows.Devices.Midi2.targets'))" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions samples/cpp-winrt/loopback-endpoints/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ int main()
// If you don't do this, they will stay active, and the next attempt
// to create them will fail because the unique Ids are already in use

MidiLoopbackEndpointDeletionConfig deletionConfig(m_associationId);
MidiLoopbackEndpointRemovalConfig removalConfig(m_associationId);

if (MidiLoopbackEndpointManager::RemoveTransientLoopbackEndpoints(deletionConfig))
if (MidiLoopbackEndpointManager::RemoveTransientLoopbackEndpoints(removalConfig))
{
std::cout << "Loopback endpoints removed." << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/loopback-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.24173.1521-preview.6" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.24193.2220-preview.6" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion samples/cpp-winrt/send-speed/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.24173.1521-preview.6" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.24193.2220-preview.6" targetFramework="native" />
</packages>
Loading

0 comments on commit 5ce7a5b

Please sign in to comment.