diff --git a/.gitignore b/.gitignore index 19c706f4d..0ae8a5932 100644 --- a/.gitignore +++ b/.gitignore @@ -375,3 +375,5 @@ build/dependencies/winui/WindowsAppRuntimeInstall-arm64.exe *.zip *.debugtarget *.winmd +*.dll +*.exe diff --git a/build/nuke_build/Build.cs b/build/nuke_build/Build.cs index d3b342212..8a5ce58f1 100644 --- a/build/nuke_build/Build.cs +++ b/build/nuke_build/Build.cs @@ -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); diff --git a/build/staging/app-sdk/Arm64EC/mididiag.exe b/build/staging/app-sdk/Arm64EC/mididiag.exe index 6e829a9a2..cb259849e 100644 Binary files a/build/staging/app-sdk/Arm64EC/mididiag.exe and b/build/staging/app-sdk/Arm64EC/mididiag.exe differ diff --git a/build/staging/version/BundleInfo.wxi b/build/staging/version/BundleInfo.wxi index 295715c9e..815bf2805 100644 --- a/build/staging/version/BundleInfo.wxi +++ b/build/staging/version/BundleInfo.wxi @@ -1,4 +1,4 @@ - + diff --git a/docs/data-translation.md b/docs/data-translation.md new file mode 100644 index 000000000..d85d33792 --- /dev/null +++ b/docs/data-translation.md @@ -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. diff --git a/docs/other-developer-docs/data-translation.md b/docs/other-developer-docs/data-translation.md deleted file mode 100644 index e933e1fb6..000000000 --- a/docs/other-developer-docs/data-translation.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -layout: page -title: Data Translation -parent: For Developers ---- - -# Data Translation - -In general, Windows MIDI Services translates MIDI messages only when it has to. This translation happens in two 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 `Windows.Devices.Midi2` API treats all messages as UMP, including ones to/from devices which were bytestream MIDI 1.0 format. - -## Translation Scenarios involving data format changes - -Windows MIDI Services supports 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 UMP by driver | To/from byte stream by service | -| USB MIDI 1.0 Device | Older MIDI 1.0 Class Driver | To/From UMP by service | To/from byte stream by service | -| USB MIDI 1.0 Device | Vendor MIDI 1.0 driver | To/From UMP by service | To/From byte stream by service | -| USB MIDI 2.0 Device | MIDI 2.0 Class Driver | No translation required | To/from byte stream by service | -| Any other MIDI 2.0 Device | (no driver. ex Virtual, Network 2.0) | No translation required | To/from byte stream by service | -| Any other MIDI 1.0 Device | (no driver. ex BLE) | To/From UMP by service | To/From byte stream 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 `EndpointDeviceInformation` class. In addition, for native byte 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. - -## 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. diff --git a/samples/cpp-winrt/basics/client-basics-cpp.vcxproj b/samples/cpp-winrt/basics/client-basics-cpp.vcxproj index 8f0fe8883..902540f5d 100644 --- a/samples/cpp-winrt/basics/client-basics-cpp.vcxproj +++ b/samples/cpp-winrt/basics/client-basics-cpp.vcxproj @@ -1,6 +1,6 @@ - + true @@ -167,7 +167,7 @@ - + @@ -175,7 +175,7 @@ - - + + \ No newline at end of file diff --git a/samples/cpp-winrt/basics/packages.config b/samples/cpp-winrt/basics/packages.config index 565dc83e6..0ef7cb1b4 100644 --- a/samples/cpp-winrt/basics/packages.config +++ b/samples/cpp-winrt/basics/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj b/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj index 0c61e34f1..19f2f5318 100644 --- a/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/loopback-endpoints/loopback-endpoints-cpp.vcxproj @@ -1,6 +1,6 @@ - + true @@ -157,7 +157,7 @@ - + @@ -165,7 +165,7 @@ - - + + \ No newline at end of file diff --git a/samples/cpp-winrt/loopback-endpoints/main.cpp b/samples/cpp-winrt/loopback-endpoints/main.cpp index a45f4747d..2be905d76 100644 --- a/samples/cpp-winrt/loopback-endpoints/main.cpp +++ b/samples/cpp-winrt/loopback-endpoints/main.cpp @@ -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; } diff --git a/samples/cpp-winrt/loopback-endpoints/packages.config b/samples/cpp-winrt/loopback-endpoints/packages.config index 565dc83e6..0ef7cb1b4 100644 --- a/samples/cpp-winrt/loopback-endpoints/packages.config +++ b/samples/cpp-winrt/loopback-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/send-speed/packages.config b/samples/cpp-winrt/send-speed/packages.config index 565dc83e6..0ef7cb1b4 100644 --- a/samples/cpp-winrt/send-speed/packages.config +++ b/samples/cpp-winrt/send-speed/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj b/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj index 555ecd7cf..274887ad0 100644 --- a/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj +++ b/samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj @@ -1,6 +1,6 @@ - + true @@ -167,7 +167,7 @@ - + @@ -175,7 +175,7 @@ - - + + \ No newline at end of file diff --git a/samples/cpp-winrt/static-enum-endpoints/packages.config b/samples/cpp-winrt/static-enum-endpoints/packages.config index 565dc83e6..0ef7cb1b4 100644 --- a/samples/cpp-winrt/static-enum-endpoints/packages.config +++ b/samples/cpp-winrt/static-enum-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj b/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj index 2b3d4de17..5b8bffeb9 100644 --- a/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/static-enum-endpoints/static-enum-endpoints-cpp.vcxproj @@ -1,6 +1,6 @@ - + true @@ -167,7 +167,7 @@ - + @@ -175,7 +175,7 @@ - - + + \ No newline at end of file diff --git a/samples/cpp-winrt/virtual-device-app-winui/packages.config b/samples/cpp-winrt/virtual-device-app-winui/packages.config index 1499ba73c..53a94dcbb 100644 --- a/samples/cpp-winrt/virtual-device-app-winui/packages.config +++ b/samples/cpp-winrt/virtual-device-app-winui/packages.config @@ -1,7 +1,7 @@  - + diff --git a/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj b/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj index af1983693..7baef6d17 100644 --- a/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj +++ b/samples/cpp-winrt/virtual-device-app-winui/virtual-device-app-winui.vcxproj @@ -1,7 +1,7 @@  + - @@ -187,8 +187,8 @@ - + @@ -199,9 +199,9 @@ - - + + \ No newline at end of file diff --git a/samples/cpp-winrt/watch-endpoints/packages.config b/samples/cpp-winrt/watch-endpoints/packages.config index 565dc83e6..0ef7cb1b4 100644 --- a/samples/cpp-winrt/watch-endpoints/packages.config +++ b/samples/cpp-winrt/watch-endpoints/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj b/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj index bfce23ce2..c10f08db3 100644 --- a/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj +++ b/samples/cpp-winrt/watch-endpoints/watch-endpoints-cpp.vcxproj @@ -1,6 +1,6 @@ - + true @@ -167,7 +167,7 @@ - + @@ -175,7 +175,7 @@ - - + + \ No newline at end of file diff --git a/samples/csharp-net/basics/client-basics-cs.csproj b/samples/csharp-net/basics/client-basics-cs.csproj index 9564aa30c..a6f4e5b8a 100644 --- a/samples/csharp-net/basics/client-basics-cs.csproj +++ b/samples/csharp-net/basics/client-basics-cs.csproj @@ -11,7 +11,13 @@ - + + + + + + PreserveNewest + diff --git a/samples/csharp-net/basics/client-basics-cs.exe.manifest b/samples/csharp-net/basics/client-basics-cs.exe.manifest new file mode 100644 index 000000000..678ef4374 --- /dev/null +++ b/samples/csharp-net/basics/client-basics-cs.exe.manifest @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/csharp-net/csharp-net-samples.sln b/samples/csharp-net/csharp-net-samples.sln index 1a9f9a62d..83b57d564 100644 --- a/samples/csharp-net/csharp-net-samples.sln +++ b/samples/csharp-net/csharp-net-samples.sln @@ -11,46 +11,32 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "virtual-device-app-wpf", "v EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 - Release|Any CPU = Release|Any CPU Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Debug|Any CPU.Build.0 = Debug|Any CPU {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Debug|ARM64.ActiveCfg = Debug|Any CPU {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Debug|ARM64.Build.0 = Debug|Any CPU {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Debug|x64.ActiveCfg = Debug|x64 {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Debug|x64.Build.0 = Debug|x64 - {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Release|Any CPU.Build.0 = Release|Any CPU {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Release|ARM64.ActiveCfg = Release|Any CPU {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Release|ARM64.Build.0 = Release|Any CPU {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Release|x64.ActiveCfg = Release|x64 {1CC716E5-9D3D-4402-9169-9E7D2B76540B}.Release|x64.Build.0 = Release|x64 - {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Debug|Any CPU.ActiveCfg = Debug|x64 - {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Debug|Any CPU.Build.0 = Debug|x64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Debug|ARM64.ActiveCfg = Debug|ARM64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Debug|ARM64.Build.0 = Debug|ARM64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Debug|x64.ActiveCfg = Debug|x64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Debug|x64.Build.0 = Debug|x64 - {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Release|Any CPU.ActiveCfg = Release|x64 - {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Release|Any CPU.Build.0 = Release|x64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Release|ARM64.ActiveCfg = Release|ARM64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Release|ARM64.Build.0 = Release|ARM64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Release|x64.ActiveCfg = Release|x64 {B2A27EAA-93BA-4FA4-AFDA-62CD5031950A}.Release|x64.Build.0 = Release|x64 - {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Debug|Any CPU.Build.0 = Debug|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Debug|ARM64.ActiveCfg = Debug|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Debug|ARM64.Build.0 = Debug|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Debug|x64.ActiveCfg = Debug|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Debug|x64.Build.0 = Debug|Any CPU - {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Release|Any CPU.Build.0 = Release|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Release|ARM64.ActiveCfg = Release|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Release|ARM64.Build.0 = Release|Any CPU {51C95EAA-B943-4DC6-92C8-855A6C50DBC1}.Release|x64.ActiveCfg = Release|Any CPU diff --git a/samples/csharp-net/virtual-device-app-winui/MainWindow.xaml.cs b/samples/csharp-net/virtual-device-app-winui/MainWindow.xaml.cs index 3b7511509..da3ed0759 100644 --- a/samples/csharp-net/virtual-device-app-winui/MainWindow.xaml.cs +++ b/samples/csharp-net/virtual-device-app-winui/MainWindow.xaml.cs @@ -76,35 +76,53 @@ private void StartVirtualDevice() { try { - - System.Diagnostics.Debug.WriteLine("StartVirtualDevice Connection enter"); // define our virtual device var creationConfig = DefineDevice(); // create the session. The name here is just convenience. + System.Diagnostics.Debug.WriteLine("StartVirtualDevice Creating session"); _session = MidiSession.Create(creationConfig.Name); // return if unable to create session - if (_session == null) return; + if (_session == null) + { + System.Diagnostics.Debug.WriteLine("StartVirtualDevice Unable to create session"); + return; + } // create the virtual device, so we can get the endpoint device id to connect to + System.Diagnostics.Debug.WriteLine("StartVirtualDevice Creating virtual device"); _virtualDevice = MidiVirtualDeviceManager.CreateVirtualDevice(creationConfig); // return if unable to create virtual device - if (_virtualDevice == null ) return; + if (_virtualDevice == null) + { + System.Diagnostics.Debug.WriteLine("StartVirtualDevice Unable to create virtual device"); + return; + } // create our device-side connection + System.Diagnostics.Debug.WriteLine("StartVirtualDevice Creating endpoint connection"); _connection = _session.CreateEndpointConnection(_virtualDevice.DeviceEndpointDeviceId); + if (_connection == null) + { + System.Diagnostics.Debug.WriteLine("StartVirtualDevice failed to create connection"); + return; + } + + // necessary for the virtual device to participate in MIDI communication + _connection.AddMessageProcessingPlugin(_virtualDevice); + // wire up the stream configuration request received handler _virtualDevice.StreamConfigRequestReceived += OnStreamConfigurationRequestReceived; // wire up the message received handler on the connection itself _connection.MessageReceived += OnMidiMessageReceived; - + System.Diagnostics.Debug.WriteLine("StartVirtualDevice Opening connection"); if (_connection.Open()) { System.Diagnostics.Debug.WriteLine("Connection Opened"); diff --git a/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.csproj b/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.csproj index b3d4d7a41..7130b9fab 100644 --- a/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.csproj +++ b/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.csproj @@ -28,11 +28,17 @@ - + + + + PreserveNewest + + + diff --git a/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.exe.manifest b/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.exe.manifest new file mode 100644 index 000000000..66add1335 --- /dev/null +++ b/samples/csharp-net/virtual-device-app-winui/virtual-device-app-winui-cs.exe.manifest @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsPluginMetadataProvider.cpp b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsPluginMetadataProvider.cpp index 2a1d46cdb..93c90bf97 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsPluginMetadataProvider.cpp +++ b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsPluginMetadataProvider.cpp @@ -32,7 +32,7 @@ CMidi2DiagnosticsPluginMetadataProvider::GetMetadata( internal::ResourceCopyToBSTR(IDS_PLUGIN_METADATA_VERSION, &metadata->Version); metadata->SmallImagePath = NULL; // TODO - metadata->ClientConfigurationAssemblyName = NULL; // TODO +// metadata->ClientConfigurationAssemblyName = NULL; // TODO metadata->IsRuntimeCreatableByApps = false; metadata->IsRuntimeCreatableBySettings = false; diff --git a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiEndpointManager.cpp b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiEndpointManager.cpp index 25ae7fd95..5a68baee5 100644 --- a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiEndpointManager.cpp +++ b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiEndpointManager.cpp @@ -861,34 +861,21 @@ CMidi2KSMidiEndpointManager::OnDeviceAdded( // Required MIDI 2.0 Protocol step // Invoke the protocol negotiator to now capture updated endpoint info. - bool preferToSendJRToEndpoint{ false }; - bool preferToReceiveJRFromEndpoint{ false }; - BYTE preferredProtocol{ MIDI_PROP_CONFIGURED_PROTOCOL_MIDI2 }; - WORD negotiationTimeoutMilliseconds{ 5000 }; + ENDPOINTPROTOCOLNEGOTIATIONPARAMS negotiationParams{ }; - // this pointer will be allocated and set in the negotiate method - PENDPOINTPROTOCOLNEGOTIATIONRESULTS negotiationResults; + negotiationParams.PreferredMidiProtocol = MIDI_PROP_CONFIGURED_PROTOCOL_MIDI2; + negotiationParams.PreferToSendJRTimestampsToEndpoint = false; + negotiationParams.PreferToReceiveJRTimestampsFromEndpoint = false; + negotiationParams.TimeoutMilliseconds = 5000; LOG_IF_FAILED(m_MidiProtocolManager->NegotiateAndRequestMetadata( __uuidof(Midi2KSAbstraction), newDeviceInterfaceId, - preferToSendJRToEndpoint, - preferToReceiveJRFromEndpoint, - preferredProtocol, - negotiationTimeoutMilliseconds, - &negotiationResults + negotiationParams, + nullptr // TODO: Provide callback )); - if (negotiationResults != nullptr) - { - // TODO: The negotiationResults structure contains the function blocks which - // should be used to create MIDI 1.0 legacy ports for this MIDI 2.0 device. - - - - - } } } diff --git a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiPluginMetadataProvider.cpp b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiPluginMetadataProvider.cpp index 3e1761715..d04ceb4e0 100644 --- a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiPluginMetadataProvider.cpp +++ b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiPluginMetadataProvider.cpp @@ -36,7 +36,7 @@ CMidi2KSMidiPluginMetadataProvider::GetMetadata( internal::ResourceCopyToBSTR(IDS_PLUGIN_METADATA_VERSION, &metadata->Version); metadata->SmallImagePath = NULL; // TODO - metadata->ClientConfigurationAssemblyName = NULL; // No assembly +// metadata->ClientConfigurationAssemblyName = NULL; // No assembly metadata->IsRuntimeCreatableByApps = false; diff --git a/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiEndpointManager.cpp b/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiEndpointManager.cpp index 7414745d6..98da0ebc1 100644 --- a/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiEndpointManager.cpp +++ b/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiEndpointManager.cpp @@ -7,6 +7,7 @@ // ============================================================================ + #include "pch.h" using namespace wil; @@ -288,6 +289,37 @@ CMidi2KSAggregateMidiEndpointManager::CreateMidiBytestreamEndpoints( + +// TODO: Currently, this process is set up to get alerted of new devices at the +// filter level, which is normal. However, some MIDI devices, especially those +// with custom drivers, present different filters solely for naming reasons. +// Those filters end up as different aggregate endpoints here, which is very +// messy. For example, the MOTU MIDI Express 128 presents one filter for each +// numbered port pair, resulting 8 created MIDI BiDi Endpoint devices. +// Others, like some Roland devices, end up as two different devices for a +// management port and a user port, adding to confusion from users when they +// go to select them. +// +// So the logic needs to change to consider the whole set of filters at a +// parent device or container level. This could mean a ton of additional +// alerts as the parent device can show up in any number of ways (composite +// device, audio device etc.). Another option will be to capture the info +// like it is now, but not create the aggregate device until we're sure +// we have all the filters and all their pins accounted for first. This will +// require some additional logic, but will result in fewer unnecessary +// device notifications being handled by this abstraction. +// +// Note that devices can dynamically create filters using KsCreateFilterFactory +// which may complicate this, as there may be no defined upper bound to the +// number of filters a device may expose. +// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ks/ns-ks-_ksdevice_descriptor +// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ks/ns-ks-_ksdevice +// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ks/nf-ks-ksfiltergetdevice +// +// The ugly but functional approach may be to create the devices per-filter, but to +// keep track of previously created devices, and then update those devices with new +// filters and pins in their pin maps as they are discovered. + _Use_decl_annotations_ HRESULT CMidi2KSAggregateMidiEndpointManager::OnDeviceAdded( diff --git a/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiPluginMetadataProvider.cpp b/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiPluginMetadataProvider.cpp index dacaf735b..15ed16128 100644 --- a/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiPluginMetadataProvider.cpp +++ b/src/api/Abstraction/KSAggregateAbstraction/Midi2.KSAggregateMidiPluginMetadataProvider.cpp @@ -36,7 +36,7 @@ CMidi2KSAggregateMidiPluginMetadataProvider::GetMetadata( internal::ResourceCopyToBSTR(IDS_PLUGIN_METADATA_VERSION, &metadata->Version); metadata->SmallImagePath = NULL; // TODO - metadata->ClientConfigurationAssemblyName = NULL; // No assembly +// metadata->ClientConfigurationAssemblyName = NULL; // No assembly metadata->IsRuntimeCreatableByApps = false; diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2LoopbackMidiPluginMetadataProvider.cpp b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2LoopbackMidiPluginMetadataProvider.cpp index abf512a6d..389c2614b 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2LoopbackMidiPluginMetadataProvider.cpp +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2LoopbackMidiPluginMetadataProvider.cpp @@ -32,7 +32,7 @@ CMidi2LoopbackMidiPluginMetadataProvider::GetMetadata( internal::ResourceCopyToBSTR(IDS_PLUGIN_METADATA_VERSION, &metadata->Version); metadata->SmallImagePath = NULL; // TODO - metadata->ClientConfigurationAssemblyName = NULL; // TODO + //metadata->ClientConfigurationAssemblyName = NULL; // TODO metadata->IsRuntimeCreatableByApps = true; metadata->IsRuntimeCreatableBySettings = true; diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp index 96208a4a4..12090a183 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp @@ -205,23 +205,21 @@ CMidi2VirtualMidiEndpointManager::NegotiateAndRequestMetadata(std::wstring endpo TraceLoggingWideString(endpointId.c_str(), "endpoint id") ); - bool preferToSendJRToEndpoint{ false }; - bool preferToReceiveJRFromEndpoint{ false }; - BYTE preferredProtocol{ MIDI_PROP_CONFIGURED_PROTOCOL_MIDI2 }; - WORD negotiationTimeoutMS{ 2000 }; + ENDPOINTPROTOCOLNEGOTIATIONPARAMS negotiationParams{ }; - PENDPOINTPROTOCOLNEGOTIATIONRESULTS negotiationResults; + negotiationParams.PreferredMidiProtocol = MIDI_PROP_CONFIGURED_PROTOCOL_MIDI2; + negotiationParams.PreferToSendJRTimestampsToEndpoint = false; + negotiationParams.PreferToReceiveJRTimestampsFromEndpoint = false; + negotiationParams.TimeoutMilliseconds = 2000; RETURN_IF_FAILED(m_MidiProtocolManager->NegotiateAndRequestMetadata( AbstractionLayerGUID, endpointId.c_str(), - preferToSendJRToEndpoint, - preferToReceiveJRFromEndpoint, - preferredProtocol, - negotiationTimeoutMS, - &negotiationResults + negotiationParams, + nullptr // TODO: Provide callback )); + return S_OK; } diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiPluginMetadataProvider.cpp b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiPluginMetadataProvider.cpp index 944c03501..671a79b02 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiPluginMetadataProvider.cpp +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiPluginMetadataProvider.cpp @@ -33,7 +33,7 @@ CMidi2VirtualMidiPluginMetadataProvider::GetMetadata( internal::ResourceCopyToBSTR(IDS_PLUGIN_METADATA_VERSION, &metadata->Version); metadata->SmallImagePath = NULL; // TODO - metadata->ClientConfigurationAssemblyName = NULL; // TODO +// metadata->ClientConfigurationAssemblyName = NULL; // TODO metadata->IsRuntimeCreatableByApps = true; metadata->IsRuntimeCreatableBySettings = false; diff --git a/src/api/Abstraction/VirtualMidiAbstraction/MidiEndpointTable.cpp b/src/api/Abstraction/VirtualMidiAbstraction/MidiEndpointTable.cpp index 334efe192..d2c41947d 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/MidiEndpointTable.cpp +++ b/src/api/Abstraction/VirtualMidiAbstraction/MidiEndpointTable.cpp @@ -212,21 +212,21 @@ HRESULT MidiEndpointTable::OnDeviceConnected(std::wstring deviceEndpointInterfac RETURN_IF_FAILED(AbstractionState::Current().GetEndpointManager()->CreateClientVisibleEndpoint(entry)); - TraceLoggingWrite( - MidiVirtualMidiAbstractionTelemetryProvider::Provider(), - __FUNCTION__, - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"After creating client visible endpoint", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(deviceEndpointInterfaceId.c_str(), "Endpoint interface id"), - TraceLoggingWideString(entry.BaseEndpointName.c_str(), "Base endpoint name"), - TraceLoggingWideString(entry.CreatedClientEndpointId.c_str(), "Created Client Endpoint Id"), - TraceLoggingWideString(entry.CreatedShortClientInstanceId.c_str(), "Created Short Client Instance Id"), - TraceLoggingWideString(entry.CreatedDeviceEndpointId.c_str(), "Created Device Endpoint Id"), - TraceLoggingWideString(entry.CreatedShortDeviceInstanceId.c_str(), "Created Short Device Instance Id"), - TraceLoggingWideString(entry.ShortUniqueId.c_str(), "Short Unique Id"), - TraceLoggingWideString(entry.VirtualEndpointAssociationId.c_str(), "Association Id") - ); + //TraceLoggingWrite( + // MidiVirtualMidiAbstractionTelemetryProvider::Provider(), + // __FUNCTION__, + // TraceLoggingLevel(WINEVENT_LEVEL_INFO), + // TraceLoggingPointer(this, "this"), + // TraceLoggingWideString(L"After creating client visible endpoint", MIDI_TRACE_EVENT_MESSAGE_FIELD), + // TraceLoggingWideString(deviceEndpointInterfaceId.c_str(), "Endpoint interface id"), + // TraceLoggingWideString(entry.BaseEndpointName.c_str(), "Base endpoint name"), + // TraceLoggingWideString(entry.CreatedClientEndpointId.c_str(), "Created Client Endpoint Id"), + // TraceLoggingWideString(entry.CreatedShortClientInstanceId.c_str(), "Created Short Client Instance Id"), + // TraceLoggingWideString(entry.CreatedDeviceEndpointId.c_str(), "Created Device Endpoint Id"), + // TraceLoggingWideString(entry.CreatedShortDeviceInstanceId.c_str(), "Created Short Device Instance Id"), + // TraceLoggingWideString(entry.ShortUniqueId.c_str(), "Short Unique Id"), + // TraceLoggingWideString(entry.VirtualEndpointAssociationId.c_str(), "Association Id") + //); m_endpoints[associationId] = entry; @@ -255,6 +255,8 @@ HRESULT MidiEndpointTable::OnDeviceConnected(std::wstring deviceEndpointInterfac TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Association id property was not present in device table", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); + + return E_FAIL; } } else @@ -268,6 +270,8 @@ HRESULT MidiEndpointTable::OnDeviceConnected(std::wstring deviceEndpointInterfac TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Association id property was blank", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); + + return E_FAIL; } } CATCH_RETURN(); diff --git a/src/api/Service/Exe/MidiClientManager.cpp b/src/api/Service/Exe/MidiClientManager.cpp index 1a7a6359b..fc4fa991a 100644 --- a/src/api/Service/Exe/MidiClientManager.cpp +++ b/src/api/Service/Exe/MidiClientManager.cpp @@ -88,9 +88,12 @@ GetEndpointRequiresOutboundProtocolDownscaling( { TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), - __FUNCTION__, + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice.c_str(), "Device Id") + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); // default to false @@ -122,9 +125,12 @@ GetEndpointRequiresOutboundProtocolDownscaling( TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), - __FUNCTION__, + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice.c_str(), "Device Id"), + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Exit", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingBool(AddProtocolDownscaler, "Requires downscaler") ); @@ -185,9 +191,12 @@ GetDeviceSupportedDataFormat(_In_ std::wstring MidiDevice, _Inout_ MidiDataForma MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice.c_str(), "Device Id") + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); + auto additionalProperties = winrt::single_threaded_vector(); additionalProperties.Append(winrt::to_hstring(STRING_PKEY_MIDI_SupportedDataFormats)); auto deviceInfo = DeviceInformation::CreateFromIdAsync(MidiDevice, additionalProperties, winrt::Windows::Devices::Enumeration::DeviceInformationKind::DeviceInterface).get(); @@ -214,10 +223,13 @@ GetDeviceSupportedDataFormat(_In_ std::wstring MidiDevice, _Inout_ MidiDataForma MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice.c_str(), "Device Id"), + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Exit", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingBool(DataFormat, "MIDI Data Format") ); + return S_OK; } @@ -229,7 +241,9 @@ GetEndpointGenerateIncomingTimestamp(_In_ std::wstring MidiDevice, _Inout_ bool& MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice.c_str(), "Device Id") + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); // we only generate timestamps for incoming messages FROM the device @@ -262,7 +276,9 @@ GetEndpointGenerateIncomingTimestamp(_In_ std::wstring MidiDevice, _Inout_ bool& MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice.c_str(), "Device Id"), + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Exit", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingBool(GenerateIncomingTimestamp, "Generate Incoming Timestamp") ); @@ -274,9 +290,12 @@ GetEndpointAlias(_In_ LPCWSTR MidiDevice, _In_ std::wstring& Alias, _In_ MidiFlo { TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), - __FUNCTION__, + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingWideString(MidiDevice, "Device Id") + TraceLoggingPointer(nullptr, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); Alias = MidiDevice; @@ -334,7 +353,8 @@ CMidiClientManager::GetMidiClient( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(MidiDevice, "Device Id"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingGuid(SessionId, "Session Id") ); @@ -370,7 +390,8 @@ CMidiClientManager::GetMidiDevice( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(MidiDevice, "Device Id") + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); // Get an existing device pipe if one exists, otherwise create a new pipe @@ -425,7 +446,8 @@ CMidiClientManager::GetMidiProtocolDownscalerTransform( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), "Device Id") + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); RETURN_HR_IF(E_UNEXPECTED, Flow != MidiFlow::MidiFlowOut); @@ -501,7 +523,8 @@ CMidiClientManager::GetMidiTransform( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), "Device Id") + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -542,7 +565,7 @@ CMidiClientManager::GetMidiTransform( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Adding Midi2UMP2BSTransform (UMP to Bytestream)") + TraceLoggingWideString(L"Adding Midi2UMP2BSTransform (UMP to Bytestream)", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); creationParams.TransformGuid = __uuidof(Midi2UMP2BSTransform); @@ -556,7 +579,7 @@ CMidiClientManager::GetMidiTransform( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Adding Midi2BS2UMPTransform (Bytestream to UMP)") + TraceLoggingWideString(L"Adding Midi2BS2UMPTransform (Bytestream to UMP)", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); creationParams.TransformGuid = __uuidof(Midi2BS2UMPTransform); @@ -569,7 +592,7 @@ CMidiClientManager::GetMidiTransform( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Unsupported translation type requested. This is probably an error in specifying data format.") + TraceLoggingWideString(L"Unsupported translation type requested. This is probably an error in specifying data format.", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); // unknown transform @@ -623,7 +646,8 @@ CMidiClientManager::GetMidiScheduler( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), "Device Id") + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -663,8 +687,8 @@ CMidiClientManager::GetMidiScheduler( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), "Device Id"), - TraceLoggingWideString(L"Creating new scheduler", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Creating new scheduler", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(DevicePipe->MidiDevice().c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); MIDISRV_TRANSFORMCREATION_PARAMS creationParams{ 0 }; @@ -799,7 +823,8 @@ CMidiClientManager::CreateMidiClient( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(MidiDevice), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingGuid(SessionId) ); @@ -831,9 +856,9 @@ CMidiClientManager::CreateMidiClient( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(MidiDevice), - TraceLoggingGuid(SessionId), - TraceLoggingWideString(L"Called for internal protocol negotiation, but creation params dataformat is not UMP", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Called for internal protocol negotiation, but creation params dataformat is not UMP", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), + TraceLoggingGuid(SessionId) ); return E_UNEXPECTED; @@ -847,15 +872,14 @@ CMidiClientManager::CreateMidiClient( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(MidiDevice), - TraceLoggingGuid(SessionId), - TraceLoggingWideString(L"Called for internal protocol negotiation, but creation params data flow is not Bidirectional", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Called for internal protocol negotiation, but creation params data flow is not Bidirectional", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(MidiDevice, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), + TraceLoggingGuid(SessionId) ); return E_UNEXPECTED; } - auto lock = m_ClientManagerLock.lock(); DWORD clientProcessId{0}; @@ -1106,7 +1130,8 @@ CMidiClientManager::DestroyMidiClient( MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); auto lock = m_ClientManagerLock.lock(); diff --git a/src/api/Service/Exe/MidiDeviceManager.cpp b/src/api/Service/Exe/MidiDeviceManager.cpp index 7eb0f53c3..a43f8dbd0 100644 --- a/src/api/Service/Exe/MidiDeviceManager.cpp +++ b/src/api/Service/Exe/MidiDeviceManager.cpp @@ -144,9 +144,9 @@ CMidiDeviceManager::Initialize( TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_ERROR, + MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Activating abstraction configuration manager.", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingGuid(AbstractionLayer, "abstraction layer") @@ -174,8 +174,8 @@ CMidiDeviceManager::Initialize( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingHResult(initializeResult, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingWideString(L"Failed to initialize abstraction configuration manager.", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingHResult(initializeResult, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } @@ -188,9 +188,9 @@ CMidiDeviceManager::Initialize( { TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_ERROR, + MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Updating abstraction configuration", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingGuid(AbstractionLayer, "abstraction layer") @@ -214,8 +214,8 @@ CMidiDeviceManager::Initialize( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_WARNING), TraceLoggingPointer(this, "this"), - TraceLoggingHResult(updateConfigHR, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingWideString(L"Config update not implemented for this abstraction.", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingHResult(updateConfigHR, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } @@ -229,8 +229,8 @@ CMidiDeviceManager::Initialize( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingHResult(updateConfigHR, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingWideString(L"Failed to update configuration.", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingHResult(updateConfigHR, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } @@ -688,9 +688,9 @@ CMidiDeviceManager::ActivateEndpoint TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(ParentInstanceId), - TraceLoggingWideString(L"Common Properties: Friendly Name is null or empty", MIDI_TRACE_EVENT_MESSAGE_FIELD) - ); + TraceLoggingWideString(L"Common Properties: Friendly Name is null or empty", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(ParentInstanceId, "parent") + ); return E_INVALIDARG; } @@ -1011,9 +1011,9 @@ CMidiDeviceManager::ActivateEndpoint TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(ParentInstanceId), - TraceLoggingHResult(activationResult, "Activation HRESULT"), - TraceLoggingWideString(L"Failed to activate UMP endpoint", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Failed to activate UMP endpoint", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(ParentInstanceId, "parent"), + TraceLoggingHResult(activationResult, "Activation HRESULT") ); RETURN_IF_FAILED(activationResult); @@ -1266,7 +1266,7 @@ CMidiDeviceManager::ActivateEndpointInternal TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"SwDeviceCreate failed", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(ParentInstanceId), + TraceLoggingWideString(ParentInstanceId, "parent"), TraceLoggingBool(MidiOne) ); } @@ -1281,9 +1281,9 @@ CMidiDeviceManager::ActivateEndpointInternal TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingHResult(midiPort->hr, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingWideString(L"SwDeviceCreate returned a failed HR", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(ParentInstanceId), + TraceLoggingHResult(midiPort->hr, MIDI_TRACE_EVENT_HRESULT_FIELD), + TraceLoggingWideString(ParentInstanceId, "parent"), TraceLoggingBool(MidiOne) ); } @@ -1298,7 +1298,7 @@ CMidiDeviceManager::ActivateEndpointInternal TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"SwDeviceState != SWDEVICESTATE::Created", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(ParentInstanceId), + TraceLoggingWideString(ParentInstanceId, "parent"), TraceLoggingBool(MidiOne) ); } @@ -1310,9 +1310,9 @@ CMidiDeviceManager::ActivateEndpointInternal TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_ERROR, + MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), TraceLoggingWideString(DeviceInterfaceId->c_str(), "created device interface id") ); @@ -1344,7 +1344,7 @@ CMidiDeviceManager::UpdateEndpointProperties TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DeviceInterfaceId, "device interface id"), + TraceLoggingWideString(DeviceInterfaceId, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingULong(IntPropertyCount, "property count") ); @@ -1367,7 +1367,7 @@ CMidiDeviceManager::UpdateEndpointProperties TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Device not found. If the updates are from the config file, the device may not yet have been enumerated.", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(DeviceInterfaceId, "device interface id"), + TraceLoggingWideString(requestedInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingULong(IntPropertyCount, "property count") ); @@ -1395,7 +1395,7 @@ CMidiDeviceManager::UpdateEndpointProperties TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), TraceLoggingWideString(L"Properties set", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(DeviceInterfaceId, "device interface id"), + TraceLoggingWideString(requestedInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingULong(IntPropertyCount, "property count") ); @@ -1409,9 +1409,9 @@ CMidiDeviceManager::UpdateEndpointProperties TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingHResult(propSetHR, MIDI_TRACE_EVENT_HRESULT_FIELD), TraceLoggingWideString(L"Error setting properties", MIDI_TRACE_EVENT_MESSAGE_FIELD), - TraceLoggingWideString(DeviceInterfaceId, "device interface id"), + TraceLoggingHResult(propSetHR, MIDI_TRACE_EVENT_HRESULT_FIELD), + TraceLoggingWideString(requestedInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingULong(IntPropertyCount, "property count") ); @@ -1437,8 +1437,8 @@ CMidiDeviceManager::DeleteEndpointProperties TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DeviceInterfaceId), - TraceLoggingULong(IntPropertyCount) + TraceLoggingWideString(DeviceInterfaceId, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), + TraceLoggingULong(IntPropertyCount, "property count") ); // create list of dev properties from the keys @@ -1471,7 +1471,7 @@ CMidiDeviceManager::DeactivateEndpoint TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(InstanceId, "instance id") + TraceLoggingWideString(InstanceId, MIDI_TRACE_EVENT_DEVICE_INSTANCE_ID_FIELD) ); auto cleanId = internal::NormalizeDeviceInstanceIdWStringCopy(InstanceId); @@ -1521,7 +1521,7 @@ CMidiDeviceManager::RemoveEndpoint TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(InstanceId) + TraceLoggingWideString(InstanceId, MIDI_TRACE_EVENT_DEVICE_INSTANCE_ID_FIELD) ); // first deactivate, to ensure it's removed from the tracking list @@ -1574,8 +1574,8 @@ CMidiDeviceManager::UpdateAbstractionConfiguration TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingGuid(AbstractionId, "abstraction id"), - TraceLoggingWideString(L"Failed to find the referenced abstraction by its GUID", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Failed to find the referenced abstraction by its GUID", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingGuid(AbstractionId, "abstraction id") ); } diff --git a/src/api/Service/Exe/MidiEndpointProtocolManager.cpp b/src/api/Service/Exe/MidiEndpointProtocolManager.cpp index aceefb4f1..2d0a73a03 100644 --- a/src/api/Service/Exe/MidiEndpointProtocolManager.cpp +++ b/src/api/Service/Exe/MidiEndpointProtocolManager.cpp @@ -53,7 +53,6 @@ CMidiEndpointProtocolManager::Initialize( MIDI_PROTOCOL_MANAGER_PROCESS_NAME, nullptr)); - return S_OK; } @@ -64,11 +63,8 @@ HRESULT CMidiEndpointProtocolManager::NegotiateAndRequestMetadata( GUID AbstractionGuid, LPCWSTR DeviceInterfaceId, - BOOL PreferToSendJRTimestampsToEndpoint, - BOOL PreferToReceiveJRTimestampsFromEndpoint, - BYTE PreferredMidiProtocol, - WORD TimeoutMilliseconds, - PENDPOINTPROTOCOLNEGOTIATIONRESULTS* NegotiationResults + ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + IMidiProtocolNegotiationCompleteCallback* NegotiationCompleteCallback ) noexcept { TraceLoggingWrite( @@ -77,17 +73,17 @@ CMidiEndpointProtocolManager::NegotiateAndRequestMetadata( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(DeviceInterfaceId) + TraceLoggingWideString(DeviceInterfaceId, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); - auto cleanDeviceInterfaceId = internal::NormalizeDeviceInstanceIdWStringCopy(DeviceInterfaceId); + auto cleanEndpointDeviceInterfaceId = internal::NormalizeEndpointInterfaceIdWStringCopy(DeviceInterfaceId); std::shared_ptr worker{ nullptr }; - if (m_endpointWorkers.find(cleanDeviceInterfaceId) != m_endpointWorkers.end()) + if (m_endpointWorkers.find(cleanEndpointDeviceInterfaceId) != m_endpointWorkers.end()) { // already exists. We can re-request negotiation from the worker - worker = m_endpointWorkers[cleanDeviceInterfaceId]; + worker = m_endpointWorkers[cleanEndpointDeviceInterfaceId].Worker; } if (worker == nullptr) @@ -95,32 +91,51 @@ CMidiEndpointProtocolManager::NegotiateAndRequestMetadata( // allocate a new worker worker = std::make_shared(); - RETURN_IF_NULL_ALLOC(worker); - RETURN_IF_FAILED(worker->Initialize( - m_sessionId, - AbstractionGuid, - cleanDeviceInterfaceId.c_str(), - m_clientManager, - m_deviceManager, - m_sessionTracker - ) - ); - - // add it to the map - m_endpointWorkers[cleanDeviceInterfaceId] = worker; + if (worker) + { + auto initializeHR = worker->Initialize( + m_sessionId, + AbstractionGuid, + cleanEndpointDeviceInterfaceId.c_str(), + m_clientManager, + m_deviceManager, + m_sessionTracker + ); + + if (FAILED(initializeHR)) + { + // TODO: Log + + return E_FAIL; + } + + // create the thread + + ProtocolNegotiationWorkerThreadEntry newEntry{}; + + newEntry.Worker = worker; + + newEntry.Thread = std::make_shared(&CMidiEndpointProtocolWorker::Start, newEntry.Worker, + NegotiationParams, + NegotiationCompleteCallback); + + // TODO: Need to protect this map + m_endpointWorkers[cleanEndpointDeviceInterfaceId] = newEntry; + + m_endpointWorkers[cleanEndpointDeviceInterfaceId].Thread->detach(); + } + else + { + // TODO: log failed allocation + + return E_FAIL; + } + + } // now that we have the worker created, actually start the work. This function blocks for up to TimeoutMilliseconds. - RETURN_IF_FAILED(worker->NegotiateAndRequestMetadata( - PreferToSendJRTimestampsToEndpoint, - PreferToReceiveJRTimestampsFromEndpoint, - PreferredMidiProtocol, - TimeoutMilliseconds, - NegotiationResults - ) - ); - return S_OK; } @@ -133,15 +148,25 @@ CMidiEndpointProtocolManager::Cleanup() MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD) ); m_sessionTracker->RemoveClientSession(m_sessionId); for (auto& [key, val] : m_endpointWorkers) { - LOG_IF_FAILED(val->Cleanup()); - val.reset(); + val.Worker->EndProcessing(); // this sets an event that tells the thread to quit + + if (val.Thread->joinable()) + { + val.Thread->join(); // join until the thread is done + } + + LOG_IF_FAILED(val.Worker->Cleanup()); + + val.Worker.reset(); + val.Thread.reset(); } m_endpointWorkers.clear(); @@ -150,6 +175,15 @@ CMidiEndpointProtocolManager::Cleanup() m_deviceManager.reset(); m_sessionTracker.reset(); + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Exit", MIDI_TRACE_EVENT_MESSAGE_FIELD) + ); + return S_OK; } diff --git a/src/api/Service/Exe/MidiEndpointProtocolManager.h b/src/api/Service/Exe/MidiEndpointProtocolManager.h index 8f9d13001..6968875ee 100644 --- a/src/api/Service/Exe/MidiEndpointProtocolManager.h +++ b/src/api/Service/Exe/MidiEndpointProtocolManager.h @@ -8,6 +8,12 @@ #pragma once +struct ProtocolNegotiationWorkerThreadEntry +{ + std::shared_ptr Thread; + std::shared_ptr Worker; +}; + class CMidiEndpointProtocolManager : public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags, IMidiEndpointProtocolManagerInterface> @@ -25,13 +31,11 @@ class CMidiEndpointProtocolManager : public Microsoft::WRL::RuntimeClass< STDMETHOD(NegotiateAndRequestMetadata)( _In_ GUID AbstractionGuid, _In_ LPCWSTR DeviceInterfaceId, - _In_ BOOL PreferToSendJRTimestampsToEndpoint, - _In_ BOOL PreferToReceiveJRTimestampsFromEndpoint, - _In_ BYTE PreferredMidiProtocol, - _In_ WORD TimeoutMilliseconds, - _Out_ PENDPOINTPROTOCOLNEGOTIATIONRESULTS* NegotiationResults + _In_ ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + _In_ IMidiProtocolNegotiationCompleteCallback* NegotiationCompleteCallback ); + HRESULT Cleanup(); private: @@ -41,5 +45,6 @@ class CMidiEndpointProtocolManager : public Microsoft::WRL::RuntimeClass< std::shared_ptr m_deviceManager; std::shared_ptr m_sessionTracker; - std::map> m_endpointWorkers; + std::map m_endpointWorkers; + }; diff --git a/src/api/Service/Exe/MidiEndpointProtocolWorker.cpp b/src/api/Service/Exe/MidiEndpointProtocolWorker.cpp index ed8d1081b..605ae41a1 100644 --- a/src/api/Service/Exe/MidiEndpointProtocolWorker.cpp +++ b/src/api/Service/Exe/MidiEndpointProtocolWorker.cpp @@ -14,7 +14,7 @@ HRESULT CMidiEndpointProtocolWorker::Initialize( GUID SessionId, GUID AbstractionGuid, - LPCWSTR DeviceInterfaceId, + LPCWSTR EndpointDeviceInterfaceId, std::shared_ptr& ClientManager, std::shared_ptr& DeviceManager, std::shared_ptr& SessionTracker @@ -25,57 +25,30 @@ CMidiEndpointProtocolWorker::Initialize( MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(EndpointDeviceInterfaceId, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); m_abstractionGuid = AbstractionGuid; m_sessionId = SessionId; - m_deviceInterfaceId = DeviceInterfaceId; + m_deviceInterfaceId = EndpointDeviceInterfaceId; m_clientManager = ClientManager; m_deviceManager = DeviceManager; m_sessionTracker = SessionTracker; - wil::com_ptr_nothrow serviceAbstraction; - - // we only support UMP data format for protocol negotiation - ABSTRACTIONCREATIONPARAMS abstractionCreationParams{ }; - abstractionCreationParams.DataFormat = MidiDataFormat::MidiDataFormat_UMP; - - DWORD mmcssTaskId{ 0 }; - LONGLONG context{ 0 }; - - // Working directly with the abstraction doesn't work here. Something doesn't hook up - // properly. When we open the device here, then the normal client endpoints don't - // receive messages, even though they appear to be working. -// RETURN_IF_FAILED(CoCreateInstance(m_abstractionGuid, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&midiAbstraction))); -// RETURN_IF_FAILED(midiAbstraction->Activate(__uuidof(IMidiBiDi), (void**)&m_midiBiDiDevice)); -// RETURN_IF_FAILED(m_midiBiDiDevice->Initialize(m_deviceInterfaceId.c_str(), &abstractionCreationParams, &mmcssTaskId, this, context, m_sessionId)); - - // this is not a good idea, but we don't have a reference to the lib here - GUID midi2MidiSrvAbstractionIID = internal::StringToGuid(L"{2BA15E4E-5417-4A66-85B8-2B2260EFBC84}"); - RETURN_IF_FAILED(CoCreateInstance((IID)midi2MidiSrvAbstractionIID, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&serviceAbstraction))); - - // create the bidi device - RETURN_IF_FAILED(serviceAbstraction->Activate(__uuidof(IMidiBiDi), (void**)&m_midiBiDiDevice)); - - RETURN_IF_FAILED(m_midiBiDiDevice->Initialize( - (LPCWSTR)(m_deviceInterfaceId.c_str()), - &abstractionCreationParams, - &mmcssTaskId, - (IMidiCallback*)(this), - context, - m_sessionId - )); - - // add this connection to the session tracker. The manager already logged the overall session - //LOG_IF_FAILED(m_sessionTracker->AddClientEndpointConnection( - // m_sessionId, - // m_deviceInterfaceId.c_str(), - // (MidiClientHandle)nullptr)); - - RETURN_IF_FAILED(m_allNegotiationMessagesReceived.create(wil::EventOptions::ManualReset)); + RETURN_IF_FAILED(m_endProcessing.create(wil::EventOptions::ManualReset)); + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Initialize complete", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(EndpointDeviceInterfaceId, MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); return S_OK; } @@ -93,7 +66,9 @@ CMidiEndpointProtocolWorker::FunctionBlockPropertyKeyFromNumber( MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); DEVPROPKEY key{}; @@ -114,7 +89,8 @@ CMidiEndpointProtocolWorker::FunctionBlockPropertyKeyFromNumber( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"CLSIDFromString failed for Function Block Property Key", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"CLSIDFromString failed for Function Block Property Key", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); } } @@ -133,7 +109,9 @@ CMidiEndpointProtocolWorker::FunctionBlockNamePropertyKeyFromNumber( MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); DEVPROPKEY key{}; @@ -156,12 +134,9 @@ CMidiEndpointProtocolWorker::FunctionBlockNamePropertyKeyFromNumber( _Use_decl_annotations_ HRESULT -CMidiEndpointProtocolWorker::NegotiateAndRequestMetadata( - BOOL PreferToSendJRTimestampsToEndpoint, - BOOL PreferToReceiveJRTimestampsFromEndpoint, - BYTE PreferredMidiProtocol, - WORD TimeoutMilliseconds, - PENDPOINTPROTOCOLNEGOTIATIONRESULTS* NegotiationResults +CMidiEndpointProtocolWorker::Start( + ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + IMidiProtocolNegotiationCompleteCallback* NegotiationCompleteCallback ) { TraceLoggingWrite( @@ -169,13 +144,17 @@ CMidiEndpointProtocolWorker::NegotiateAndRequestMetadata( MIDI_TRACE_EVENT_INFO, TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); - m_preferToSendJRTimestampsToEndpoint = PreferToSendJRTimestampsToEndpoint; - m_preferToReceiveJRTimestampsFromEndpoint = PreferToReceiveJRTimestampsFromEndpoint; - m_preferredMidiProtocol = PreferredMidiProtocol; + m_negotiationCompleteCallback = NegotiationCompleteCallback; + + m_preferToSendJRTimestampsToEndpoint = NegotiationParams.PreferToSendJRTimestampsToEndpoint; + m_preferToReceiveJRTimestampsFromEndpoint = NegotiationParams.PreferToReceiveJRTimestampsFromEndpoint; + m_preferredMidiProtocol = NegotiationParams.PreferredMidiProtocol; // We continue listening for and updating metadata even after we return. // We don't raise any changed events here. Instead, anyone interested in getting @@ -184,6 +163,50 @@ CMidiEndpointProtocolWorker::NegotiateAndRequestMetadata( try { + + // we do this here instead of initialize so this is created on the worker thread + if (!m_midiBiDiDevice) + { + wil::com_ptr_nothrow serviceAbstraction; + + // we only support UMP data format for protocol negotiation + ABSTRACTIONCREATIONPARAMS abstractionCreationParams{ }; + abstractionCreationParams.DataFormat = MidiDataFormat::MidiDataFormat_UMP; + abstractionCreationParams.InstanceConfigurationJsonData = nullptr; + + DWORD mmcssTaskId{ 0 }; + LONGLONG context{ 0 }; + + + // this is not a good idea, but we don't have a reference to the lib here + GUID midi2MidiSrvAbstractionIID = internal::StringToGuid(L"{2BA15E4E-5417-4A66-85B8-2B2260EFBC84}"); + RETURN_IF_FAILED(CoCreateInstance((IID)midi2MidiSrvAbstractionIID, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&serviceAbstraction))); + + // create the bidi device + RETURN_IF_FAILED(serviceAbstraction->Activate(__uuidof(IMidiBiDi), (void**)&m_midiBiDiDevice)); + + RETURN_IF_FAILED(m_midiBiDiDevice->Initialize( + (LPCWSTR)(m_deviceInterfaceId.c_str()), + &abstractionCreationParams, + &mmcssTaskId, + (IMidiCallback*)(this), + context, + m_sessionId + )); + } + + // add this connection to the session tracker. The manager already logged the overall session + //LOG_IF_FAILED(m_sessionTracker->AddClientEndpointConnection( + // m_sessionId, + // m_deviceInterfaceId.c_str(), + // (MidiClientHandle)nullptr)); + + if (!m_allNegotiationMessagesReceived) + { + RETURN_IF_FAILED(m_allNegotiationMessagesReceived.create(wil::EventOptions::ManualReset)); + } + + // TODO: For now, we're keeping the initial negotiation all in-line, in the same thread. // will evaluate a separate worker thread after the implementation is tested and working. @@ -194,12 +217,14 @@ CMidiEndpointProtocolWorker::NegotiateAndRequestMetadata( m_countFunctionBlocksReceived = 0; m_countFunctionBlockNamesReceived = 0; m_declaredFunctionBlockCount = 0; + m_discoveredFunctionBlocks.clear(); m_functionBlockNames.clear(); m_endpointName.clear(); m_productInstanceId.clear(); m_allNegotiationMessagesReceived.ResetEvent(); + m_alreadyTriedToNegotiationOnce = false; m_taskDeviceIdentityReceived = false; @@ -208,19 +233,59 @@ CMidiEndpointProtocolWorker::NegotiateAndRequestMetadata( m_taskEndpointProductInstanceIdReceived = false; m_taskFinalStreamNegotiationResponseReceived = false; + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Requesting discovery information", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + // start initial negotiation. Return when timed out or when we have all the requested info. LOG_IF_FAILED(RequestAllEndpointDiscoveryInformation()); - m_allNegotiationMessagesReceived.wait(TimeoutMilliseconds); - + m_allNegotiationMessagesReceived.wait(NegotiationParams.TimeoutMilliseconds); + + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Returned from manual reset event wait", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + if (m_allNegotiationMessagesReceived.is_signaled()) { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"All discovery/negotiation messages received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + // provide all the negotiation results m_mostRecentResults.AllEndpointInformationReceived = true; } else { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_WARNING, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_WARNING), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Discovery/negotiation messages partially received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + // we only received partial results m_mostRecentResults.AllEndpointInformationReceived = false; @@ -231,34 +296,162 @@ CMidiEndpointProtocolWorker::NegotiateAndRequestMetadata( // because in the future, this worker may be on another thread etc. It's an internal // implementation detail, not a public contract. - m_mostRecentResults.EndpointSuppliedName = m_endpointName.c_str(); - m_mostRecentResults.EndpointSuppliedProductInstanceId = m_productInstanceId.c_str(); + + if (!m_endpointName.empty()) + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Endpoint name received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), + TraceLoggingWideString(m_endpointName.c_str(), "endpoint name") + ); + + m_mostRecentResults.EndpointSuppliedName = m_endpointName.c_str(); + } + else + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_WARNING, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_WARNING), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"No endpoint name received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + + m_mostRecentResults.EndpointSuppliedName = nullptr; + } + + + if (!m_productInstanceId.empty()) + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Product instance Id received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), + TraceLoggingWideString(m_productInstanceId.c_str(), "product instance id") + ); + + m_mostRecentResults.EndpointSuppliedProductInstanceId = m_productInstanceId.c_str(); + } + else + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_WARNING, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_WARNING), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"No product instance id received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + + m_mostRecentResults.EndpointSuppliedProductInstanceId = nullptr; + } m_mostRecentResults.FunctionBlocksAreStatic = m_functionBlocksAreStatic; - m_mostRecentResults.NumberOfFunctionBlocksDeclared = m_declaredFunctionBlockCount; + m_mostRecentResults.CountFunctionBlocksDeclared = m_declaredFunctionBlockCount; // Loop through function blocks and copy the name pointers over // into the structure before returning it. Seems extra, but we need a friendly // place to work on names before they are finished, and the structure only // knows about the LPCWSTR, not std::wstring - for (auto& fb : m_discoveredFunctionBlocks) + if (m_discoveredFunctionBlocks.size() > 0) { - if (m_functionBlockNames.find(fb.Number) != m_functionBlockNames.end()) - { - fb.Name = m_functionBlockNames[fb.Number].c_str(); - } - else + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Function blocks received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + + for (auto& fb : m_discoveredFunctionBlocks) { - fb.Name = nullptr; + if (m_functionBlockNames.find(fb.Number) != m_functionBlockNames.end()) + { + fb.Name = m_functionBlockNames[fb.Number].c_str(); + } + else + { + fb.Name = nullptr; + } } + + // add the function blocks now they are fully valid + m_mostRecentResults.DiscoveredFunctionBlocks = m_discoveredFunctionBlocks.data(); + m_mostRecentResults.CountFunctionBlocksReceived = (BYTE)m_discoveredFunctionBlocks.size(); } + else + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_WARNING, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_WARNING), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"No function blocks received", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); - // add the function blocks now they are fully valid - m_mostRecentResults.DiscoveredFunctionBlocks = m_discoveredFunctionBlocks.data(); - m_mostRecentResults.NumberOfFunctionBlocksReceived = (BYTE)m_discoveredFunctionBlocks.size(); + m_mostRecentResults.DiscoveredFunctionBlocks = nullptr; + m_mostRecentResults.CountFunctionBlocksReceived = 0; + } - *NegotiationResults = &m_mostRecentResults; + // Call callback + + if (m_negotiationCompleteCallback != nullptr) + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Initial protocol negotiation complete, calling callback function", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + + LOG_IF_FAILED(m_negotiationCompleteCallback->ProtocolNegotiationCompleteCallback( + m_abstractionGuid, + m_deviceInterfaceId.c_str(), + &m_mostRecentResults + ) + ); + } + else + { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + MIDI_TRACE_EVENT_WARNING, + TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_WARNING), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Initial protocol negotiation complete, but no callback provided", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) + ); + + } + + + // we just hang out until endProcessing is set + // TODO: This won't allow calling negotiation a second time, so need to think about that + + m_endProcessing.wait(); + + return S_OK; } @@ -298,9 +491,12 @@ CMidiEndpointProtocolWorker::Callback( m_countFunctionBlocksReceived == m_declaredFunctionBlockCount && m_taskFinalStreamNegotiationResponseReceived) { - // we're done with negotiation, and can return from the initial function. Code will continue to - // capture new metadata when messages signal change, but the initial steps have completed. - m_allNegotiationMessagesReceived.SetEvent(); + if (m_allNegotiationMessagesReceived.is_valid() && !m_allNegotiationMessagesReceived.is_signaled()) + { + // we're done with negotiation, and can return from the initial function. Code will continue to + // capture new metadata when messages signal change, but the initial steps have completed. + m_allNegotiationMessagesReceived.SetEvent(); + } } } else @@ -317,7 +513,8 @@ CMidiEndpointProtocolWorker::Callback( TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Couldn't fill the UMP", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Couldn't fill the UMP", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); return E_FAIL; @@ -338,6 +535,7 @@ _Use_decl_annotations_ HRESULT CMidiEndpointProtocolWorker::ProcessStreamMessage(internal::PackedUmp128 ump) { +#ifdef _DEBUG TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), MIDI_TRACE_EVENT_INFO, @@ -347,6 +545,7 @@ CMidiEndpointProtocolWorker::ProcessStreamMessage(internal::PackedUmp128 ump) TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD), TraceLoggingUInt32(ump.word0, MIDI_TRACE_EVENT_MIDI_WORD0_FIELD) ); +#endif auto messageStatus = internal::GetStatusFromStreamMessageFirstWord(ump.word0); @@ -556,6 +755,7 @@ CMidiEndpointProtocolWorker::RequestAllFunctionBlocks() TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -584,6 +784,7 @@ CMidiEndpointProtocolWorker::RequestAllEndpointDiscoveryInformation() TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -609,7 +810,8 @@ CMidiEndpointProtocolWorker::RequestAllEndpointDiscoveryInformation() TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Endpoint is null", MIDI_TRACE_EVENT_MESSAGE_FIELD) + TraceLoggingWideString(L"Endpoint is null", MIDI_TRACE_EVENT_MESSAGE_FIELD), + TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); } @@ -626,6 +828,7 @@ CMidiEndpointProtocolWorker::ProcessStreamConfigurationRequest(internal::PackedU TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -684,6 +887,7 @@ CMidiEndpointProtocolWorker::Cleanup() TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -722,6 +926,7 @@ CMidiEndpointProtocolWorker::UpdateEndpointNameProperty() TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -765,6 +970,7 @@ CMidiEndpointProtocolWorker::UpdateEndpointProductInstanceIdProperty() TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -794,7 +1000,16 @@ CMidiEndpointProtocolWorker::UpdateEndpointProductInstanceIdProperty() } else { - // TODO: Need to remove the property + // Need to remove the property + DEVPROPERTY props[] = + { + {{ PKEY_MIDI_EndpointProvidedProductInstanceId, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_EMPTY, 0, nullptr }, + {{ PKEY_MIDI_EndpointProvidedProductInstanceIdLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, + }; + + RETURN_IF_FAILED(m_deviceManager->UpdateEndpointProperties(m_deviceInterfaceId.c_str(), ARRAYSIZE(props), (PVOID)props)); return S_OK; } @@ -811,6 +1026,7 @@ CMidiEndpointProtocolWorker::UpdateFunctionBlockNameProperty(uint8_t functionBlo TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -821,7 +1037,6 @@ CMidiEndpointProtocolWorker::UpdateFunctionBlockNameProperty(uint8_t functionBlo if (!cleanedValue.empty()) { - DEVPROPERTY props[] = { {{ FunctionBlockNamePropertyKeyFromNumber(functionBlockNumber), DEVPROP_STORE_SYSTEM, nullptr}, @@ -838,7 +1053,16 @@ CMidiEndpointProtocolWorker::UpdateFunctionBlockNameProperty(uint8_t functionBlo } else { - // TODO: Need to remove the property + // Need to remove the property + DEVPROPERTY props[] = + { + {{ FunctionBlockNamePropertyKeyFromNumber(functionBlockNumber), DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_EMPTY, 0, nullptr }, + {{ PKEY_MIDI_FunctionBlocksLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, + }; + + RETURN_IF_FAILED(m_deviceManager->UpdateEndpointProperties(m_deviceInterfaceId.c_str(), ARRAYSIZE(props), (PVOID)props)); return S_OK; } @@ -854,6 +1078,7 @@ CMidiEndpointProtocolWorker::UpdateStreamConfigurationProperties(internal::Packe TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -900,10 +1125,10 @@ CMidiEndpointProtocolWorker::UpdateDeviceIdentityProperty(internal::PackedUmp128 TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); - MidiDeviceIdentityProperty prop; prop.Reserved0 = MIDIWORDSHORT2(identityMessage.word0); @@ -952,6 +1177,7 @@ CMidiEndpointProtocolWorker::UpdateEndpointInfoProperties(internal::PackedUmp128 TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -1018,6 +1244,7 @@ CMidiEndpointProtocolWorker::UpdateFunctionBlockProperty(internal::PackedUmp128& TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -1071,6 +1298,7 @@ CMidiEndpointProtocolWorker::ParseStreamTextMessage(internal::PackedUmp128& mess TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -1145,6 +1373,7 @@ CMidiEndpointProtocolWorker::HandleFunctionBlockNameMessage(internal::PackedUmp1 TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -1212,6 +1441,7 @@ CMidiEndpointProtocolWorker::HandleEndpointNameMessage(internal::PackedUmp128& e TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); @@ -1270,6 +1500,7 @@ CMidiEndpointProtocolWorker::HandleProductInstanceIdMessage(internal::PackedUmp1 TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Enter", MIDI_TRACE_EVENT_MESSAGE_FIELD), TraceLoggingWideString(m_deviceInterfaceId.c_str(), MIDI_TRACE_EVENT_DEVICE_SWD_ID_FIELD) ); diff --git a/src/api/Service/Exe/MidiEndpointProtocolWorker.h b/src/api/Service/Exe/MidiEndpointProtocolWorker.h index cf7aec70c..4322dbafd 100644 --- a/src/api/Service/Exe/MidiEndpointProtocolWorker.h +++ b/src/api/Service/Exe/MidiEndpointProtocolWorker.h @@ -22,24 +22,23 @@ class CMidiEndpointProtocolWorker : public Microsoft::WRL::RuntimeClass< STDMETHOD(Initialize)( _In_ GUID SessionId, _In_ GUID AbstractionGuid, - _In_ LPCWSTR DeviceInterfaceId, + _In_ LPCWSTR EndpointDeviceInterfaceId, _In_ std::shared_ptr& ClientManager, _In_ std::shared_ptr& DeviceManager, _In_ std::shared_ptr& SessionTracker ); - STDMETHOD(NegotiateAndRequestMetadata)( - _In_ BOOL PreferToSendJRTimestampsToEndpoint, - _In_ BOOL PreferToReceiveJRTimestampsFromEndpoint, - _In_ BYTE PreferredMidiProtocol, - _In_ WORD TimeoutMilliseconds, - _Out_ PENDPOINTPROTOCOLNEGOTIATIONRESULTS* NegotiationResults + STDMETHOD(Start)( + _In_ ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + _In_ IMidiProtocolNegotiationCompleteCallback* NegotiationCompleteCallback ); STDMETHOD(Callback)(_In_ PVOID Data, _In_ UINT Size, _In_ LONGLONG Position, _In_ LONGLONG Context); STDMETHOD(Cleanup)(); + void EndProcessing() { if (m_endProcessing.is_valid()) m_endProcessing.SetEvent(); } + private: std::wstring m_deviceInterfaceId; //std::wstring m_deviceInstanceId; @@ -48,6 +47,7 @@ class CMidiEndpointProtocolWorker : public Microsoft::WRL::RuntimeClass< LONGLONG m_context{ 0 }; + wil::unique_event_nothrow m_endProcessing; wil::unique_event_nothrow m_allNegotiationMessagesReceived; //wil::unique_event_nothrow m_queueWorkerThreadWakeup; @@ -59,6 +59,8 @@ class CMidiEndpointProtocolWorker : public Microsoft::WRL::RuntimeClass< std::shared_ptr m_deviceManager; std::shared_ptr m_sessionTracker; + wil::com_ptr_nothrow m_negotiationCompleteCallback{ nullptr }; + //MIDISRV_CLIENT m_midiClient{ }; //std::shared_ptr m_clientPipe{ nullptr }; diff --git a/src/api/Service/Exe/MidiSrvRpc.cpp b/src/api/Service/Exe/MidiSrvRpc.cpp index a7e1c92e0..261be1ea9 100644 --- a/src/api/Service/Exe/MidiSrvRpc.cpp +++ b/src/api/Service/Exe/MidiSrvRpc.cpp @@ -484,7 +484,7 @@ MidiSrvGetAbstractionList( abstractionObject.SetNamedValue(MIDI_SERVICE_JSON_ABSTRACTION_PLUGIN_INFO_IS_RT_CREATABLE_SETTINGS_PROPERTY_KEY, json::JsonValue::CreateBooleanValue(metadata.IsRuntimeCreatableBySettings)); abstractionObject.SetNamedValue(MIDI_SERVICE_JSON_ABSTRACTION_PLUGIN_INFO_IS_SYSTEM_MANAGED_PROPERTY_KEY, json::JsonValue::CreateBooleanValue(metadata.IsSystemManaged)); abstractionObject.SetNamedValue(MIDI_SERVICE_JSON_ABSTRACTION_PLUGIN_INFO_IS_CLIENT_CONFIGURABLE_PROPERTY_KEY, json::JsonValue::CreateBooleanValue(metadata.IsClientConfigurable)); - if (metadata.ClientConfigurationAssemblyName != NULL) abstractionObject.SetNamedValue(MIDI_SERVICE_JSON_ABSTRACTION_PLUGIN_INFO_CLIENT_CONFIG_ASSEMBLY_PROPERTY_KEY, json::JsonValue::CreateStringValue(metadata.ClientConfigurationAssemblyName)); +// if (metadata.ClientConfigurationAssemblyName != NULL) abstractionObject.SetNamedValue(MIDI_SERVICE_JSON_ABSTRACTION_PLUGIN_INFO_CLIENT_CONFIG_ASSEMBLY_PROPERTY_KEY, json::JsonValue::CreateStringValue(metadata.ClientConfigurationAssemblyName)); // add the abstraction metadata to the root, using the abstraction id as the key rootObject.SetNamedValue(internal::GuidToString(metadata.Id).c_str(), abstractionObject); @@ -496,7 +496,7 @@ MidiSrvGetAbstractionList( ::SysFreeString(metadata.Author); ::SysFreeString(metadata.SmallImagePath); ::SysFreeString(metadata.Version); - ::SysFreeString(metadata.ClientConfigurationAssemblyName); +// ::SysFreeString(metadata.ClientConfigurationAssemblyName); } diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerMidiTransform.cpp b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerMidiTransform.cpp deleted file mode 100644 index 3a124452c..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerMidiTransform.cpp +++ /dev/null @@ -1,845 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - -#include "pch.h" - - -DEVPROPKEY FunctionBlockPropertyKeyFromNumber(_In_ uint8_t functionBlockNumber) -{ - DEVPROPKEY key{}; - GUID propertyId{}; - - if (functionBlockNumber < MIDI_MAX_FUNCTION_BLOCKS) - { - if (SUCCEEDED(::CLSIDFromString(MIDI_STRING_PKEY_GUID, &propertyId))) - { - key.fmtid = propertyId; - key.pid = MIDI_FUNCTION_BLOCK_PROPERTY_INDEX_START + functionBlockNumber; - } - else - { - OutputDebugString(L"CLSIDFromString failed for Function Block Property Key"); - } - } - - return key; -} - -DEVPROPKEY FunctionBlockNamePropertyKeyFromNumber(_In_ uint8_t functionBlockNumber) -{ - DEVPROPKEY key{}; - GUID propertyId{}; - - if (functionBlockNumber < MIDI_MAX_FUNCTION_BLOCKS) - { - if (SUCCEEDED(::CLSIDFromString(MIDI_STRING_PKEY_GUID, &propertyId))) - { - key.fmtid = propertyId; - key.pid = MIDI_FUNCTION_BLOCK_NAME_PROPERTY_INDEX_START + functionBlockNumber; - } - } - - return key; -} - - - - - - - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::Initialize( - LPCWSTR deviceId, - PTRANSFORMCREATIONPARAMS creationParams, - DWORD* mmcssTaskId, - IMidiCallback* callback, - LONGLONG context, - IUnknown* MidiDeviceManager -) -{ - UNREFERENCED_PARAMETER(creationParams); - UNREFERENCED_PARAMETER(mmcssTaskId); - - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - RETURN_HR_IF_NULL(E_INVALIDARG, MidiDeviceManager); - RETURN_HR_IF_NULL(E_INVALIDARG, callback); - - RETURN_IF_FAILED(MidiDeviceManager->QueryInterface(__uuidof(IMidiDeviceManagerInterface), (void**)&m_MidiDeviceManager)); - - m_callback = callback; - - m_deviceInstanceId = deviceId; - m_context = context; - - - std::thread workerThread( - &CMidi2EndpointMetadataListenerMidiTransform::QueueWorker, - this); - - // TODO: may need to set thread priority - //SetThreadPriority(workerThread.native_handle(), ... ); - - m_queueWorkerThread = std::move(workerThread); - - // start up the worker thread - m_queueWorkerThread.detach(); - - - return S_OK; -} - -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::Cleanup() -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - m_continueProcessing = false; - m_messageProcessorWakeup.SetEvent(); - - // join the worker thread and wait for it to end - if (m_queueWorkerThread.joinable()) - m_queueWorkerThread.join(); - - - - return S_OK; - -} - - -#define MIDI_ENDPOINT_METADATA_LISTENER_THREAD_SLEEP_DURATION_MS 10000 - -void CMidi2EndpointMetadataListenerMidiTransform::QueueWorker() -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Entering Worker", MIDI_TRACE_EVENT_MESSAGE_FIELD) - ); - - while (m_continueProcessing) - { - // sleep if the queue is empty - if (m_workQueue.size() == 0) - { - // we're in a loop. Before sleeping, check to - // see if we're signaled from before - if (m_messageProcessorWakeup.is_signaled()) - { - m_messageProcessorWakeup.ResetEvent(); - } - - m_messageProcessorWakeup.wait(MIDI_ENDPOINT_METADATA_LISTENER_THREAD_SLEEP_DURATION_MS); - } - - // actually process any data we have - while (m_continueProcessing && m_workQueue.size() > 0) - { - m_queueMutex.lock(); - - auto ump = m_workQueue.front(); - m_workQueue.pop(); - - m_queueMutex.unlock(); - - ProcessStreamMessage(ump); - } - - } - - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Exiting Worker", MIDI_TRACE_EVENT_MESSAGE_FIELD) - ); -} - - - - - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::SendMidiMessage( - PVOID data, - UINT size, - LONGLONG timestamp) -{ - // TODO: This really should have a worker thread doing the message processing - // because we don't want to add any latency or jitter here. This prototype will - // be all in-line, however. - - RETURN_HR_IF_NULL(E_INVALIDARG, data); - - // Forward immediately. The client receives all messages, even if we handle them here - if (m_callback) - { - m_callback->Callback(data, size, timestamp, m_context); - } - - - // now that we're back from the callback, handle the message - - if (size == UMP128_BYTE_COUNT) - { - internal::PackedUmp128 ump; - - if (internal::FillPackedUmp128FromBytePointer((byte*)data, (uint8_t)size, ump)) - { - // if type F, process it. - - if (internal::GetUmpMessageTypeFromFirstWord(ump.word0) == 0xF) - { - m_queueMutex.lock(); - m_workQueue.push(ump); - m_queueMutex.unlock(); - - m_messageProcessorWakeup.SetEvent(); - } - else - { - // not a stream message. Ignore and move on - } - } - else - { - // couldn't fill the UMP. Shouldn't happen since we pre-validate. Just ignore. - //return E_FAIL; - } - } - else - { - // Not a UMP128 so can't be a stream message. Fall out quickly - } - - return S_OK; -} - - - -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateEndpointNameProperty() -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - auto cleanedValue{ internal::TrimmedWStringCopy(m_endpointName) + L"\0" }; - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - - DEVPROPERTY props[] = - { - {{ PKEY_MIDI_EndpointProvidedName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((cleanedValue.length() + 1) * sizeof(WCHAR)), (PVOID)(cleanedValue.c_str()) }, - {{ PKEY_MIDI_EndpointProvidedNameLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - }; - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - // clear out any old value that's in there - //m_endpointName.clear(); - - return S_OK; -} - -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateEndpointProductInstanceIdProperty() -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - - std::wstring cleanedValue{ internal::TrimmedWStringCopy(m_productInstanceId) + L"\0" }; - - DEVPROPERTY props[] = - { - {{ PKEY_MIDI_EndpointProvidedProductInstanceId, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((cleanedValue.length() + 1) * sizeof(WCHAR)), (PVOID)(cleanedValue.c_str()) }, - {{ PKEY_MIDI_EndpointProvidedProductInstanceIdLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - }; - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - // clear out any old value that's in there - //m_productInstanceId.clear(); - - return S_OK; -} - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateFunctionBlockNameProperty(uint8_t functionBlockNumber, std::wstring name) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - - std::wstring cleanedValue{ internal::TrimmedWStringCopy(name) + L"\0" }; - - DEVPROPERTY props[] = - { - {{ FunctionBlockNamePropertyKeyFromNumber(functionBlockNumber), DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((cleanedValue.length() + 1) * sizeof(WCHAR)), (PVOID)(cleanedValue.c_str()) }, - {{ PKEY_MIDI_FunctionBlocksLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - }; - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - // clear out any old name that's in there - // m_functionBlockNames.erase(functionBlockNumber); - - return S_OK; -} - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateStreamConfigurationProperties(internal::PackedUmp128& endpointStreamConfigurationNotificationMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - BYTE configuredProtocol = MIDIWORDBYTE3(endpointStreamConfigurationNotificationMessage.word0); - - DEVPROP_BOOLEAN configuredToSendJR = MIDIWORDBYTE4LOWBIT1(endpointStreamConfigurationNotificationMessage.word0) ? DEVPROP_TRUE : DEVPROP_FALSE; - DEVPROP_BOOLEAN configuredToReceiveJR = MIDIWORDBYTE4LOWBIT2(endpointStreamConfigurationNotificationMessage.word0) ? DEVPROP_TRUE : DEVPROP_FALSE; - - DEVPROPERTY props[] = - { - {{ PKEY_MIDI_EndpointConfiguredToSendJRTimestamps, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(configuredToSendJR)), &configuredToSendJR }, - - {{ PKEY_MIDI_EndpointConfiguredToReceiveJRTimestamps, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(configuredToReceiveJR)), &configuredToReceiveJR }, - - {{ PKEY_MIDI_EndpointConfiguredProtocol, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BYTE, static_cast(sizeof(configuredProtocol)), &configuredProtocol }, - - {{ PKEY_MIDI_EndpointConfigurationLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - - }; - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - return S_OK; -} - - - -// The device identity is a single message, so we don't keep a copy. Instead, we just do -// the parsing here and then update the property. We assume this has already been identified -// as a type=F, form=0, status=0x02 stream message -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateDeviceIdentityProperty(internal::PackedUmp128& identityMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - - MidiDeviceIdentityProperty prop; - - prop.Reserved0 = MIDIWORDSHORT2(identityMessage.word0); - - prop.Reserved1 = internal::CleanupByte7(MIDIWORDBYTE1(identityMessage.word1)); - prop.ManufacturerSysExIdByte1 = internal::CleanupByte7(MIDIWORDBYTE2(identityMessage.word1)); - prop.ManufacturerSysExIdByte2 = internal::CleanupByte7(MIDIWORDBYTE3(identityMessage.word1)); - prop.ManufacturerSysExIdByte3 = internal::CleanupByte7(MIDIWORDBYTE4(identityMessage.word1)); - - prop.DeviceFamilyLsb = internal::CleanupByte7(MIDIWORDBYTE1(identityMessage.word2)); - prop.DeviceFamilyMsb = internal::CleanupByte7(MIDIWORDBYTE2(identityMessage.word2)); - prop.DeviceFamilyModelNumberLsb = internal::CleanupByte7(MIDIWORDBYTE3(identityMessage.word2)); - prop.DeviceFamilyModelNumberMsb = internal::CleanupByte7(MIDIWORDBYTE4(identityMessage.word2)); - - prop.SoftwareRevisionLevelByte1 = internal::CleanupByte7(MIDIWORDBYTE1(identityMessage.word3)); - prop.SoftwareRevisionLevelByte2 = internal::CleanupByte7(MIDIWORDBYTE2(identityMessage.word3)); - prop.SoftwareRevisionLevelByte3 = internal::CleanupByte7(MIDIWORDBYTE3(identityMessage.word3)); - prop.SoftwareRevisionLevelByte4 = internal::CleanupByte7(MIDIWORDBYTE4(identityMessage.word3)); - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - DEVPROPERTY props[] = - { - {{ PKEY_MIDI_DeviceIdentity, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BINARY, static_cast(sizeof(prop)), &prop }, - - {{ PKEY_MIDI_DeviceIdentityLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - - }; - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - return S_OK; -} - - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateEndpointInfoProperties(internal::PackedUmp128& endpointInfoNotificationMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - BYTE umpVersionMajor = MIDIWORDBYTE3(endpointInfoNotificationMessage.word0); - BYTE umpVersionMinor = MIDIWORDBYTE4(endpointInfoNotificationMessage.word0); - BYTE functionBlockCount = internal::CleanupByte7(MIDIWORDBYTE1(endpointInfoNotificationMessage.word1)); - - DEVPROP_BOOLEAN functionBlocksAreStatic = MIDIWORDHIGHBIT(endpointInfoNotificationMessage.word1) ? DEVPROP_TRUE : DEVPROP_FALSE; - - DEVPROP_BOOLEAN supportsMidi1Protocol = MIDIWORDBYTE3LOWBIT1(endpointInfoNotificationMessage.word1) ? DEVPROP_TRUE : DEVPROP_FALSE; - DEVPROP_BOOLEAN supportsMidi2Protocol = MIDIWORDBYTE3LOWBIT2(endpointInfoNotificationMessage.word1) ? DEVPROP_TRUE : DEVPROP_FALSE; - - DEVPROP_BOOLEAN supportsSendingJR = MIDIWORDBYTE4LOWBIT1(endpointInfoNotificationMessage.word1) ? DEVPROP_TRUE : DEVPROP_FALSE; - DEVPROP_BOOLEAN supportsReceivingJR = MIDIWORDBYTE4LOWBIT2(endpointInfoNotificationMessage.word1) ? DEVPROP_TRUE : DEVPROP_FALSE; - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - - DEVPROPERTY props[] = - { - {{ PKEY_MIDI_EndpointSupportsMidi2Protocol, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(supportsMidi2Protocol)), &supportsMidi2Protocol }, - - {{ PKEY_MIDI_EndpointSupportsMidi1Protocol, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(supportsMidi1Protocol)), &supportsMidi1Protocol }, - - {{ PKEY_MIDI_EndpointSupportsReceivingJRTimestamps, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(supportsReceivingJR)), &supportsReceivingJR }, - - {{ PKEY_MIDI_EndpointSupportsSendingJRTimestamps, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(supportsSendingJR)), &supportsSendingJR }, - - {{ PKEY_MIDI_EndpointUmpVersionMajor, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BYTE, static_cast(sizeof(umpVersionMajor)), &umpVersionMajor }, - - {{ PKEY_MIDI_EndpointUmpVersionMinor, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BYTE, static_cast(sizeof(umpVersionMajor)), & umpVersionMinor }, - - {{ PKEY_MIDI_FunctionBlockCount, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BYTE, static_cast(sizeof(functionBlockCount)), &functionBlockCount }, - - {{ PKEY_MIDI_FunctionBlocksAreStatic, DEVPROP_STORE_SYSTEM, nullptr }, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(functionBlocksAreStatic)), &functionBlocksAreStatic }, - - {{ PKEY_MIDI_EndpointInformationLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - - }; - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - return S_OK; -} - - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::UpdateFunctionBlockProperty(internal::PackedUmp128& functionBlockInfoNotificationMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - MidiFunctionBlockProperty prop; - - prop.IsActive = MIDIWORDBYTE3HIGHBIT(functionBlockInfoNotificationMessage.word0); - prop.BlockNumber = internal::CleanupByte7(MIDIWORDBYTE3(functionBlockInfoNotificationMessage.word0)); - prop.Direction = MIDIWORDBYTE4LOWCRUMB1(functionBlockInfoNotificationMessage.word0); - prop.Midi1 = MIDIWORDBYTE4LOWCRUMB2(functionBlockInfoNotificationMessage.word0); - prop.UIHint = MIDIWORDBYTE4LOWCRUMB3(functionBlockInfoNotificationMessage.word0); - prop.Reserved0 = MIDIWORDBYTE4LOWCRUMB4(functionBlockInfoNotificationMessage.word0); - - prop.FirstGroup = MIDIWORDBYTE1(functionBlockInfoNotificationMessage.word1); - prop.NumberOfGroupsSpanned = MIDIWORDBYTE2(functionBlockInfoNotificationMessage.word1); - prop.MidiCIMessageVersionFormat = MIDIWORDBYTE3(functionBlockInfoNotificationMessage.word1); - prop.MaxSysEx8Streams = MIDIWORDBYTE4(functionBlockInfoNotificationMessage.word1); - - prop.Reserved1 = functionBlockInfoNotificationMessage.word2; - prop.Reserved2 = functionBlockInfoNotificationMessage.word3; - - FILETIME currentTime; - GetSystemTimePreciseAsFileTime(¤tTime); - - DEVPROPKEY propKey = FunctionBlockPropertyKeyFromNumber(prop.BlockNumber); - - DEVPROPERTY props[] = - { - {{ propKey, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BINARY, static_cast(sizeof(prop)), &prop }, - - {{ PKEY_MIDI_FunctionBlocksLastUpdateTime, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_FILETIME, static_cast(sizeof(FILETIME)), (PVOID)(¤tTime) }, - - }; - - - RETURN_IF_FAILED(m_MidiDeviceManager->UpdateEndpointProperties(m_deviceInstanceId.c_str(), ARRAYSIZE(props), (PVOID)props)); - - return S_OK; -} - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::ProcessStreamMessage(internal::PackedUmp128 ump) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - auto messageStatus = internal::GetStatusFromStreamMessageFirstWord(ump.word0); - - switch (messageStatus) - { - case MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_INFO_NOTIFICATION: - UpdateEndpointInfoProperties(ump); - break; - case MIDI_STREAM_MESSAGE_STATUS_DEVICE_IDENTITY_NOTIFICATION: - UpdateDeviceIdentityProperty(ump); - break; - case MIDI_STREAM_MESSAGE_STATUS_STREAM_CONFIGURATION_NOTIFICATION: - UpdateStreamConfigurationProperties(ump); - break; - case MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_INFO_NOTIFICATION: - UpdateFunctionBlockProperty(ump); - break; - case MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION: - HandleFunctionBlockNameMessage(ump); - break; - case MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_PRODUCT_INSTANCE_ID_NOTIFICATION: - HandleProductInstanceIdMessage(ump); - break; - case MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION: - HandleEndpointNameMessage(ump); - break; - default: - break; - } - - return S_OK; -} - -std::wstring ParseStreamTextMessage(_In_ internal::PackedUmp128& message) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO) - ); - - - // check the status to know which byte is first to be grabbed - - // preallocate a wstring to the maximum length for a single message to avoid reallocation. Fill with zero - - uint8_t maxCharsThisMessage{ 14 }; // TODO - - uint16_t messageStatus = internal::GetStatusFromStreamMessageFirstWord(message.word0); - - if (messageStatus == MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION) - { - // function block name messages have 13 character bytes instead of 14 due to having the FB number in the message - maxCharsThisMessage = 13; - } - else - { - maxCharsThisMessage = 14; - } - - std::wstring text; - text.reserve(maxCharsThisMessage+1); // try to avoid reallocations - - - if (maxCharsThisMessage == 14) - { - if (MIDIWORDBYTE3(message.word0) != 0) text.push_back((wchar_t)MIDIWORDBYTE3(message.word0)); - } - - // this unroll is easier than looping, honestly. - // Also, the property set completely fails if there are any embedded nuls, so need to - // ignore any in the source data - if (MIDIWORDBYTE4(message.word0) != 0) text.push_back((wchar_t)MIDIWORDBYTE4(message.word0)); - - if (MIDIWORDBYTE1(message.word1) != 0) text.push_back((wchar_t)MIDIWORDBYTE1(message.word1)); - if (MIDIWORDBYTE2(message.word1) != 0) text.push_back((wchar_t)MIDIWORDBYTE2(message.word1)); - if (MIDIWORDBYTE3(message.word1) != 0) text.push_back((wchar_t)MIDIWORDBYTE3(message.word1)); - if (MIDIWORDBYTE4(message.word1) != 0) text.push_back((wchar_t)MIDIWORDBYTE4(message.word1)); - - if (MIDIWORDBYTE1(message.word2) != 0) text.push_back((wchar_t)MIDIWORDBYTE1(message.word2)); - if (MIDIWORDBYTE2(message.word2) != 0) text.push_back((wchar_t)MIDIWORDBYTE2(message.word2)); - if (MIDIWORDBYTE3(message.word2) != 0) text.push_back((wchar_t)MIDIWORDBYTE3(message.word2)); - if (MIDIWORDBYTE4(message.word2) != 0) text.push_back((wchar_t)MIDIWORDBYTE4(message.word2)); - - if (MIDIWORDBYTE1(message.word3) != 0) text.push_back((wchar_t)MIDIWORDBYTE1(message.word3)); - if (MIDIWORDBYTE2(message.word3) != 0) text.push_back((wchar_t)MIDIWORDBYTE2(message.word3)); - if (MIDIWORDBYTE3(message.word3) != 0) text.push_back((wchar_t)MIDIWORDBYTE3(message.word3)); - if (MIDIWORDBYTE4(message.word3) != 0) text.push_back((wchar_t)MIDIWORDBYTE4(message.word3)); - - text.shrink_to_fit(); - - return text; -} - - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::HandleFunctionBlockNameMessage(internal::PackedUmp128& functionBlockNameMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - - uint8_t functionBlockNumber = MIDIWORDBYTE3(functionBlockNameMessage.word0); - - switch (internal::GetFormFromStreamMessageFirstWord(functionBlockNameMessage.word0)) - { - case MIDI_STREAM_MESSAGE_MULTI_FORM_COMPLETE: // complete name in single message. Just update property - RETURN_IF_FAILED(UpdateFunctionBlockNameProperty(functionBlockNumber, ParseStreamTextMessage(functionBlockNameMessage))); - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_START: // start of multi-part name message. Overwrite any other name in the map - { - std::wstring name = ParseStreamTextMessage(functionBlockNameMessage); - - m_functionBlockNames.insert_or_assign(functionBlockNumber, name); - } - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_CONTINUE: //continuation of multi-part name message. Append to name in map - if (m_functionBlockNames.find(functionBlockNumber) != m_functionBlockNames.end()) - { - std::wstring name = m_functionBlockNames.find(functionBlockNumber)->second; - name += ParseStreamTextMessage(functionBlockNameMessage); - - m_functionBlockNames.insert_or_assign(functionBlockNumber, name); - } - else - { - // name isn't already in the map, so a start message was skipped. Don't append anything at all. - } - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_END: // end of multi-part name message. Finish name and update property - if (m_functionBlockNames.find(functionBlockNumber) != m_functionBlockNames.end()) - { - std::wstring name = m_functionBlockNames.find(functionBlockNumber)->second; - name += ParseStreamTextMessage(functionBlockNameMessage); - - RETURN_IF_FAILED(UpdateFunctionBlockNameProperty(functionBlockNumber, name)); - } - else - { - // name isn't already in the map, so at least start message was skipped. Don't append anything at all. - } - break; - - default: - // won't actually happen because the Form field is only 2 bits - break; - } - - return S_OK; -} - - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::HandleEndpointNameMessage(internal::PackedUmp128& endpointNameMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - switch (internal::GetFormFromStreamMessageFirstWord(endpointNameMessage.word0)) - { - case MIDI_STREAM_MESSAGE_MULTI_FORM_COMPLETE: // complete name in single message. Just update property - m_endpointName = ParseStreamTextMessage(endpointNameMessage); - RETURN_IF_FAILED(UpdateEndpointNameProperty()); - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_START: // start of multi-part name message. Overwrite any other name in the map - { - m_endpointName = ParseStreamTextMessage(endpointNameMessage); - } - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_CONTINUE: //continuation of multi-part name message. Append to name in map - if (!m_endpointName.empty()) - { - m_endpointName += ParseStreamTextMessage(endpointNameMessage); - } - else - { - // name isn't already started, so a start message was skipped. Don't append anything at all. - } - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_END: // end of multi-part name message. Finish name and update property - if (!m_endpointName.empty()) - { - m_endpointName += ParseStreamTextMessage(endpointNameMessage); - RETURN_IF_FAILED(UpdateEndpointNameProperty()); - } - else - { - // name isn't already started, so a start message was skipped. Don't append anything at all. - } - - break; - - default: - // won't actually happen because the Form field is only 2 bits - break; - } - - return S_OK; -} - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerMidiTransform::HandleProductInstanceIdMessage(internal::PackedUmp128& productInstanceIdMessage) -{ - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - switch (internal::GetFormFromStreamMessageFirstWord(productInstanceIdMessage.word0)) - { - case MIDI_STREAM_MESSAGE_MULTI_FORM_COMPLETE: // complete name in single message. Just update property - m_productInstanceId = ParseStreamTextMessage(productInstanceIdMessage); - RETURN_IF_FAILED(UpdateEndpointProductInstanceIdProperty()); - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_START: // start of multi-part name message. Overwrite any other name in the map - { - m_productInstanceId = ParseStreamTextMessage(productInstanceIdMessage); - } - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_CONTINUE: //continuation of multi-part name message. Append to name in map - if (!m_productInstanceId.empty()) - { - m_productInstanceId += ParseStreamTextMessage(productInstanceIdMessage); - } - else - { - // name isn't already started, so a start message was skipped. Don't append anything at all. - } - break; - - case MIDI_STREAM_MESSAGE_MULTI_FORM_END: // end of multi-part name message. Finish name and update property - if (!m_productInstanceId.empty()) - { - m_productInstanceId += ParseStreamTextMessage(productInstanceIdMessage); - RETURN_IF_FAILED(UpdateEndpointProductInstanceIdProperty()); - } - else - { - // name isn't already started, so a start message was skipped. Don't append anything at all. - } - - break; - - default: - // won't actually happen because the Form field is only 2 bits - break; - } - - return S_OK; - -} diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerMidiTransform.h b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerMidiTransform.h deleted file mode 100644 index d17ad9f73..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerMidiTransform.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - -#pragma once - - -class CMidi2EndpointMetadataListenerMidiTransform : - public Microsoft::WRL::RuntimeClass< - Microsoft::WRL::RuntimeClassFlags, - IMidiDataTransform> -{ -public: - - STDMETHOD(Initialize(_In_ LPCWSTR, _In_ PTRANSFORMCREATIONPARAMS, _In_ DWORD*, _In_opt_ IMidiCallback*, _In_ LONGLONG, _In_ IUnknown*)); - STDMETHOD(SendMidiMessage(_In_ PVOID message, _In_ UINT size, _In_ LONGLONG)); - STDMETHOD(Cleanup)(); - -private: - HRESULT UpdateEndpointNameProperty(); - HRESULT UpdateEndpointProductInstanceIdProperty(); - HRESULT UpdateFunctionBlockNameProperty(_In_ uint8_t functionBlockNumber, _In_ std::wstring value); - - HRESULT UpdateDeviceIdentityProperty(_In_ internal::PackedUmp128& identityMessage); - HRESULT UpdateEndpointInfoProperties(_In_ internal::PackedUmp128& endpointInfoNotificationMessage); - HRESULT UpdateStreamConfigurationProperties(_In_ internal::PackedUmp128& endpointStreamConfigurationNotificationMessage); - HRESULT UpdateFunctionBlockProperty(_In_ internal::PackedUmp128& functionBlockInfoNotificationMessage); - - HRESULT HandleFunctionBlockNameMessage(_In_ internal::PackedUmp128& functionBlockNameMessage); - HRESULT HandleEndpointNameMessage(_In_ internal::PackedUmp128& endpointNameMessage); - HRESULT HandleProductInstanceIdMessage(_In_ internal::PackedUmp128& productInstanceIdMessage); - - HRESULT ProcessStreamMessage(_In_ internal::PackedUmp128 ump); - - - IMidiCallback* m_callback{ nullptr }; - LONGLONG m_context{ 0 }; - - std::wstring m_deviceInstanceId; - - wil::com_ptr_nothrow m_MidiDeviceManager; - - // these are holding locations while names are built - std::wstring m_endpointName{}; - std::wstring m_productInstanceId{}; - std::map m_functionBlockNames; - - - // Work Queue. We use a queue instead of processing in - // the callback because the latter can result in an infinite - // loop of message sending and processing. - - std::atomic m_continueProcessing{ true }; - wil::slim_event_manual_reset m_messageProcessorWakeup; - std::queue m_workQueue; - std::mutex m_queueMutex; - std::thread m_queueWorkerThread; - - void QueueWorker(); - -}; - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.cpp b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.cpp deleted file mode 100644 index d4cad2338..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "pch.h" - -_Use_decl_annotations_ -HRESULT -CMidi2EndpointMetadataListenerTransform::Activate( - REFIID Iid, - void **Interface -) -{ - RETURN_HR_IF(E_INVALIDARG, nullptr == Interface); - - if (__uuidof(IMidiDataTransform) == Iid) - { - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_INFO, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"IMidiDataTransform", MIDI_TRACE_EVENT_INTERFACE_FIELD) - ); - - wil::com_ptr_nothrow transform; - RETURN_IF_FAILED(Microsoft::WRL::MakeAndInitialize(&transform)); - *Interface = transform.detach(); - } - else - { - TraceLoggingWrite( - MidiEndpointMetadataListenerTransformTelemetryProvider::Provider(), - MIDI_TRACE_EVENT_WARNING, - TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD), - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") - ); - - return E_NOINTERFACE; - } - - return S_OK; -} - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.def b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.def deleted file mode 100644 index 42a13bf2d..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.def +++ /dev/null @@ -1,10 +0,0 @@ -; Copyright (c) Microsoft Corporation. All rights reserved. - -LIBRARY - -EXPORTS - DllCanUnloadNow PRIVATE - DllGetClassObject PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - DllInstall PRIVATE diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.h b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.h deleted file mode 100644 index d1a2d9b23..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - -#pragma once - -class MidiEndpointMetadataListenerTransformTelemetryProvider : public wil::TraceLoggingProvider -{ - IMPLEMENT_TRACELOGGING_CLASS_WITH_MICROSOFT_TELEMETRY( - MidiEndpointMetadataListenerTransformTelemetryProvider, - "Microsoft.Windows.Midi2.EndpointMetadataListenerTransform", - // d5649582-c09a-55e8-90c0-b507720f8176 from hash of name using: - // PS> [System.Diagnostics.Tracing.EventSource]::new("Microsoft.Windows.Midi2.EndpointMetadataListenerTransform").Guid - (0xd5649582, 0xc09a, 0x55e8, 0x90,0xc0, 0xb5,0x07,0x72,0x0f,0x81,0x76)) -}; - -using namespace ATL; - -class ATL_NO_VTABLE CMidi2EndpointMetadataListenerTransform : - public CComObjectRootEx, - public CComCoClass, - public IMidiTransform -{ -public: - CMidi2EndpointMetadataListenerTransform() - { - } - - DECLARE_REGISTRY_RESOURCEID(IDR_MIDI2ENDPOINTMETADATALISTENERTRANSFORM) - - BEGIN_COM_MAP(CMidi2EndpointMetadataListenerTransform) - COM_INTERFACE_ENTRY(IMidiTransform) - END_COM_MAP() - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - STDMETHOD(Activate)(_In_ REFIID, _Out_ void**); -private: -}; - -OBJECT_ENTRY_AUTO(__uuidof(Midi2EndpointMetadataListenerTransform), CMidi2EndpointMetadataListenerTransform) \ No newline at end of file diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.rc b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.rc deleted file mode 100644 index e72f6303d..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.rc +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. - -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include -#endif -#include "winres.h" -#include "verrsrc.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""winres.h""\r\n" - "#include ""verrsrc.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "1 TYPELIB ""Midi2EndpointMetadataListenerTransform.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Microsoft Corporation" - VALUE "FileDescription", "Windows MIDI Services Plugin" - VALUE "FileVersion", "1.0.0.1" - VALUE "LegalCopyright", "Copyright (c) Microsoft Corporation. All rights reserved." - VALUE "InternalName", "Midi2.EndpointMetadataListenerTransform.dll" - VALUE "OriginalFilename", "Midi2.EndpointMetadataListenerTransform.dll" - VALUE "ProductName", "Windows MIDI Services" - VALUE "ProductVersion", "1.0.0.1" - VALUE "OLESelfRegister", "" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1200 - END -END - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_PROJNAME "Midi2.EndpointMetadataListenerTransform" -END - -IDR_MIDI2ENDPOINTMETADATALISTENERTRANSFORM REGISTRY "Midi2.EndpointMetadataListenerTransform.rgs" -//////////////////////////////////////////////////////////////////////////// - - -#endif - -#if 0 -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "Midi2EndpointMetadataListenerAbstraction.tlb" -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED -#endif - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.rgs b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.rgs deleted file mode 100644 index b4e8ece69..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.rgs +++ /dev/null @@ -1,14 +0,0 @@ -HKCR -{ - NoRemove CLSID - { - ForceRemove {597b9a96-9724-4091-9a7b-5f646bc4a4a6} = s 'Midi2EndpointMetadataListenerTransform Class' - { - InprocServer32 = s '%MODULE%' - { - val ThreadingModel = s 'Both' - } - 'Version' = s '1.0' - } - } -} diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj deleted file mode 100644 index 153b55444..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj +++ /dev/null @@ -1,319 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - ARM64EC - - - Release - ARM64 - - - Debug - x64 - - - Release - ARM64EC - - - Release - x64 - - - - 17.0 - {0DDD9961-7959-46B1-A11D-05BA8AF65297} - Win32Proj - 10.0 - Midi2.EndpointMetadataListenerTransform - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) - $(IncludePath) - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) - $(IncludePath) - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) - $(IncludePath) - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) - $(IncludePath) - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) - $(IncludePath) - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) - $(IncludePath) - - - - Level4 - - - - - Level4 - - - - - Level4 - - - - - true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) - Create - pch.h - stdcpp20 - - - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) - Midi2.EndpointMetadataListenerTransform.def - - - $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(Filename).h - - - - - true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) - Create - pch.h - stdcpp20 - - - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) - Midi2.EndpointMetadataListenerTransform.def - - - $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(Filename).h - - - - - true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) - Create - pch.h - stdcpp20 - - - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) - Midi2.EndpointMetadataListenerTransform.def - - - $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(Filename).h - - - - - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) - - - - - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) - - - - - Level4 - - - - - Level4 - - - - - true - Create - pch.h - stdcpp20 - - - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) - Midi2.EndpointMetadataListenerTransform.def - - - $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(Filename).h - - - - - true - Create - pch.h - stdcpp20 - - - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) - Midi2.EndpointMetadataListenerTransform.def - - - $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(Filename).h - - - - - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) - - - - - Level4 - - - - - true - Create - pch.h - stdcpp20 - - - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) - Midi2.EndpointMetadataListenerTransform.def - - - $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(Filename).h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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}. - - - - \ No newline at end of file diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj.filters b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj.filters deleted file mode 100644 index dc597de17..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj.filters +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - Header Files - - - - - - Resource Files - - - Source Files - - - - - {753719c8-0cd3-433c-bef0-eb4595a95173} - - - {3380a190-bb37-44d1-993a-e715222abfa4} - - - {a7cd14c8-5046-433c-8cd6-51e82043e426} - - - - - Source Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2EndpointMetadataListenerTransform.idl b/src/api/Transform/EndpointMetadataListenerTransform/Midi2EndpointMetadataListenerTransform.idl deleted file mode 100644 index 8ce363d67..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2EndpointMetadataListenerTransform.idl +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -import "oaidl.idl"; -import "ocidl.idl"; - -import "WindowsMidiServices.idl"; - -[ - uuid(f9d8d093-27d4-44b8-a458-f057603b4115), - version(1.0), -] -library Midi2EndpointMetadataListenerTransformLib -{ - importlib("stdole2.tlb"); - - [uuid(597b9a96-9724-4091-9a7b-5f646bc4a4a6), version(1.0)] - coclass Midi2EndpointMetadataListenerTransform - { - [default] interface IMidiDataTransform; - } -}; - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Resource.h b/src/api/Transform/EndpointMetadataListenerTransform/Resource.h deleted file mode 100644 index b9a6faaf2..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/Resource.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. - -#define IDS_PROJNAME 100 -#define IDR_MIDI2ENDPOINTMETADATALISTENERTRANSFORM 101 - -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 106 -#endif -#endif diff --git a/src/api/Transform/EndpointMetadataListenerTransform/dllmain.cpp b/src/api/Transform/EndpointMetadataListenerTransform/dllmain.cpp deleted file mode 100644 index 26730995a..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/dllmain.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. - -#include "pch.h" - -CMidi2EndpointMetadataListenerTransformModule _AtlModule; - -extern "C" BOOL WINAPI -DllMain( - HINSTANCE /* hInstance */, - DWORD Reason, - LPVOID Reserved -) -{ - if (Reason == DLL_PROCESS_ATTACH) - { - wil::SetResultTelemetryFallback(MidiEndpointMetadataListenerTransformTelemetryProvider::FallbackTelemetryCallback); - } - - return _AtlModule.DllMain(Reason, Reserved); -} - -_Use_decl_annotations_ -STDAPI -DllCanUnloadNow(void) -{ - return _AtlModule.DllCanUnloadNow(); -} - -_Use_decl_annotations_ -STDAPI -DllGetClassObject( - REFCLSID Clsid, - REFIID Riid, - LPVOID* Object -) -{ - return _AtlModule.DllGetClassObject(Clsid, Riid, Object); -} - -STDAPI -DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - HRESULT hr = _AtlModule.DllRegisterServer(FALSE); - return hr; -} - -STDAPI -DllUnregisterServer(void) -{ - HRESULT hr = _AtlModule.DllUnregisterServer(FALSE); - return hr; -} - -_Use_decl_annotations_ -STDAPI -DllInstall( - BOOL Install, - LPCWSTR ) -{ - HRESULT hr = E_FAIL; - - if (Install) - { - hr = DllRegisterServer(); - if (FAILED(hr)) - { - DllUnregisterServer(); - } - } - else - { - hr = DllUnregisterServer(); - } - - return hr; -} - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/dllmain.h b/src/api/Transform/EndpointMetadataListenerTransform/dllmain.h deleted file mode 100644 index 79463db53..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/dllmain.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -class CMidi2EndpointMetadataListenerTransformModule : public ATL::CAtlDllModuleT< CMidi2EndpointMetadataListenerTransformModule > -{ -public : - DECLARE_LIBID(LIBID_Midi2EndpointMetadataListenerTransformLib) - DECLARE_REGISTRY_APPID_RESOURCEID(IDR_MIDI2ENDPOINTMETADATALISTENERTRANSFORM, "{f9d8d093-27d4-44b8-a458-f057603b4115}") -}; - -extern class CMidi2EndpointMetadataListenerTransformModule _AtlModule; diff --git a/src/api/Transform/EndpointMetadataListenerTransform/packages.config b/src/api/Transform/EndpointMetadataListenerTransform/packages.config deleted file mode 100644 index 09be25d9e..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/api/Transform/EndpointMetadataListenerTransform/pch.cpp b/src/api/Transform/EndpointMetadataListenerTransform/pch.cpp deleted file mode 100644 index b24240bd3..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/pch.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "pch.h" - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/pch.h b/src/api/Transform/EndpointMetadataListenerTransform/pch.h deleted file mode 100644 index c91d02cb8..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/pch.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. - -#pragma once - -#ifndef STRICT -#define STRICT -#endif - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -//#include -//#include -#include -#include -#include -#include -#include -#include - -#include - -#define _ATL_APARTMENT_THREADED -#define _ATL_NO_AUTOMATIC_NAMESPACE -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit -#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW - -#include "resource.h" -#include -#include -#include -#include -#include - -#include -#include - -#include "SWDevice.h" -#include -#include "setupapi.h" -#include "Devpkey.h" - -#include "strsafe.h" - -#include "wstring_util.h" -#include "plugin_defs.h" -#include "midi_timestamp.h" -#include "midi_ump.h" -#include "ump_helpers.h" -#include "midi_ump_message_defs.h" - -namespace internal = ::WindowsMidiServicesInternal; - -#include "WindowsMidiServices.h" -#include "WindowsMidiServices_i.c" - -#include "Midi2EndpointMetadataListenerTransform_i.c" -#include "Midi2EndpointMetadataListenerTransform.h" - - -#include "dllmain.h" - -#include "MidiDefs.h" -#include "MidiXProc.h" - - -#include "Midi2.EndpointMetadataListenerTransform.h" -#include "Midi2.EndpointMetadataListenerMidiTransform.h" - - -// in the src\shared\inc folder in the repo but are duplicated into the API tree for internal reasons - - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/plugin_defs.h b/src/api/Transform/EndpointMetadataListenerTransform/plugin_defs.h deleted file mode 100644 index 5e454256f..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/plugin_defs.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - -#pragma once - - - - diff --git a/src/api/Transform/EndpointMetadataListenerTransform/ump.h b/src/api/Transform/EndpointMetadataListenerTransform/ump.h deleted file mode 100644 index 3c949391d..000000000 --- a/src/api/Transform/EndpointMetadataListenerTransform/ump.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - - - - - -// UMP version is driven by what the Windows API and service implementation supports, so it's hard-coded here -internal::PackedUmp128 MidiEndpointInProtocolMetadataManager::BuildEndpointDiscoveryMessage() -{ - internal::PackedUmp128 ump; - - ump.word0 = 0xF0000101; // UMP 1.1 - - ump.word1 = 0x0000001F; // request everything (Endpoint Info, Device Identity, Endpoint Name, Product Instance Id, Stream Configuration) - ump.word2 = 0; - ump.word3 = 0; - - return ump; -} - - -_Use_decl_annotations_ -internal::PackedUmp128 MidiEndpointInProtocolMetadataManager::BuildFunctionBlockDiscoveryMessage( - uint8_t functionBlockNumber) -{ - internal::PackedUmp128 ump; - - uint8_t filter = 0x03; // request block info and block name - - ump.word0 = 0xF0100000 | ((uint16_t)functionBlockNumber << 8) | filter; - - ump.word1 = 0; - ump.word2 = 0; - ump.word3 = 0; - - return ump; -} - - -_Use_decl_annotations_ -internal::PackedUmp128 MidiEndpointInProtocolMetadataManager::BuildStreamConfigurationRequestMessage( - uint8_t protocol, - bool rxjr, - bool txjr) -{ - internal::PackedUmp128 ump; - - ump.word0 = 0xF0050000 | ((uint16_t)protocol << 8); - - if (rxjr) ump.word0 |= 0x00000002; - if (txjr) ump.word0 |= 0x00000001; - - ump.word1 = 0; - ump.word2 = 0; - ump.word3 = 0; - - return ump; -} diff --git a/src/api/idl/WindowsMidiServices.idl b/src/api/idl/WindowsMidiServices.idl index add7ba004..4073056b8 100644 --- a/src/api/idl/WindowsMidiServices.idl +++ b/src/api/idl/WindowsMidiServices.idl @@ -299,10 +299,6 @@ interface IMidiDeviceManagerInterface : IUnknown [in, annotation("_In_")] PVOID DevPropKeys ); - //HRESULT DeleteAllEndpointInProtocolDiscoveredProperties( - // [in] LPCWSTR DeviceInterfaceId - //); - HRESULT DeactivateEndpoint( [in] LPCWSTR InstanceId ); @@ -324,6 +320,9 @@ interface IMidiDeviceManagerInterface : IUnknown }; +// Service (and Abstraction/Transform) Configuration ================================================================== + + [ object, local, @@ -396,6 +395,9 @@ interface IMidiAbstractionConfigurationManager : IUnknown +// Service Plugin Reporting =============================================================================== + + typedef struct { GUID Id; // class Id @@ -414,8 +416,6 @@ typedef struct BOOL IsSystemManaged; BOOL IsClientConfigurable; - - BSTR ClientConfigurationAssemblyName; } ABSTRACTIONMETADATA, * PABSTRACTIONMETADATA; @@ -437,8 +437,6 @@ typedef struct BOOL IsSystemManaged; BOOL IsClientConfigurable; - - BSTR ClientConfigurationAssemblyName; } TRANSFORMMETADATA, * PTRANSFORMMETADATA; @@ -494,19 +492,10 @@ interface IMidiServicePluginMetadataReporterInterface : IUnknown }; -//typedef struct -//{ -// GUID SessionId; -// DWORD ProcessId; -// BSTR ProcessName; -// BSTR SessionName; -//} MIDI_SESSION_DETAIL, *PMIDI_SESSION_DETAIL; - - +// Session Tracking / Reporting =============================================================================== // this is a bookkeeping class. It tracks only. It does // not own the lifetime of any of the items it tracks. -// [ object, local, @@ -543,6 +532,8 @@ interface IMidiSessionTracker : IUnknown +// Endpoint Discovery and Protocol Negotiation =============================================================================== + typedef struct { BYTE Number; @@ -569,8 +560,8 @@ typedef struct LPCWSTR EndpointSuppliedName; LPCWSTR EndpointSuppliedProductInstanceId; - BYTE NumberOfFunctionBlocksDeclared; - BYTE NumberOfFunctionBlocksReceived; + BYTE CountFunctionBlocksDeclared; + BYTE CountFunctionBlocksReceived; BOOL FunctionBlocksAreStatic; PDISCOVEREDFUNCTIONBLOCK DiscoveredFunctionBlocks; // pointer to an array of discovered function blocks. @@ -578,6 +569,30 @@ typedef struct } ENDPOINTPROTOCOLNEGOTIATIONRESULTS, *PENDPOINTPROTOCOLNEGOTIATIONRESULTS; +typedef struct +{ + BOOL PreferToSendJRTimestampsToEndpoint; + BOOL PreferToReceiveJRTimestampsFromEndpoint; + BYTE PreferredMidiProtocol; + WORD TimeoutMilliseconds; +} ENDPOINTPROTOCOLNEGOTIATIONPARAMS, *PENDPOINTPROTOCOLNEGOTIATIONPARAMS; + +[ + object, + local, + uuid(f948dc64-e03a-4e24-bc6e-437ad729cd50), + pointer_default(unique) +] +interface IMidiProtocolNegotiationCompleteCallback : IUnknown +{ + HRESULT ProtocolNegotiationCompleteCallback( + [in] GUID AbstractionGuid, + [in] LPCWSTR DeviceInterfaceId, + [in] PENDPOINTPROTOCOLNEGOTIATIONRESULTS Results + ); +}; + + [ object, local, @@ -589,11 +604,8 @@ interface IMidiEndpointProtocolManagerInterface : IUnknown HRESULT NegotiateAndRequestMetadata( [in] GUID AbstractionGuid, [in] LPCWSTR DeviceInterfaceId, - [in] BOOL PreferToSendJRTimestampsToEndpoint, - [in] BOOL PreferToReceiveJRTimestampsFromEndpoint, - [in] BYTE PreferredMidiProtocol, - [in] WORD TimeoutMilliseconds, - [out, retval] PENDPOINTPROTOCOLNEGOTIATIONRESULTS* NegotiationResults + [in] ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + [in] IMidiProtocolNegotiationCompleteCallback* NegotiationCompleteCallback ); diff --git a/src/app-sdk/MyMidiApp.exe.manifest b/src/app-sdk/MyMidiApp.exe.manifest index 066d36592..792dcceeb 100644 --- a/src/app-sdk/MyMidiApp.exe.manifest +++ b/src/app-sdk/MyMidiApp.exe.manifest @@ -145,7 +145,7 @@ threadingModel="both" xmlns="urn:schemas-microsoft-com:winrt.v1" /> - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/mididiag/main.cpp b/src/app-sdk/mididiag/main.cpp index 59c0871d4..8817dfa46 100644 --- a/src/app-sdk/mididiag/main.cpp +++ b/src/app-sdk/mididiag/main.cpp @@ -537,7 +537,8 @@ int __cdecl main() OutputSectionHeader(MIDIDIAG_SECTION_LABEL_HEADER); - OutputCurrentTime(); + // this fails on Windows 10 +// OutputCurrentTime(); try { @@ -581,3 +582,4 @@ int __cdecl main() RETURN_SUCCESS; } + diff --git a/src/app-sdk/mididiag/mididiag.exe.manifest b/src/app-sdk/mididiag/mididiag.exe.manifest index 9f9172930..26a375300 100644 --- a/src/app-sdk/mididiag/mididiag.exe.manifest +++ b/src/app-sdk/mididiag/mididiag.exe.manifest @@ -3,11 +3,83 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app-sdk/mididiag/mididiag.vcxproj b/src/app-sdk/mididiag/mididiag.vcxproj index e65652c45..d1056c544 100644 --- a/src/app-sdk/mididiag/mididiag.vcxproj +++ b/src/app-sdk/mididiag/mididiag.vcxproj @@ -66,9 +66,6 @@ - - - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ @@ -177,13 +174,6 @@ Create - - - - - false - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} @@ -203,6 +193,9 @@ true + + + diff --git a/src/app-sdk/mididiag/mididiag.vcxproj.filters b/src/app-sdk/mididiag/mididiag.vcxproj.filters index 395f4036f..3e6f24428 100644 --- a/src/app-sdk/mididiag/mididiag.vcxproj.filters +++ b/src/app-sdk/mididiag/mididiag.vcxproj.filters @@ -31,13 +31,9 @@ - - - - - + - + \ No newline at end of file diff --git a/src/app-sdk/readme.md b/src/app-sdk/readme.md new file mode 100644 index 000000000..b793e10b9 --- /dev/null +++ b/src/app-sdk/readme.md @@ -0,0 +1,4 @@ +# SDK Solution + +Everything in this solution must be buildable as x64, Arm64, and Arm64EC. Therefore, the tests are not included in this solution. + diff --git a/src/app-sdk/sdk-runtime-installer/sdk-package/WindowsMidiServicesSdkRedist.wxs b/src/app-sdk/sdk-runtime-installer/sdk-package/WindowsMidiServicesSdkRedist.wxs index 43a29ce71..bde1f9c5d 100644 --- a/src/app-sdk/sdk-runtime-installer/sdk-package/WindowsMidiServicesSdkRedist.wxs +++ b/src/app-sdk/sdk-runtime-installer/sdk-package/WindowsMidiServicesSdkRedist.wxs @@ -19,9 +19,11 @@ + - + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + Value="[MIDIDIAG_INSTALLFOLDER]" Permanent="no"/> diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2.Sdk.CapabilityInquiry.unittests.vcxproj b/src/app-sdk/tests/Benchmarks/Benchmarks.vcxproj similarity index 93% rename from src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2.Sdk.CapabilityInquiry.unittests.vcxproj rename to src/app-sdk/tests/Benchmarks/Benchmarks.vcxproj index 9bee3a101..91384aa47 100644 --- a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2.Sdk.CapabilityInquiry.unittests.vcxproj +++ b/src/app-sdk/tests/Benchmarks/Benchmarks.vcxproj @@ -21,7 +21,7 @@ 17.0 - {0E23F520-94AA-4AEF-AE89-D4721EE59FA5} + {4DABE157-7DD5-422A-8C77-B83EAC9987D0} Win32Proj 10.0 true @@ -30,6 +30,7 @@ C++/WinRT true true + Benchmarks @@ -89,14 +90,14 @@ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)vsfiles\out\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)vsfiles\out\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) @@ -148,29 +149,30 @@ - + + - + + - + - - {38e2cbfd-6c7a-45fb-b162-6bcc1734a0a1} - true - true - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - true - true + + + {05796b3c-25ff-4ac2-999b-edefb773393c} + + + {72d1a831-0492-41cc-aa58-bdd05c1099f7} diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj.filters b/src/app-sdk/tests/Benchmarks/Benchmarks.vcxproj.filters similarity index 53% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj.filters rename to src/app-sdk/tests/Benchmarks/Benchmarks.vcxproj.filters index 2dc572afa..b42aeb113 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj.filters +++ b/src/app-sdk/tests/Benchmarks/Benchmarks.vcxproj.filters @@ -1,51 +1,50 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - + - Source Files + Support - Source Files + Source - Source Files + Source - Header Files + Support - Header Files + Headers - Header Files + Headers - - Resource Files - + - - + + {205c3afa-ed50-49ff-add2-f455ba3bc3f9} + + + {9709cee3-f1f4-49c6-b9fb-e0626b534922} + + + {6e68e43b-a54f-4beb-a08c-4aa57daf4ada} + - + + Support + + + + \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2ClientBenchmarks.rc b/src/app-sdk/tests/Benchmarks/Midi2ClientBenchmarks.rc similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2ClientBenchmarks.rc rename to src/app-sdk/tests/Benchmarks/Midi2ClientBenchmarks.rc diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiBenchmarks.cpp b/src/app-sdk/tests/Benchmarks/MidiBenchmarks.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiBenchmarks.cpp rename to src/app-sdk/tests/Benchmarks/MidiBenchmarks.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiBenchmarks.h b/src/app-sdk/tests/Benchmarks/MidiBenchmarks.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiBenchmarks.h rename to src/app-sdk/tests/Benchmarks/MidiBenchmarks.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiSchedulerBenchmarks.cpp b/src/app-sdk/tests/Benchmarks/MidiSchedulerBenchmarks.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiSchedulerBenchmarks.cpp rename to src/app-sdk/tests/Benchmarks/MidiSchedulerBenchmarks.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiSchedulerBenchmarks.h b/src/app-sdk/tests/Benchmarks/MidiSchedulerBenchmarks.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/MidiSchedulerBenchmarks.h rename to src/app-sdk/tests/Benchmarks/MidiSchedulerBenchmarks.h diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Module.cpp b/src/app-sdk/tests/Benchmarks/Module.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Module.cpp rename to src/app-sdk/tests/Benchmarks/Module.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/packages.config b/src/app-sdk/tests/Benchmarks/packages.config similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/packages.config rename to src/app-sdk/tests/Benchmarks/packages.config diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/stdafx.h b/src/app-sdk/tests/Benchmarks/stdafx.h similarity index 93% rename from src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/stdafx.h rename to src/app-sdk/tests/Benchmarks/stdafx.h index 8fd3e08b7..0737afd73 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/stdafx.h +++ b/src/app-sdk/tests/Benchmarks/stdafx.h @@ -14,11 +14,11 @@ #include #include -#include +#include using namespace winrt::Microsoft::Windows::Devices::Midi2; using namespace winrt::Microsoft::Windows::Devices::Midi2::Diagnostics; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; +using namespace winrt::Microsoft::Windows::Devices::Midi2::ServiceConfig; #include #include diff --git a/src/app-sdk/tests/Benchmarks/te.exe.manifest b/src/app-sdk/tests/Benchmarks/te.exe.manifest new file mode 100644 index 000000000..971ff9b60 --- /dev/null +++ b/src/app-sdk/tests/Benchmarks/te.exe.manifest @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2.Sdk.CapabilityInquiry.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2.Sdk.CapabilityInquiry.unittests.vcxproj.filters deleted file mode 100644 index 11ea5ec60..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2.Sdk.CapabilityInquiry.unittests.vcxproj.filters +++ /dev/null @@ -1,47 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/stdafx.h deleted file mode 100644 index d75d2b3b3..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/stdafx.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include - -using namespace winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiUniqueIdTests.h" - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/te.exe.manifest b/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/te.exe.manifest deleted file mode 100644 index 817add1b2..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/te.exe.manifest +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2.Sdk.ClientPlugins.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2.Sdk.ClientPlugins.unittests.vcxproj deleted file mode 100644 index 5e7b814ac..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2.Sdk.ClientPlugins.unittests.vcxproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {DE00E7C0-314D-4B0E-80C9-75EBD2706760} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - Midi2.Sdk.ClientPlugins.unittests - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - {3d2bc934-cdc7-4dc7-b7fc-f34b755bf726} - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {05796b3c-25ff-4ac2-999b-edefb773393c} - - - {001601de-b7ab-41d1-81b7-40286b139841} - - - {72d1a831-0492-41cc-aa58-bdd05c1099f7} - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2.Sdk.ClientPlugins.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2.Sdk.ClientPlugins.unittests.vcxproj.filters deleted file mode 100644 index e90817890..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2.Sdk.ClientPlugins.unittests.vcxproj.filters +++ /dev/null @@ -1,45 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2.Sdk.Core.OfflineOnly.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2.Sdk.Core.OfflineOnly.unittests.vcxproj.filters deleted file mode 100644 index b36553b49..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2.Sdk.Core.OfflineOnly.unittests.vcxproj.filters +++ /dev/null @@ -1,84 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/stdafx.h deleted file mode 100644 index 7a8e863b7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/stdafx.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include - -using namespace winrt::Microsoft::Windows::Devices::Midi2; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiClockTests.h" -#include "MidiGroupTests.h" -#include "MidiChannelTests.h" -#include "MidiMessage32Tests.h" -#include "MidiMessage64Tests.h" -#include "MidiMessage96Tests.h" -#include "MidiMessage128Tests.h" - - - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/te.exe.manifest b/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/te.exe.manifest deleted file mode 100644 index e91b99272..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/te.exe.manifest +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj deleted file mode 100644 index 7de3feda6..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj +++ /dev/null @@ -1,379 +0,0 @@ -<<<<<<< HEAD:src/api/Test/Midi2.Client.benchmarks/Midi2.Client.benchmarks.vcxproj - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {4DABE157-7DD5-422A-8C77-B83EAC9987D0} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;miditestcommon.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;miditestcommon.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;miditestcommon.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;miditestcommon.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - - - - - - - - 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}. - - - - - -======= - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {4DABE157-7DD5-422A-8C77-B83EAC9987D0} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - Midi2.Sdk.Core.benchmarks - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {05796b3c-25ff-4ac2-999b-edefb773393c} - - - {72d1a831-0492-41cc-aa58-bdd05c1099f7} - - - - - - - - - - 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}. - - - - - ->>>>>>> pete-dev:src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Midi2.Sdk.Core.benchmarks.vcxproj - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/packages.config b/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.benchmarks/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Core.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/te.exe.manifest b/src/app-sdk/tests/Midi2.Sdk.Core.unittests/te.exe.manifest deleted file mode 100644 index c1cafb23f..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/te.exe.manifest +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2.Sdk.Messages.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2.Sdk.Messages.unittests.vcxproj deleted file mode 100644 index 8cfb7c80c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2.Sdk.Messages.unittests.vcxproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {CE6A83B0-E0AA-4423-9FD9-87C59408DAB8} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {05796b3c-25ff-4ac2-999b-edefb773393c} - - - {001601de-b7ab-41d1-81b7-40286b139841} - - - {001601de-b7ab-41d1-81b7-40286b139841} - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2.Sdk.Messages.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2.Sdk.Messages.unittests.vcxproj.filters deleted file mode 100644 index d68e16959..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2.Sdk.Messages.unittests.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiFunctionBlockMessageBuilderTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiFunctionBlockMessageBuilderTests.cpp deleted file mode 100644 index 7bc5b6d5b..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiFunctionBlockMessageBuilderTests.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - - -using namespace winrt::Microsoft::Devices::Midi2; - - - -void MidiFunctionBlockMessageBuilderTests::TestBuildFunctionBlockNameNotificationLong() -{ - LOG_OUTPUT(L"Test long function block name"); - - winrt::hstring name = L"This is an function block name that is longer than the supported 91 characters for a function block name in MIDI 2"; - uint32_t expectedPacketCount = 7; - - uint8_t functionBlockNumber{ 5 }; - - std::cout << "Testing function block Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildFunctionBlockNameNotificationMessages( - MidiClock::Now(), - functionBlockNumber, - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - for (uint32_t i = 0; i < messages.Size(); i++) - { - std::cout << "Stream word0 0x" << std::hex << messages.GetAt(i).PeekFirstWord() << std::endl; - - // verify status - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION); - - // verify form is correct - if (i == 0) - { - // first message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), (uint8_t)0x01); - } - else if (i == messages.Size() - 1) - { - // last message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), (uint8_t)0x03); - } - else - { - // interim messages - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), (uint8_t)0x02); - } - - - // TODO: Verify function block number is correct - - - } - - - // reverse it back into a string and verify - - auto s = MidiStreamMessageBuilder::ParseFunctionBlockNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, L"This is an function block name that is longer than the supported 91 characters for a functi"); -} - -void MidiFunctionBlockMessageBuilderTests::TestBuildFunctionBlockNameNotificationMedium() -{ - LOG_OUTPUT(L"Test medium function block name"); - - winrt::hstring name = L"A medium-sized name"; - uint32_t expectedPacketCount = 2; - - uint8_t functionBlockNumber{ 5 }; - - std::cout << "Testing function block Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildFunctionBlockNameNotificationMessages( - MidiClock::Now(), - functionBlockNumber, - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x01); - - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), 0x03); - - - // verify form is correct - - // TODO: Verify function block number is correct - - // reverse it back into a string and verify - - - auto s = MidiStreamMessageBuilder::ParseFunctionBlockNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, name); -} - -void MidiFunctionBlockMessageBuilderTests::TestBuildFunctionBlockInfoNotification() -{ - LOG_OUTPUT(L"Building Function Block Info Notification"); - - bool active{ true }; - uint8_t functionBlockNumber{ 5 }; - MidiFunctionBlockUIHint uiHint{ MidiFunctionBlockUIHint::Receiver }; // 1 - MidiFunctionBlockRepresentsMidi10Connection midi10{ MidiFunctionBlockRepresentsMidi10Connection::YesBandwidthRestricted }; // 2 - MidiFunctionBlockDirection direction{ MidiFunctionBlockDirection::Bidirectional }; // 3 - - uint8_t firstGroup{ 6 }; - uint8_t numberOfGroups{ 4 }; - uint8_t midiCIVersionFormat{ 1 }; - uint8_t maxNumberOfSysEx8Streams{ 34 }; // 0x22 - - uint32_t resultingWord0{ 0xF011851B }; // 0x11 is function block info notification - uint32_t resultingWord1{ 0x06040122 }; - - auto ump = MidiStreamMessageBuilder::BuildFunctionBlockInfoNotificationMessage( - MidiClock::Now(), - active, - functionBlockNumber, - uiHint, - midi10, - direction, - firstGroup, - numberOfGroups, - midiCIVersionFormat, - maxNumberOfSysEx8Streams - ); - - // verify values are in the UMP - - auto msg = ump.as(); - - VERIFY_ARE_EQUAL(msg.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(msg.Word1(), resultingWord1); - VERIFY_ARE_EQUAL(msg.Word2(), (uint32_t)0); - VERIFY_ARE_EQUAL(msg.Word3(), (uint32_t)0); -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiFunctionBlockMessageBuilderTests.h b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiFunctionBlockMessageBuilderTests.h deleted file mode 100644 index c52bf8e6f..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiFunctionBlockMessageBuilderTests.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - - -#define MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_INFO_NOTIFICATION (uint8_t)0x11 -#define MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION (uint8_t)0x12 - - -class MidiFunctionBlockMessageBuilderTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiFunctionBlockMessageBuilderTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - //Generic Tests - TEST_METHOD(TestBuildFunctionBlockNameNotificationLong); - TEST_METHOD(TestBuildFunctionBlockNameNotificationMedium); - TEST_METHOD(TestBuildFunctionBlockInfoNotification); - - -private: - - -}; diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessageBuilderTests.h b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessageBuilderTests.h deleted file mode 100644 index fde15e383..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessageBuilderTests.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - -class MidiMessageBuilderTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiMessageBuilderTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - //Generic Tests - TEST_METHOD(TestBuildType0UtilityMessages); - TEST_METHOD(TestBuildType1SystemMessages); - TEST_METHOD(TestBuildType2Midi1ChannelVoiceMessages); - TEST_METHOD(TestBuildType4Midi2ChannelVoiceMessages); - TEST_METHOD(TestBuildTypeFStreamMessages1); - TEST_METHOD(TestBuildTypeFStreamMessages2); - TEST_METHOD(TestBuildMixedDatasetHeaderMessage); - TEST_METHOD(TestBuildMixedDatasetPayloadMessage); - - -private: - - -}; - diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessagePacketTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessagePacketTests.cpp deleted file mode 100644 index 5f173d62f..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessagePacketTests.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - - -using namespace winrt::Microsoft::Devices::Midi2; - -void MidiMessagePacketTests::TestUmp32() -{ - auto mt = MidiMessageType::Midi1ChannelVoice32; - - MidiMessage32 ump; - ump.MessageType(mt); - - VERIFY_ARE_EQUAL(ump.MessageType(), mt); - VERIFY_ARE_EQUAL(ump.PacketType(), MidiPacketType::UniversalMidiPacket32); -} - - -void MidiMessagePacketTests::TestUmp64() -{ - auto mt = MidiMessageType::Midi2ChannelVoice64; - - MidiMessage64 ump; - ump.MessageType(mt); - - VERIFY_ARE_EQUAL(ump.MessageType(), mt); - VERIFY_ARE_EQUAL(ump.PacketType(), MidiPacketType::UniversalMidiPacket64); -} - -void MidiMessagePacketTests::TestUmp96() -{ - auto mt = MidiMessageType::FutureReservedB96; - - MidiMessage96 ump; - ump.MessageType(mt); - - VERIFY_ARE_EQUAL(ump.MessageType(), mt); - VERIFY_ARE_EQUAL(ump.PacketType(), MidiPacketType::UniversalMidiPacket96); -} - - -void MidiMessagePacketTests::TestUmp128() -{ - auto mt = MidiMessageType::Stream128; - - MidiMessage128 ump; - ump.MessageType(mt); - - VERIFY_ARE_EQUAL(ump.MessageType(), mt); - VERIFY_ARE_EQUAL(ump.PacketType(), MidiPacketType::UniversalMidiPacket128); -} - - - -void MidiMessagePacketTests::TestUmpInterfaceCasting() -{ - auto mt = MidiMessageType::Midi1ChannelVoice32; - - MidiMessage32 originalUmp; - originalUmp.Word0(0x08675309); - originalUmp.MessageType(mt); // set message type after the word because it changes Word0 - - VERIFY_ARE_EQUAL(originalUmp.MessageType(), mt); - VERIFY_ARE_EQUAL(originalUmp.PacketType(), MidiPacketType::UniversalMidiPacket32); - - // cast as the interface - IMidiUniversalPacket iface = originalUmp.as(); - VERIFY_ARE_EQUAL(iface.MessageType(), mt); - VERIFY_ARE_EQUAL(iface.PacketType(), MidiPacketType::UniversalMidiPacket32); - - // recast from the interface back to the UMP type to validate data is still there - MidiMessage32 recastUmp = iface.as(); - VERIFY_ARE_EQUAL(recastUmp.MessageType(), mt); - VERIFY_ARE_EQUAL(recastUmp.PacketType(), MidiPacketType::UniversalMidiPacket32); - VERIFY_ARE_EQUAL(recastUmp.Word0(), originalUmp.Word0()); - -} diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessagePacketTests.h b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessagePacketTests.h deleted file mode 100644 index 9c8d7c639..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessagePacketTests.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - - -class MidiMessagePacketTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiMessagePacketTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - TEST_METHOD(TestUmp32); - TEST_METHOD(TestUmp64); - TEST_METHOD(TestUmp96); - TEST_METHOD(TestUmp128); - TEST_METHOD(TestUmpInterfaceCasting); - - -private: - - -}; - diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiStreamMessageBuilderTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiStreamMessageBuilderTests.cpp deleted file mode 100644 index a152b978a..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiStreamMessageBuilderTests.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - -using namespace winrt::Microsoft::Devices::Midi2; - -void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationLong() -{ - winrt::hstring name = L"This is an endpoint name that is longer than the supported 98 characters for an endpoint name in MIDI 2"; - uint32_t expectedPacketCount = 7; - - - std::cout << "Testing endpoint Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildEndpointNameNotificationMessages( - MidiClock::Now(), - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - for (uint32_t i = 0; i < messages.Size(); i++) - { - std::cout << "Stream word0 0x" << std::hex << messages.GetAt(i).PeekFirstWord() << std::endl; - - // verify status - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - - // verify form is correct - if (i == 0) - { - // first message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), 0x01); - } - else if (i == messages.Size() - 1) - { - // last message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), 0x03); - } - else - { - // interim messages - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), 0x02); - } - } - - // reverse it back into a string and verify - - auto s = MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, L"This is an endpoint name that is longer than the supported 98 characters for an endpoint name in M"); -} - - -void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationMedium() -{ - winrt::hstring name = L"This is medium-sized"; - uint32_t expectedPacketCount = 2; - - std::cout << "Testing endpoint Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildEndpointNameNotificationMessages( - MidiClock::Now(), - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x01); - - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), 0x03); - - // verify form is correct - - // reverse it back into a string and verify - - - auto s = MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, name); - -} - -void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationShort() -{ - winrt::hstring name = L"Short"; - uint32_t expectedPacketCount = 1; - - std::cout << "Testing endpoint Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildEndpointNameNotificationMessages( - MidiClock::Now(), - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - std::cout << "Stream Message 1 word0 0x" << std::hex << messages.GetAt(0).PeekFirstWord() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - - // verify form is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x00); - - // reverse it back into a string and verify - auto s = MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, name); -} - - -void MidiStreamMessageBuilderTests::TestBuildProductInstanceIdNotificationShort() -{ - winrt::hstring productInstanceId = L"ABC123"; - uint32_t expectedPacketCount = 1; - - std::cout << "Testing endpoint Id: " << winrt::to_string(productInstanceId) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildProductInstanceIdNotificationMessages( - MidiClock::Now(), - productInstanceId - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - std::cout << "Stream Message 1 word0 0x" << std::hex << messages.GetAt(0).PeekFirstWord() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_PRODUCT_INSTANCE_ID_NOTIFICATION); - - // verify form is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x00); - - // reverse it back into a string and verify - -} \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiStreamMessageBuilderTests.h b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiStreamMessageBuilderTests.h deleted file mode 100644 index a94bfcf47..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiStreamMessageBuilderTests.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - - -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_DISCOVERY (uint8_t)0x00 -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_INFO_NOTIFICATION (uint8_t)0x01 -#define MIDI_STREAM_MESSAGE_STATUS_DEVICE_IDENTITY_NOTIFICATION (uint8_t)0x02 -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION (uint8_t)0x03 -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_PRODUCT_INSTANCE_ID_NOTIFICATION (uint8_t)0x04 -#define MIDI_STREAM_MESSAGE_STATUS_STREAM_CONFIGURATION_REQUEST (uint8_t)0x05 -#define MIDI_STREAM_MESSAGE_STATUS_STREAM_CONFIGURATION_NOTIFICATION (uint8_t)0x06 - - -class MidiStreamMessageBuilderTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiStreamMessageBuilderTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - TEST_METHOD(TestBuildEndpointNameNotificationLong); - TEST_METHOD(TestBuildEndpointNameNotificationMedium); - TEST_METHOD(TestBuildEndpointNameNotificationShort); - TEST_METHOD(TestBuildProductInstanceIdNotificationShort); - - -private: - - -}; - diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/stdafx.h deleted file mode 100644 index aa5a795c2..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/stdafx.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace winrt::Microsoft::Devices::Midi2; -using namespace winrt::Microsoft::Devices::Midi2::Diagnostics; -using namespace winrt::Microsoft::Devices::Midi2::Messages; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiFunctionBlockMessageBuilderTests.h" -#include "MidiMessageBuilderTests.h" -#include "MidiMessagePacketTests.h" -#include "MidiStreamMessageBuilderTests.h" - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2.Sdk.Endpoint.Ble.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2.Sdk.Endpoint.Ble.unittests.vcxproj deleted file mode 100644 index 8fa1aedb9..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2.Sdk.Endpoint.Ble.unittests.vcxproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {706A85A3-0660-4939-A8C5-65E00D0B45AB} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {05796b3c-25ff-4ac2-999b-edefb773393c} - - - {001601de-b7ab-41d1-81b7-40286b139841} - - - {001601de-b7ab-41d1-81b7-40286b139841} - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2.Sdk.Endpoint.Ble.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2.Sdk.Endpoint.Ble.unittests.vcxproj.filters deleted file mode 100644 index d68e16959..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2.Sdk.Endpoint.Ble.unittests.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiFunctionBlockMessageBuilderTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiFunctionBlockMessageBuilderTests.cpp deleted file mode 100644 index 7bc5b6d5b..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiFunctionBlockMessageBuilderTests.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - - -using namespace winrt::Microsoft::Devices::Midi2; - - - -void MidiFunctionBlockMessageBuilderTests::TestBuildFunctionBlockNameNotificationLong() -{ - LOG_OUTPUT(L"Test long function block name"); - - winrt::hstring name = L"This is an function block name that is longer than the supported 91 characters for a function block name in MIDI 2"; - uint32_t expectedPacketCount = 7; - - uint8_t functionBlockNumber{ 5 }; - - std::cout << "Testing function block Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildFunctionBlockNameNotificationMessages( - MidiClock::Now(), - functionBlockNumber, - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - for (uint32_t i = 0; i < messages.Size(); i++) - { - std::cout << "Stream word0 0x" << std::hex << messages.GetAt(i).PeekFirstWord() << std::endl; - - // verify status - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION); - - // verify form is correct - if (i == 0) - { - // first message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), (uint8_t)0x01); - } - else if (i == messages.Size() - 1) - { - // last message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), (uint8_t)0x03); - } - else - { - // interim messages - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), (uint8_t)0x02); - } - - - // TODO: Verify function block number is correct - - - } - - - // reverse it back into a string and verify - - auto s = MidiStreamMessageBuilder::ParseFunctionBlockNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, L"This is an function block name that is longer than the supported 91 characters for a functi"); -} - -void MidiFunctionBlockMessageBuilderTests::TestBuildFunctionBlockNameNotificationMedium() -{ - LOG_OUTPUT(L"Test medium function block name"); - - winrt::hstring name = L"A medium-sized name"; - uint32_t expectedPacketCount = 2; - - uint8_t functionBlockNumber{ 5 }; - - std::cout << "Testing function block Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildFunctionBlockNameNotificationMessages( - MidiClock::Now(), - functionBlockNumber, - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x01); - - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), 0x03); - - - // verify form is correct - - // TODO: Verify function block number is correct - - // reverse it back into a string and verify - - - auto s = MidiStreamMessageBuilder::ParseFunctionBlockNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, name); -} - -void MidiFunctionBlockMessageBuilderTests::TestBuildFunctionBlockInfoNotification() -{ - LOG_OUTPUT(L"Building Function Block Info Notification"); - - bool active{ true }; - uint8_t functionBlockNumber{ 5 }; - MidiFunctionBlockUIHint uiHint{ MidiFunctionBlockUIHint::Receiver }; // 1 - MidiFunctionBlockRepresentsMidi10Connection midi10{ MidiFunctionBlockRepresentsMidi10Connection::YesBandwidthRestricted }; // 2 - MidiFunctionBlockDirection direction{ MidiFunctionBlockDirection::Bidirectional }; // 3 - - uint8_t firstGroup{ 6 }; - uint8_t numberOfGroups{ 4 }; - uint8_t midiCIVersionFormat{ 1 }; - uint8_t maxNumberOfSysEx8Streams{ 34 }; // 0x22 - - uint32_t resultingWord0{ 0xF011851B }; // 0x11 is function block info notification - uint32_t resultingWord1{ 0x06040122 }; - - auto ump = MidiStreamMessageBuilder::BuildFunctionBlockInfoNotificationMessage( - MidiClock::Now(), - active, - functionBlockNumber, - uiHint, - midi10, - direction, - firstGroup, - numberOfGroups, - midiCIVersionFormat, - maxNumberOfSysEx8Streams - ); - - // verify values are in the UMP - - auto msg = ump.as(); - - VERIFY_ARE_EQUAL(msg.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(msg.Word1(), resultingWord1); - VERIFY_ARE_EQUAL(msg.Word2(), (uint32_t)0); - VERIFY_ARE_EQUAL(msg.Word3(), (uint32_t)0); -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiFunctionBlockMessageBuilderTests.h b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiFunctionBlockMessageBuilderTests.h deleted file mode 100644 index c52bf8e6f..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiFunctionBlockMessageBuilderTests.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - - -#define MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_INFO_NOTIFICATION (uint8_t)0x11 -#define MIDI_STREAM_MESSAGE_STATUS_FUNCTION_BLOCK_NAME_NOTIFICATION (uint8_t)0x12 - - -class MidiFunctionBlockMessageBuilderTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiFunctionBlockMessageBuilderTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - //Generic Tests - TEST_METHOD(TestBuildFunctionBlockNameNotificationLong); - TEST_METHOD(TestBuildFunctionBlockNameNotificationMedium); - TEST_METHOD(TestBuildFunctionBlockInfoNotification); - - -private: - - -}; diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessageBuilderTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessageBuilderTests.cpp deleted file mode 100644 index 6b711ac66..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessageBuilderTests.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - -void MidiMessageBuilderTests::TestBuildType0UtilityMessages() -{ - uint8_t status = 0x0D; - uint32_t dataOrReserved = 0x00020; - uint32_t expectedWord0 = 0x00D00020; - - LOG_OUTPUT(L"Building Utility Message"); - - auto message = MidiMessageBuilder::BuildUtilityMessage( - MidiClock::Now(), - status, - dataOrReserved - ); - - VERIFY_ARE_EQUAL(message.Word0(), expectedWord0); -} - -void MidiMessageBuilderTests::TestBuildType1SystemMessages() -{ - uint8_t group = 0x3; - uint8_t status = 0xD; - uint8_t midiByte2 = 0x3C; - uint8_t midiByte3 = 0x3F; - uint32_t expectedWord0 = 0x130D3C3F; - - LOG_OUTPUT(L"Building System Message"); - - auto message = MidiMessageBuilder::BuildSystemMessage( - MidiClock::Now(), - MidiGroup(group), - status, - midiByte2, - midiByte3 - ); - - VERIFY_ARE_EQUAL(message.Word0(), expectedWord0); -} - -void MidiMessageBuilderTests::TestBuildType2Midi1ChannelVoiceMessages() -{ - MidiGroup grp{ 0x4 }; - Midi1ChannelVoiceMessageStatus status = Midi1ChannelVoiceMessageStatus::NoteOn; // 9 - MidiChannel ch{ 0xF }; - uint8_t note{ 0x71 }; - uint8_t velocity{ 0x7F }; - - // update this if you change any values from above. We're not using a - // function to create this because we need to check our logic in this test - uint32_t resultingWord0 = 0x249F717F; - - LOG_OUTPUT(L"Building MIDI 1 Channel Voice Message"); - - auto ump = MidiMessageBuilder::BuildMidi1ChannelVoiceMessage( - MidiClock::Now(), - grp, - status, - ch, - note, - velocity); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); -} - -void MidiMessageBuilderTests::TestBuildType4Midi2ChannelVoiceMessages() -{ - MidiGroup grp{ 0x5 }; - Midi2ChannelVoiceMessageStatus status = Midi2ChannelVoiceMessageStatus::NoteOn; // 9 - MidiChannel ch{ 0xF }; - uint16_t index{ 0x6655 }; // not a real attribute type - uint16_t velocity{ 0xFF7F }; - uint16_t attribute{ 0xD00B }; // not real attribute data - - uint32_t data = velocity << 16 | attribute; - - // update this if you change any values from above. We're not using a - // function to create this because we need to check our logic in this test - uint32_t resultingWord0 = 0x459F6655; - uint32_t resultingWord1 = 0xFF7FD00B; - - LOG_OUTPUT(L"Building MIDI 2 Channel Voice Message"); - - auto ump = MidiMessageBuilder::BuildMidi2ChannelVoiceMessage( - MidiClock::Now(), - grp, - status, - ch, - index, - data - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), resultingWord1); -} - -void MidiMessageBuilderTests::TestBuildTypeFStreamMessages1() -{ - LOG_OUTPUT(L"Building Stream Message 1"); - - uint8_t form = 0x3; - uint16_t status = 0x02; - uint16_t word0Remaining = 0x1234; - uint32_t word1 = 0x86753090; - uint32_t word2 = 0x03263727; - uint32_t word3 = 0x10203040; - - uint32_t resultingWord0 = 0xFC021234; // shifting of form to be the two high bits of the nibble changes it from 3 to C - - auto ump = MidiMessageBuilder::BuildStreamMessage( - MidiClock::Now(), - form, - status, - word0Remaining, - word1, - word2, - word3 - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), word1); - VERIFY_ARE_EQUAL(ump.Word2(), word2); - VERIFY_ARE_EQUAL(ump.Word3(), word3); -} - -void MidiMessageBuilderTests::TestBuildTypeFStreamMessages2() -{ - LOG_OUTPUT(L"Building Stream Message 2"); - - uint8_t form = 0x3; - uint16_t status = 0x32; - uint16_t word0Remaining = 0xF23F; - uint32_t word1 = 0x86753090; - uint32_t word2 = 0x03263727; - uint32_t word3 = 0x10203040; - - uint32_t resultingWord0 = 0xFC32F23F; // shifting of form to be the two high bits of the nibble changes it from 3 to C - - auto ump = MidiMessageBuilder::BuildStreamMessage( - MidiClock::Now(), - form, - status, - word0Remaining, - word1, - word2, - word3 - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), word1); - VERIFY_ARE_EQUAL(ump.Word2(), word2); - VERIFY_ARE_EQUAL(ump.Word3(), word3); -} - -void MidiMessageBuilderTests::TestBuildMixedDatasetHeaderMessage() -{ - LOG_OUTPUT(L"Building Mixed Dataset Header"); - - uint8_t group{ 0xA }; - uint8_t mdsId{ 0xD }; - uint16_t numberOfValidBytesInChunk{ 0x0099 }; - uint16_t numberOfChunksInDatSet{ 8 }; - uint16_t numberOfThisChunk{ 7 }; - uint16_t manufacturerId{ 0x5150 }; - uint16_t deviceId{ 0x1984 }; - uint16_t subId1{ 0x0326 }; - uint16_t subId2{ 0x3827 }; - - uint32_t resultingWord0 = 0x5A8D0099; - uint32_t resultingWord1 = 0x00080007; - uint32_t resultingWord2 = 0x51501984; - uint32_t resultingWord3 = 0x03263827; - - auto ump = MidiMessageBuilder::BuildMixedDataSetChunkHeaderMessage( - MidiClock::Now(), - MidiGroup(group), - mdsId, - numberOfValidBytesInChunk, - numberOfChunksInDatSet, - numberOfThisChunk, - manufacturerId, - deviceId, - subId1, - subId2 - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), resultingWord1); - VERIFY_ARE_EQUAL(ump.Word2(), resultingWord2); - VERIFY_ARE_EQUAL(ump.Word3(), resultingWord3); -} - -void MidiMessageBuilderTests::TestBuildMixedDatasetPayloadMessage() -{ - LOG_OUTPUT(L"Building Mixed Dataset Payload"); - - uint8_t group{ 0xA }; - uint8_t mdsId{ 0xD }; - - uint32_t resultingWord0 = 0x5A9D0102; - uint32_t resultingWord1 = 0x03040506; - uint32_t resultingWord2 = 0x0708090A; - uint32_t resultingWord3 = 0x0B0C0D0E; - - auto ump = MidiMessageBuilder::BuildMixedDataSetChunkDataMessage( - MidiClock::Now(), - MidiGroup(group), - mdsId, - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), resultingWord1); - VERIFY_ARE_EQUAL(ump.Word2(), resultingWord2); - VERIFY_ARE_EQUAL(ump.Word3(), resultingWord3); -} - - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessageBuilderTests.h b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessageBuilderTests.h deleted file mode 100644 index fde15e383..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessageBuilderTests.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - -class MidiMessageBuilderTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiMessageBuilderTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - //Generic Tests - TEST_METHOD(TestBuildType0UtilityMessages); - TEST_METHOD(TestBuildType1SystemMessages); - TEST_METHOD(TestBuildType2Midi1ChannelVoiceMessages); - TEST_METHOD(TestBuildType4Midi2ChannelVoiceMessages); - TEST_METHOD(TestBuildTypeFStreamMessages1); - TEST_METHOD(TestBuildTypeFStreamMessages2); - TEST_METHOD(TestBuildMixedDatasetHeaderMessage); - TEST_METHOD(TestBuildMixedDatasetPayloadMessage); - - -private: - - -}; - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiStreamMessageBuilderTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiStreamMessageBuilderTests.cpp deleted file mode 100644 index a152b978a..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiStreamMessageBuilderTests.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - -using namespace winrt::Microsoft::Devices::Midi2; - -void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationLong() -{ - winrt::hstring name = L"This is an endpoint name that is longer than the supported 98 characters for an endpoint name in MIDI 2"; - uint32_t expectedPacketCount = 7; - - - std::cout << "Testing endpoint Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildEndpointNameNotificationMessages( - MidiClock::Now(), - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - for (uint32_t i = 0; i < messages.Size(); i++) - { - std::cout << "Stream word0 0x" << std::hex << messages.GetAt(i).PeekFirstWord() << std::endl; - - // verify status - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - - // verify form is correct - if (i == 0) - { - // first message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), 0x01); - } - else if (i == messages.Size() - 1) - { - // last message - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), 0x03); - } - else - { - // interim messages - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(i).PeekFirstWord()), 0x02); - } - } - - // reverse it back into a string and verify - - auto s = MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, L"This is an endpoint name that is longer than the supported 98 characters for an endpoint name in M"); -} - - -void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationMedium() -{ - winrt::hstring name = L"This is medium-sized"; - uint32_t expectedPacketCount = 2; - - std::cout << "Testing endpoint Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildEndpointNameNotificationMessages( - MidiClock::Now(), - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x01); - - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(1).PeekFirstWord()), 0x03); - - // verify form is correct - - // reverse it back into a string and verify - - - auto s = MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, name); - -} - -void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationShort() -{ - winrt::hstring name = L"Short"; - uint32_t expectedPacketCount = 1; - - std::cout << "Testing endpoint Name: " << winrt::to_string(name) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildEndpointNameNotificationMessages( - MidiClock::Now(), - name - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - std::cout << "Stream Message 1 word0 0x" << std::hex << messages.GetAt(0).PeekFirstWord() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION); - - // verify form is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x00); - - // reverse it back into a string and verify - auto s = MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages(messages); - std::cout << "Parsed: '" << winrt::to_string(s) << "'" << std::endl; - VERIFY_ARE_EQUAL(s, name); -} - - -void MidiStreamMessageBuilderTests::TestBuildProductInstanceIdNotificationShort() -{ - winrt::hstring productInstanceId = L"ABC123"; - uint32_t expectedPacketCount = 1; - - std::cout << "Testing endpoint Id: " << winrt::to_string(productInstanceId) << std::endl; - - auto messages = MidiStreamMessageBuilder::BuildProductInstanceIdNotificationMessages( - MidiClock::Now(), - productInstanceId - ); - - std::cout << "Expected ump count " << expectedPacketCount << ", received " << messages.Size() << std::endl; - - std::cout << "Stream Message 1 word0 0x" << std::hex << messages.GetAt(0).PeekFirstWord() << std::endl; - - // count the number of messages we get back - VERIFY_ARE_EQUAL(messages.Size(), expectedPacketCount); - - for (auto ump : messages) - { - auto message = ump.as(); - - std::cout << "Stream Message words" - << " 0x" << std::hex << message.Word0() - << " 0x" << std::hex << message.Word1() - << " 0x" << std::hex << message.Word2() - << " 0x" << std::hex << message.Word3() - << std::endl; - } - - - // verify status is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetStatusFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_PRODUCT_INSTANCE_ID_NOTIFICATION); - - // verify form is correct - VERIFY_ARE_EQUAL(MidiMessageHelper::GetFormFromStreamMessageFirstWord(messages.GetAt(0).PeekFirstWord()), 0x00); - - // reverse it back into a string and verify - -} \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiStreamMessageBuilderTests.h b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiStreamMessageBuilderTests.h deleted file mode 100644 index a94bfcf47..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiStreamMessageBuilderTests.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#pragma once - -using namespace winrt::Microsoft::Devices::Midi2; - - -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_DISCOVERY (uint8_t)0x00 -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_INFO_NOTIFICATION (uint8_t)0x01 -#define MIDI_STREAM_MESSAGE_STATUS_DEVICE_IDENTITY_NOTIFICATION (uint8_t)0x02 -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_NAME_NOTIFICATION (uint8_t)0x03 -#define MIDI_STREAM_MESSAGE_STATUS_ENDPOINT_PRODUCT_INSTANCE_ID_NOTIFICATION (uint8_t)0x04 -#define MIDI_STREAM_MESSAGE_STATUS_STREAM_CONFIGURATION_REQUEST (uint8_t)0x05 -#define MIDI_STREAM_MESSAGE_STATUS_STREAM_CONFIGURATION_NOTIFICATION (uint8_t)0x06 - - -class MidiStreamMessageBuilderTests - : public WEX::TestClass -{ -public: - - BEGIN_TEST_CLASS(MidiStreamMessageBuilderTests) - TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Devices.Midi2.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.BluetoothMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.DiagnosticsAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.KSAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.MidiSrvAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.NetworkMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualMidiAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Midi2.VirtualPatchBayAbstraction.dll") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Minmidi.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"usbmidi2.sys") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"MidiSrv.exe") - END_TEST_CLASS() - - //TEST_CLASS_SETUP(ClassSetup); - //TEST_CLASS_CLEANUP(ClassCleanup); - - //TEST_METHOD_SETUP(TestSetup); - //TEST_METHOD_CLEANUP(TestCleanup); - - TEST_METHOD(TestBuildEndpointNameNotificationLong); - TEST_METHOD(TestBuildEndpointNameNotificationMedium); - TEST_METHOD(TestBuildEndpointNameNotificationShort); - TEST_METHOD(TestBuildProductInstanceIdNotificationShort); - - -private: - - -}; - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/stdafx.h deleted file mode 100644 index aa5a795c2..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/stdafx.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace winrt::Microsoft::Devices::Midi2; -using namespace winrt::Microsoft::Devices::Midi2::Diagnostics; -using namespace winrt::Microsoft::Devices::Midi2::Messages; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiFunctionBlockMessageBuilderTests.h" -#include "MidiMessageBuilderTests.h" -#include "MidiMessagePacketTests.h" -#include "MidiStreamMessageBuilderTests.h" - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2.Sdk.Endpoint.Loopback.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2.Sdk.Endpoint.Loopback.unittests.vcxproj deleted file mode 100644 index 7a82e3cbd..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2.Sdk.Endpoint.Loopback.unittests.vcxproj +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {E10B42B4-1485-4A9F-B44B-4E3E98614D8C} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - Midi2.Sdk.Endpoint.Loopback.unittests - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {d3b84d5d-8bed-4cb7-b430-b0bf1e46f3a1} - - - {72d1a831-0492-41cc-aa58-bdd05c1099f7} - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2.Sdk.Endpoint.Loopback.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2.Sdk.Endpoint.Loopback.unittests.vcxproj.filters deleted file mode 100644 index f015b7c04..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2.Sdk.Endpoint.Loopback.unittests.vcxproj.filters +++ /dev/null @@ -1,45 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/MidiLoopbackEndpointTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/MidiLoopbackEndpointTests.cpp deleted file mode 100644 index 9b3bcf7fd..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/MidiLoopbackEndpointTests.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - - -void MidiLoopbackEndpointTests::TestLoopbackEndpoint() -{ - LOG_OUTPUT(L"TestLoopbackEndpoint **********************************************************************"); - - // TODO: Test loopback endpoint creation - -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/stdafx.h deleted file mode 100644 index bdd11b6bb..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/stdafx.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace winrt::Microsoft::Windows::Devices::Midi2; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiLoopbackEndpointTests.h" - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2.Sdk.Endpoint.Virtual.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2.Sdk.Endpoint.Virtual.unittests.vcxproj deleted file mode 100644 index 78cbf3f01..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2.Sdk.Endpoint.Virtual.unittests.vcxproj +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {EB6F4A41-AD23-447B-A0C0-64F8ED6933FD} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - Midi2.Sdk.Endpoint.Virtual.unittests - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {9b93146c-4d9d-4915-becb-5227df2667e2} - - - {72d1a831-0492-41cc-aa58-bdd05c1099f7} - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2.Sdk.Endpoint.Virtual.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2.Sdk.Endpoint.Virtual.unittests.vcxproj.filters deleted file mode 100644 index db1925f1a..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2.Sdk.Endpoint.Virtual.unittests.vcxproj.filters +++ /dev/null @@ -1,45 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/stdafx.h deleted file mode 100644 index f3bd7cefa..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/stdafx.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace winrt::Microsoft::Windows::Devices::Midi2; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; - - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiVirtualDeviceTests.h" - - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2.Sdk.Messages.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2.Sdk.Messages.unittests.vcxproj deleted file mode 100644 index 9d7bc92f3..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2.Sdk.Messages.unittests.vcxproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {CE6A83B0-E0AA-4423-9FD9-87C59408DAB8} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - true - true - - - {001601de-b7ab-41d1-81b7-40286b139841} - true - true - - - - - true - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2.Sdk.Messages.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2.Sdk.Messages.unittests.vcxproj.filters deleted file mode 100644 index 5ac384a41..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2.Sdk.Messages.unittests.vcxproj.filters +++ /dev/null @@ -1,60 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiMessageBuilderTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiMessageBuilderTests.cpp deleted file mode 100644 index 6b711ac66..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiMessageBuilderTests.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - -void MidiMessageBuilderTests::TestBuildType0UtilityMessages() -{ - uint8_t status = 0x0D; - uint32_t dataOrReserved = 0x00020; - uint32_t expectedWord0 = 0x00D00020; - - LOG_OUTPUT(L"Building Utility Message"); - - auto message = MidiMessageBuilder::BuildUtilityMessage( - MidiClock::Now(), - status, - dataOrReserved - ); - - VERIFY_ARE_EQUAL(message.Word0(), expectedWord0); -} - -void MidiMessageBuilderTests::TestBuildType1SystemMessages() -{ - uint8_t group = 0x3; - uint8_t status = 0xD; - uint8_t midiByte2 = 0x3C; - uint8_t midiByte3 = 0x3F; - uint32_t expectedWord0 = 0x130D3C3F; - - LOG_OUTPUT(L"Building System Message"); - - auto message = MidiMessageBuilder::BuildSystemMessage( - MidiClock::Now(), - MidiGroup(group), - status, - midiByte2, - midiByte3 - ); - - VERIFY_ARE_EQUAL(message.Word0(), expectedWord0); -} - -void MidiMessageBuilderTests::TestBuildType2Midi1ChannelVoiceMessages() -{ - MidiGroup grp{ 0x4 }; - Midi1ChannelVoiceMessageStatus status = Midi1ChannelVoiceMessageStatus::NoteOn; // 9 - MidiChannel ch{ 0xF }; - uint8_t note{ 0x71 }; - uint8_t velocity{ 0x7F }; - - // update this if you change any values from above. We're not using a - // function to create this because we need to check our logic in this test - uint32_t resultingWord0 = 0x249F717F; - - LOG_OUTPUT(L"Building MIDI 1 Channel Voice Message"); - - auto ump = MidiMessageBuilder::BuildMidi1ChannelVoiceMessage( - MidiClock::Now(), - grp, - status, - ch, - note, - velocity); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); -} - -void MidiMessageBuilderTests::TestBuildType4Midi2ChannelVoiceMessages() -{ - MidiGroup grp{ 0x5 }; - Midi2ChannelVoiceMessageStatus status = Midi2ChannelVoiceMessageStatus::NoteOn; // 9 - MidiChannel ch{ 0xF }; - uint16_t index{ 0x6655 }; // not a real attribute type - uint16_t velocity{ 0xFF7F }; - uint16_t attribute{ 0xD00B }; // not real attribute data - - uint32_t data = velocity << 16 | attribute; - - // update this if you change any values from above. We're not using a - // function to create this because we need to check our logic in this test - uint32_t resultingWord0 = 0x459F6655; - uint32_t resultingWord1 = 0xFF7FD00B; - - LOG_OUTPUT(L"Building MIDI 2 Channel Voice Message"); - - auto ump = MidiMessageBuilder::BuildMidi2ChannelVoiceMessage( - MidiClock::Now(), - grp, - status, - ch, - index, - data - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), resultingWord1); -} - -void MidiMessageBuilderTests::TestBuildTypeFStreamMessages1() -{ - LOG_OUTPUT(L"Building Stream Message 1"); - - uint8_t form = 0x3; - uint16_t status = 0x02; - uint16_t word0Remaining = 0x1234; - uint32_t word1 = 0x86753090; - uint32_t word2 = 0x03263727; - uint32_t word3 = 0x10203040; - - uint32_t resultingWord0 = 0xFC021234; // shifting of form to be the two high bits of the nibble changes it from 3 to C - - auto ump = MidiMessageBuilder::BuildStreamMessage( - MidiClock::Now(), - form, - status, - word0Remaining, - word1, - word2, - word3 - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), word1); - VERIFY_ARE_EQUAL(ump.Word2(), word2); - VERIFY_ARE_EQUAL(ump.Word3(), word3); -} - -void MidiMessageBuilderTests::TestBuildTypeFStreamMessages2() -{ - LOG_OUTPUT(L"Building Stream Message 2"); - - uint8_t form = 0x3; - uint16_t status = 0x32; - uint16_t word0Remaining = 0xF23F; - uint32_t word1 = 0x86753090; - uint32_t word2 = 0x03263727; - uint32_t word3 = 0x10203040; - - uint32_t resultingWord0 = 0xFC32F23F; // shifting of form to be the two high bits of the nibble changes it from 3 to C - - auto ump = MidiMessageBuilder::BuildStreamMessage( - MidiClock::Now(), - form, - status, - word0Remaining, - word1, - word2, - word3 - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), word1); - VERIFY_ARE_EQUAL(ump.Word2(), word2); - VERIFY_ARE_EQUAL(ump.Word3(), word3); -} - -void MidiMessageBuilderTests::TestBuildMixedDatasetHeaderMessage() -{ - LOG_OUTPUT(L"Building Mixed Dataset Header"); - - uint8_t group{ 0xA }; - uint8_t mdsId{ 0xD }; - uint16_t numberOfValidBytesInChunk{ 0x0099 }; - uint16_t numberOfChunksInDatSet{ 8 }; - uint16_t numberOfThisChunk{ 7 }; - uint16_t manufacturerId{ 0x5150 }; - uint16_t deviceId{ 0x1984 }; - uint16_t subId1{ 0x0326 }; - uint16_t subId2{ 0x3827 }; - - uint32_t resultingWord0 = 0x5A8D0099; - uint32_t resultingWord1 = 0x00080007; - uint32_t resultingWord2 = 0x51501984; - uint32_t resultingWord3 = 0x03263827; - - auto ump = MidiMessageBuilder::BuildMixedDataSetChunkHeaderMessage( - MidiClock::Now(), - MidiGroup(group), - mdsId, - numberOfValidBytesInChunk, - numberOfChunksInDatSet, - numberOfThisChunk, - manufacturerId, - deviceId, - subId1, - subId2 - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), resultingWord1); - VERIFY_ARE_EQUAL(ump.Word2(), resultingWord2); - VERIFY_ARE_EQUAL(ump.Word3(), resultingWord3); -} - -void MidiMessageBuilderTests::TestBuildMixedDatasetPayloadMessage() -{ - LOG_OUTPUT(L"Building Mixed Dataset Payload"); - - uint8_t group{ 0xA }; - uint8_t mdsId{ 0xD }; - - uint32_t resultingWord0 = 0x5A9D0102; - uint32_t resultingWord1 = 0x03040506; - uint32_t resultingWord2 = 0x0708090A; - uint32_t resultingWord3 = 0x0B0C0D0E; - - auto ump = MidiMessageBuilder::BuildMixedDataSetChunkDataMessage( - MidiClock::Now(), - MidiGroup(group), - mdsId, - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E - ); - - // verify values are in the UMP - - VERIFY_ARE_EQUAL(ump.Word0(), resultingWord0); - VERIFY_ARE_EQUAL(ump.Word1(), resultingWord1); - VERIFY_ARE_EQUAL(ump.Word2(), resultingWord2); - VERIFY_ARE_EQUAL(ump.Word3(), resultingWord3); -} - - diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/stdafx.h deleted file mode 100644 index 5f1841945..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/stdafx.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include -#include - -using namespace winrt::Microsoft::Windows::Devices::Midi2; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Messages; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiFunctionBlockMessageBuilderTests.h" -#include "MidiMessageBuilderTests.h" -#include "MidiStreamMessageBuilderTests.h" - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/te.exe.manifest b/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/te.exe.manifest deleted file mode 100644 index e2799e949..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/te.exe.manifest +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2.Sdk.Service.unittests.vcxproj b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2.Sdk.Service.unittests.vcxproj deleted file mode 100644 index e91fbd16f..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2.Sdk.Service.unittests.vcxproj +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - Debug - ARM64 - - - Release - ARM64 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {7814E68E-4123-4C99-8D5C-58CCE7EB334E} - Win32Proj - 10.0 - true - true - true - C++/WinRT - true - true - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - DynamicLibrary - false - v143 - Unicode - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ - $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)..\api\inc;$(WindowsSdkDir)\Testing\Development\inc;$(GeneratedFilesDir) - true - stdcpp17 - Disabled - - - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;$(CoreLibraryDependencies) - - - - - - - - - - - - - - - - - - - - {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} - - - {72d1a831-0492-41cc-aa58-bdd05c1099f7} - - - - - - - - - - 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}. - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2.Sdk.Service.unittests.vcxproj.filters b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2.Sdk.Service.unittests.vcxproj.filters deleted file mode 100644 index 2302afcc3..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2.Sdk.Service.unittests.vcxproj.filters +++ /dev/null @@ -1,45 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Resource Files - - - - - - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2ClientTests.rc deleted file mode 100644 index 5bc1dcb73..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Midi2ClientTests.rc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#include -#include - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "Windows MIDI 2 client tests" -#define VER_INTERNALNAME_STR "Windows MIDI 2 client tests" -#define VER_ORIGINALFILENAME_STR "Midi2.Client.unittests.dll" - -#include diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/MidiServiceTests.cpp b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/MidiServiceTests.cpp deleted file mode 100644 index 5b5e0b6fc..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/MidiServiceTests.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License -// ============================================================================ -// This is part of the Windows MIDI Services App API and should be used -// in your Windows application via an official binary distribution. -// Further information: https://aka.ms/midi -// ============================================================================ - - -#include "stdafx.h" - -void MidiServiceTests::TestEnsureServiceAvailable() -{ - - VERIFY_FAIL(); // TEMP -} diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Module.cpp b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Module.cpp deleted file mode 100644 index 1e154fab7..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/Module.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "stdafx.h" - -MODULE_SETUP(ModuleSetup); -bool ModuleSetup() -{ - winrt::init_apartment(); - return true; -} - diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/packages.config b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/packages.config deleted file mode 100644 index 7b7f4f96c..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/stdafx.h b/src/app-sdk/tests/Midi2.Sdk.Service.unittests/stdafx.h deleted file mode 100644 index 743f6b25d..000000000 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/stdafx.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -#pragma once - -#ifndef STDAFX_H -#define STDAFX_H - -#include - -#include -#include -#include - -#include -#include - -using namespace winrt::Microsoft::Windows::Devices::Midi2; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; - -#include - -#include -#include -#include -#include -#include -#include -#include "loopback_ids.h" -#include "MidiDefs.h" - - -#include "MidiServiceTests.h" - -#ifndef LOG_OUTPUT -#define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) -#endif - -#endif \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Offline.unittests/Midi2ClientTests.rc similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/Midi2ClientTests.rc rename to src/app-sdk/tests/Offline.unittests/Midi2ClientTests.rc diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiChannelTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiChannelTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiChannelTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiChannelTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiChannelTests.h b/src/app-sdk/tests/Offline.unittests/MidiChannelTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiChannelTests.h rename to src/app-sdk/tests/Offline.unittests/MidiChannelTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiClockTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiClockTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiClockTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiClockTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiClockTests.h b/src/app-sdk/tests/Offline.unittests/MidiClockTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiClockTests.h rename to src/app-sdk/tests/Offline.unittests/MidiClockTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiFunctionBlockMessageBuilderTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiFunctionBlockMessageBuilderTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiFunctionBlockMessageBuilderTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiFunctionBlockMessageBuilderTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiFunctionBlockMessageBuilderTests.h b/src/app-sdk/tests/Offline.unittests/MidiFunctionBlockMessageBuilderTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiFunctionBlockMessageBuilderTests.h rename to src/app-sdk/tests/Offline.unittests/MidiFunctionBlockMessageBuilderTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiGroupTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiGroupTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiGroupTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiGroupTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiGroupTests.h b/src/app-sdk/tests/Offline.unittests/MidiGroupTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiGroupTests.h rename to src/app-sdk/tests/Offline.unittests/MidiGroupTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage128Tests.cpp b/src/app-sdk/tests/Offline.unittests/MidiMessage128Tests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage128Tests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiMessage128Tests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage128Tests.h b/src/app-sdk/tests/Offline.unittests/MidiMessage128Tests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage128Tests.h rename to src/app-sdk/tests/Offline.unittests/MidiMessage128Tests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage32Tests.cpp b/src/app-sdk/tests/Offline.unittests/MidiMessage32Tests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage32Tests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiMessage32Tests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage32Tests.h b/src/app-sdk/tests/Offline.unittests/MidiMessage32Tests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage32Tests.h rename to src/app-sdk/tests/Offline.unittests/MidiMessage32Tests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage64Tests.cpp b/src/app-sdk/tests/Offline.unittests/MidiMessage64Tests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage64Tests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiMessage64Tests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage64Tests.h b/src/app-sdk/tests/Offline.unittests/MidiMessage64Tests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage64Tests.h rename to src/app-sdk/tests/Offline.unittests/MidiMessage64Tests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage96Tests.cpp b/src/app-sdk/tests/Offline.unittests/MidiMessage96Tests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage96Tests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiMessage96Tests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage96Tests.h b/src/app-sdk/tests/Offline.unittests/MidiMessage96Tests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/MidiMessage96Tests.h rename to src/app-sdk/tests/Offline.unittests/MidiMessage96Tests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessageBuilderTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiMessageBuilderTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Diagnostics.unittests/MidiMessageBuilderTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiMessageBuilderTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiMessageBuilderTests.h b/src/app-sdk/tests/Offline.unittests/MidiMessageBuilderTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiMessageBuilderTests.h rename to src/app-sdk/tests/Offline.unittests/MidiMessageBuilderTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessagePacketTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiMessagePacketTests.cpp similarity index 98% rename from src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessagePacketTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiMessagePacketTests.cpp index 5f173d62f..e4a9c4ad0 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessagePacketTests.cpp +++ b/src/app-sdk/tests/Offline.unittests/MidiMessagePacketTests.cpp @@ -10,8 +10,6 @@ #include "stdafx.h" -using namespace winrt::Microsoft::Devices::Midi2; - void MidiMessagePacketTests::TestUmp32() { auto mt = MidiMessageType::Midi1ChannelVoice32; diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessagePacketTests.h b/src/app-sdk/tests/Offline.unittests/MidiMessagePacketTests.h similarity index 97% rename from src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessagePacketTests.h rename to src/app-sdk/tests/Offline.unittests/MidiMessagePacketTests.h index 9c8d7c639..3231cd219 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Ble.unittests/MidiMessagePacketTests.h +++ b/src/app-sdk/tests/Offline.unittests/MidiMessagePacketTests.h @@ -9,9 +9,6 @@ #pragma once -using namespace winrt::Microsoft::Devices::Midi2; - - class MidiMessagePacketTests : public WEX::TestClass { diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiStreamMessageBuilderTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiStreamMessageBuilderTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiStreamMessageBuilderTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiStreamMessageBuilderTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiStreamMessageBuilderTests.h b/src/app-sdk/tests/Offline.unittests/MidiStreamMessageBuilderTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Messages.unittests/MidiStreamMessageBuilderTests.h rename to src/app-sdk/tests/Offline.unittests/MidiStreamMessageBuilderTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/MidiUniqueIdTests.cpp b/src/app-sdk/tests/Offline.unittests/MidiUniqueIdTests.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/MidiUniqueIdTests.cpp rename to src/app-sdk/tests/Offline.unittests/MidiUniqueIdTests.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/MidiUniqueIdTests.h b/src/app-sdk/tests/Offline.unittests/MidiUniqueIdTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.CapabilityInquiry.unittests/MidiUniqueIdTests.h rename to src/app-sdk/tests/Offline.unittests/MidiUniqueIdTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Module.cpp b/src/app-sdk/tests/Offline.unittests/Module.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Module.cpp rename to src/app-sdk/tests/Offline.unittests/Module.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2.Sdk.Core.OfflineOnly.unittests.vcxproj b/src/app-sdk/tests/Offline.unittests/Offline.unittests.vcxproj similarity index 82% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2.Sdk.Core.OfflineOnly.unittests.vcxproj rename to src/app-sdk/tests/Offline.unittests/Offline.unittests.vcxproj index 4db1fe3ce..6995a35c8 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Midi2.Sdk.Core.OfflineOnly.unittests.vcxproj +++ b/src/app-sdk/tests/Offline.unittests/Offline.unittests.vcxproj @@ -21,7 +21,7 @@ 17.0 - {F89472AD-0118-4F7E-A0E1-74CFC420E94D} + {BCAE6353-5F32-4AE8-9949-039A2BC2C8C6} Win32Proj 10.0 true @@ -30,7 +30,7 @@ C++/WinRT true true - Midi2.Sdk.Core.OfflineOnly.unittests + Offline.unittests @@ -90,14 +90,14 @@ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)vsfiles\out\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)vsfiles\out\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) @@ -151,21 +151,31 @@ + + + + + + + + + + @@ -173,17 +183,45 @@ - + + {25f09b3a-0d97-4245-8591-262a0dff4320} + + + {38e2cbfd-6c7a-45fb-b162-6bcc1734a0a1} + + + {3d2bc934-cdc7-4dc7-b7fc-f34b755bf726} + {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} true true + + {05796b3c-25ff-4ac2-999b-edefb773393c} + + + {d3b84d5d-8bed-4cb7-b430-b0bf1e46f3a1} + + + {9b93146c-4d9d-4915-becb-5227df2667e2} + + + {0ca9273a-0bae-4ac4-8290-a72a985dd264} + + + {001601de-b7ab-41d1-81b7-40286b139841} + + + {72d1a831-0492-41cc-aa58-bdd05c1099f7} + - + + true + diff --git a/src/app-sdk/tests/Offline.unittests/Offline.unittests.vcxproj.filters b/src/app-sdk/tests/Offline.unittests/Offline.unittests.vcxproj.filters new file mode 100644 index 000000000..3157e0581 --- /dev/null +++ b/src/app-sdk/tests/Offline.unittests/Offline.unittests.vcxproj.filters @@ -0,0 +1,122 @@ + + + + + + + + Source + + + Source + + + Source + + + Support + + + Source\Helpers + + + Source\Helpers + + + Source\Helpers + + + Source\Messages + + + Source\Messages + + + Source\Messages + + + Source\Messages + + + Source + + + Source\Messages + + + + + Headers + + + Headers + + + Headers + + + Support + + + Headers\Helpers + + + Headers\Helpers + + + Headers\Helpers + + + Headers\Messages + + + Headers\Messages + + + Headers\Messages + + + Headers\Messages + + + Headers + + + Headers\Messages + + + + + + + + {c820e5fa-c151-414f-90ec-f35b9481c8c8} + + + {4638c084-db5e-4519-b99c-977a156ef3a6} + + + {c5b7a825-d5f9-473d-a584-9329146b7256} + + + {2b56ac30-8882-4c6a-8665-8a3b2cb18c97} + + + {9ef747ff-0757-45b0-9f17-22d5f0cadbf1} + + + {ddd396b8-ad6f-4eda-9782-2eca164ebe2b} + + + {45b5a992-a7a1-4402-962d-83a16aeef3a7} + + + + + Support + + + + + + \ No newline at end of file diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/packages.config b/src/app-sdk/tests/Offline.unittests/packages.config similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/packages.config rename to src/app-sdk/tests/Offline.unittests/packages.config diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/stdafx.h b/src/app-sdk/tests/Offline.unittests/stdafx.h similarity index 52% rename from src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/stdafx.h rename to src/app-sdk/tests/Offline.unittests/stdafx.h index 6189c065a..23700f0f0 100644 --- a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/stdafx.h +++ b/src/app-sdk/tests/Offline.unittests/stdafx.h @@ -10,17 +10,25 @@ #include #include +#include #include +#include #include #include +#include +#include #include -#include +#include using namespace winrt::Microsoft::Windows::Devices::Midi2; +using namespace winrt::Microsoft::Windows::Devices::Midi2::Initialization; +using namespace winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry; using namespace winrt::Microsoft::Windows::Devices::Midi2::ClientPlugins; using namespace winrt::Microsoft::Windows::Devices::Midi2::Diagnostics; +using namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback; +using namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual; using namespace winrt::Microsoft::Windows::Devices::Midi2::Messages; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; +using namespace winrt::Microsoft::Windows::Devices::Midi2::ServiceConfig; #include @@ -34,7 +42,23 @@ using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; #include "MidiDefs.h" -#include "MidiEndpointListenerTests.h" +#include "MidiClockTests.h" +#include "MidiGroupTests.h" +#include "MidiChannelTests.h" + +#include "MidiUniqueIdTests.h" + +#include "MidiMessage32Tests.h" +#include "MidiMessage64Tests.h" +#include "MidiMessage96Tests.h" +#include "MidiMessage128Tests.h" +#include "MidiMessagePacketTests.h" + +#include "MidiFunctionBlockMessageBuilderTests.h" +#include "MidiMessageBuilderTests.h" +#include "MidiStreamMessageBuilderTests.h" + + #ifndef LOG_OUTPUT #define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) diff --git a/src/app-sdk/tests/Offline.unittests/te.exe.manifest b/src/app-sdk/tests/Offline.unittests/te.exe.manifest new file mode 100644 index 000000000..971ff9b60 --- /dev/null +++ b/src/app-sdk/tests/Offline.unittests/te.exe.manifest @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2ClientTests.rc b/src/app-sdk/tests/Service.integrationtests/Midi2ClientTests.rc similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/Midi2ClientTests.rc rename to src/app-sdk/tests/Service.integrationtests/Midi2ClientTests.rc diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionBufferTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionBufferTests.cpp similarity index 98% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionBufferTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionBufferTests.cpp index 74308f17f..34ccd37f8 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionBufferTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionBufferTests.cpp @@ -21,6 +21,8 @@ void MidiEndpointConnectionBufferTests::TestSendBuffer() { LOG_OUTPUT(L"TestSendBuffer **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -71,6 +73,9 @@ void MidiEndpointConnectionBufferTests::TestSendAndReceiveBuffer() { LOG_OUTPUT(L"TestSendAndReceiveBuffer **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -191,6 +196,8 @@ void MidiEndpointConnectionBufferTests::TestSendBufferBoundsError() { LOG_OUTPUT(L"TestSendBufferBoundsError **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -253,6 +260,9 @@ void MidiEndpointConnectionBufferTests::TestSendAndReceiveMultipleMessagesBuffer { LOG_OUTPUT(L"TestSendAndReceiveMultipleMessagesBuffer **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionBufferTests.h b/src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionBufferTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionBufferTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionBufferTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionTests.cpp similarity index 97% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionTests.cpp index e4b353249..6371345e6 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionTests.cpp @@ -14,6 +14,8 @@ void MidiEndpointConnectionTests::TestSendMessageInvalidConnectionFailureReturnC { LOG_OUTPUT(L"TestSendMessageInvalidConnectionFailureReturnCode **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -42,6 +44,8 @@ void MidiEndpointConnectionTests::TestSendMessageValidationFailureReturnCode() { LOG_OUTPUT(L"TestSendMessageValidationFailureReturnCode **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -122,6 +126,8 @@ void MidiEndpointConnectionTests::TestCreateBiDiLoopbackA() { LOG_OUTPUT(L"TestCreateBiDiLoopbackA **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -148,6 +154,8 @@ void MidiEndpointConnectionTests::TestCreateBiDiLoopbackB() { LOG_OUTPUT(L"TestCreateBiDiLoopbackB **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -172,6 +180,8 @@ void MidiEndpointConnectionTests::TestSendAndReceiveUmpStruct() { LOG_OUTPUT(L"TestSendAndReceiveUmpStruct **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -254,6 +264,8 @@ void MidiEndpointConnectionTests::TestSendAndReceiveUmp32() { LOG_OUTPUT(L"TestSendAndReceiveUmp32 **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -350,6 +362,8 @@ void MidiEndpointConnectionTests::TestSendAndReceiveWords() { LOG_OUTPUT(L"TestSendAndReceiveWords **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -477,6 +491,8 @@ void MidiEndpointConnectionTests::TestSendAndReceiveMultipleMessageWordsList() { LOG_OUTPUT(L"TestSendAndReceiveMultipleMessageWordsList **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -590,6 +606,8 @@ void MidiEndpointConnectionTests::TestSendAndReceiveMultipleMessagePackets() { LOG_OUTPUT(L"TestSendAndReceiveMultipleMessageWordsList **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -711,6 +729,8 @@ void MidiEndpointConnectionTests::TestSendWordArrayBoundsError() { LOG_OUTPUT(L"TestSendWordArrayBoundsError **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + auto session = MidiSession::Create(L"Test Session Name"); VERIFY_IS_TRUE(session.IsOpen()); @@ -745,6 +765,8 @@ void MidiEndpointConnectionTests::TestSendAndReceiveWordArray() { LOG_OUTPUT(L"TestSendAndReceiveWordArray **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionTests.h b/src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointConnectionTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointConnectionTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointCreationThreadTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiEndpointCreationThreadTests.cpp similarity index 98% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointCreationThreadTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointCreationThreadTests.cpp index 3dc9a028b..9c2880939 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointCreationThreadTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiEndpointCreationThreadTests.cpp @@ -88,6 +88,9 @@ void MidiEndpointCreationThreadTests::SendThreadWorker(MidiSession session, winr void MidiEndpointCreationThreadTests::TestCreateNewSessionMultithreaded() { + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + m_receiveComplete.create(); m_receiverReady.create(); diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointCreationThreadTests.h b/src/app-sdk/tests/Service.integrationtests/MidiEndpointCreationThreadTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointCreationThreadTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointCreationThreadTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointDeviceWatcherTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiEndpointDeviceWatcherTests.cpp similarity index 89% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointDeviceWatcherTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointDeviceWatcherTests.cpp index e410f7679..11ea173b1 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointDeviceWatcherTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiEndpointDeviceWatcherTests.cpp @@ -13,10 +13,13 @@ _Use_decl_annotations_ void MidiEndpointDeviceWatcherTests::TestWatcherEnumeration(MidiEndpointDeviceInformationFilters filter, uint32_t numEndpointsExpected) { + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + wil::unique_event_nothrow enumerationCompleted; enumerationCompleted.create(); - auto watcher = MidiEndpointDeviceWatcher::CreateWatcher(filter); + auto watcher = MidiEndpointDeviceWatcher::Create(filter); // we're enumerating only the loopbacks, so that should be 2 endpoints total uint32_t numEndpointsActual{ 0 }; @@ -77,14 +80,14 @@ void MidiEndpointDeviceWatcherTests::TestWatcherEnumeration(MidiEndpointDeviceIn void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationAllDiagnosticsEndpoints() { TestWatcherEnumeration( - MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback | MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing, + MidiEndpointDeviceInformationFilters::DiagnosticLoopback | MidiEndpointDeviceInformationFilters::DiagnosticPing, 3); } void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationPingEndpoint() { TestWatcherEnumeration( - MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing, + MidiEndpointDeviceInformationFilters::DiagnosticPing, 1); } @@ -92,7 +95,7 @@ void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationPingEndpoint() void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationLoopbackEndpoints() { TestWatcherEnumeration( - MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback, + MidiEndpointDeviceInformationFilters::DiagnosticLoopback, 2); } diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointDeviceWatcherTests.h b/src/app-sdk/tests/Service.integrationtests/MidiEndpointDeviceWatcherTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiEndpointDeviceWatcherTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointDeviceWatcherTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/MidiEndpointListenerTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiEndpointListenerTests.cpp similarity index 98% rename from src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/MidiEndpointListenerTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointListenerTests.cpp index f9de56a9f..4d3b358f1 100644 --- a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/MidiEndpointListenerTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiEndpointListenerTests.cpp @@ -14,6 +14,8 @@ void MidiEndpointListenerTests::TestMessageTypeListener() { LOG_OUTPUT(L"TestMessageTypeListener **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -120,6 +122,8 @@ void MidiEndpointListenerTests::TestGroupListener() { LOG_OUTPUT(L"TestGroupListener **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); @@ -237,6 +241,8 @@ void MidiEndpointListenerTests::TestGroupAndChannelListener() { LOG_OUTPUT(L"TestGroupAndChannelListener **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; allMessagesReceived.create(); diff --git a/src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/MidiEndpointListenerTests.h b/src/app-sdk/tests/Service.integrationtests/MidiEndpointListenerTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.ClientPlugins.unittests/MidiEndpointListenerTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiEndpointListenerTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/MidiVirtualDeviceTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiInitializationTests.cpp similarity index 64% rename from src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/MidiVirtualDeviceTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiInitializationTests.cpp index 84c85460c..993b29064 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/MidiVirtualDeviceTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiInitializationTests.cpp @@ -9,12 +9,9 @@ #include "stdafx.h" - -void MidiVirtualDeviceTests::TestVirtualDevice() +void MidiInitializationTests::TestEnsureServiceAvailable() { - LOG_OUTPUT(L"TestVirtualDevice **********************************************************************"); + LOG_OUTPUT(L"TestEnsureServiceAvailable **********************************************************************"); - // TODO: Test virtual device creation + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); } - - diff --git a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/MidiServiceTests.h b/src/app-sdk/tests/Service.integrationtests/MidiInitializationTests.h similarity index 83% rename from src/app-sdk/tests/Midi2.Sdk.Service.unittests/MidiServiceTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiInitializationTests.h index 448f4730d..50417ad9d 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Service.unittests/MidiServiceTests.h +++ b/src/app-sdk/tests/Service.integrationtests/MidiInitializationTests.h @@ -9,14 +9,14 @@ #pragma once -class MidiServiceTests - : public WEX::TestClass +class MidiInitializationTests + : public WEX::TestClass { public: - BEGIN_TEST_CLASS(MidiServiceTests) + BEGIN_TEST_CLASS(MidiInitializationTests) TEST_CLASS_PROPERTY(L"TestClassification", L"Unit") - TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Windows.Devices.Midi2.Service.dll") + TEST_CLASS_PROPERTY(L"BinaryUnderTest", L"Microsoft.Windows.Devices.Midi2.Initialization.dll") END_TEST_CLASS() //TEST_CLASS_SETUP(ClassSetup); diff --git a/src/app-sdk/tests/Service.integrationtests/MidiLoopbackEndpointTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiLoopbackEndpointTests.cpp new file mode 100644 index 000000000..4b88ac4ad --- /dev/null +++ b/src/app-sdk/tests/Service.integrationtests/MidiLoopbackEndpointTests.cpp @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App API and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +#include "stdafx.h" + + +void MidiLoopbackEndpointTests::TestCreateLoopbackEndpoints() +{ + LOG_OUTPUT(L"TestCreateLoopbackEndpoints **********************************************************************"); + + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + winrt::hstring endpointAId{}; + winrt::hstring endpointBId{}; + + MidiLoopbackEndpointDefinition definitionA; + MidiLoopbackEndpointDefinition definitionB; + + auto uniqueId = L"ID" + winrt::to_hstring(MidiClock::Now()); + + // A-side of the loopback + definitionA.Name = L"Test Loopback A"; + definitionA.Description = L"The first description is optional, but is displayed to users. This becomes the transport-defined description."; + definitionA.UniqueId = uniqueId; + + // B-side of the loopback + definitionB.Name = L"Test Loopback B"; + definitionB.Description = L"The second description is optional, but is displayed to users. This becomes the transport-defined description."; + definitionB.UniqueId = uniqueId; // can be the same as the first one, but doesn't need to be. + + winrt::guid associationId = foundation::GuidHelper::CreateNewGuid(); + + LOG_OUTPUT(L"Creating loopback endpoint creation config"); + + MidiLoopbackEndpointCreationConfig creationConfig(associationId, definitionA, definitionB); + + LOG_OUTPUT(L"Creating loopbacks"); + + auto response = MidiLoopbackEndpointManager::CreateTransientLoopbackEndpoints(creationConfig); + + if (response.Success) + { + LOG_OUTPUT(L"Endpoints created successfully"); + + std::cout + << "Loopback Endpoint A: " << std::endl + << " - " << winrt::to_string(definitionA.Name) << std::endl + << " - " << winrt::to_string(response.EndpointDeviceIdA) << std::endl << std::endl; + + std::cout + << "Loopback Endpoint B: " << std::endl + << " - " << winrt::to_string(definitionB.Name) << std::endl + << " - " << winrt::to_string(response.EndpointDeviceIdB) << std::endl << std::endl; + + endpointAId = response.EndpointDeviceIdA; + endpointBId = response.EndpointDeviceIdB; + } + else + { + LOG_OUTPUT(L"Return result indicates failure"); + + // failed to create the loopback pair. It may be that the unique + // Ids are already in use. + + VERIFY_FAIL(); + } + + // TODO: enumerate endpoints and verify that the endpoints are present + + + + +} + diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/MidiLoopbackEndpointTests.h b/src/app-sdk/tests/Service.integrationtests/MidiLoopbackEndpointTests.h similarity index 95% rename from src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/MidiLoopbackEndpointTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiLoopbackEndpointTests.h index 0e8ce0527..b7b2e3025 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Loopback.unittests/MidiLoopbackEndpointTests.h +++ b/src/app-sdk/tests/Service.integrationtests/MidiLoopbackEndpointTests.h @@ -25,7 +25,7 @@ class MidiLoopbackEndpointTests //TEST_METHOD_SETUP(TestSetup); //TEST_METHOD_CLEANUP(TestCleanup); - TEST_METHOD(TestLoopbackEndpoint); + TEST_METHOD(TestCreateLoopbackEndpoints); private: diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiMessageSchedulerTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiMessageSchedulerTests.cpp similarity index 61% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiMessageSchedulerTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiMessageSchedulerTests.cpp index 94d8c1412..b08045cf5 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiMessageSchedulerTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiMessageSchedulerTests.cpp @@ -13,23 +13,29 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTimingSmall() { LOG_OUTPUT(L"Test timing small **********************************************************************"); - TestScheduledMessagesTiming(25); + TestScheduledMessagesTiming(10); } void MidiMessageSchedulerTests::TestScheduledMessagesTimingLarge() { LOG_OUTPUT(L"Test timing large **********************************************************************"); - TestScheduledMessagesTiming(100); + TestScheduledMessagesTiming(200); } +// TODO: The large timing test tends to fail. Sometimes the small does as well. But the delay +// seems likely to be caused by the client / test. Need to investigate. + _Use_decl_annotations_ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messageCount) { LOG_OUTPUT(L"Test timing **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + wil::unique_event_nothrow allMessagesReceived; wil::critical_section messageLock; @@ -46,45 +52,37 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messa // calculate an acceptable timestamp offset - // We'll likely want to do better than this in the future, but 100 microseconds for scheduling isn't bad. - uint32_t acceptableTimestampDeltaMicroseconds = 100; // 0.1ms - - uint64_t acceptableTimestampDeltaTicks = (uint64_t)((acceptableTimestampDeltaMicroseconds * MidiClock::TimestampFrequency()) / 1000000.0); - + uint32_t acceptableAverageTimestampDeltaMicroseconds = 100; // 0.1ms + uint32_t acceptableMaxTimestampDeltaMicroseconds = 1500; // 1.5ms. This is only allowed for a very small % of messages - std::cout << "Acceptable timestamp delta is +/- " << std::dec << acceptableTimestampDeltaTicks << " ticks" << std::endl; + uint64_t acceptableAverageTimestampDeltaTicks = MidiClock::OffsetTimestampByMicroseconds(0, acceptableAverageTimestampDeltaMicroseconds); + uint64_t acceptableMaxTimestampDeltaTicks = MidiClock::OffsetTimestampByMicroseconds(0, acceptableMaxTimestampDeltaMicroseconds); uint32_t scheduledTimeStampOffsetMS = 2000; // time we're scheduling out from send time + uint32_t failureCount{ 0 }; + long long totalDeltaTicks{ 0 }; - auto MessageReceivedHandler = [&](IMidiMessageReceivedEventSource const& sender, MidiMessageReceivedEventArgs const& args) + auto MessageReceivedHandler = [&](IMidiMessageReceivedEventSource const& /*sender*/, MidiMessageReceivedEventArgs const& args) { - // make sure it's one of our messages + auto receivedTimestamp = MidiClock::Now(); + receivedMessageCount++; - try - { - auto receivedTimestamp = MidiClock::Now(); - - UNREFERENCED_PARAMETER(sender); + auto delta = std::abs((long long)(args.Timestamp() - receivedTimestamp)); - //auto lock = messageLock.lock(); - - receivedMessageCount++; - - // verify the timestamp is within an acceptable performance window - VERIFY_IS_GREATER_THAN_OR_EQUAL(receivedTimestamp, args.Timestamp() - acceptableTimestampDeltaTicks); - VERIFY_IS_LESS_THAN_OR_EQUAL(receivedTimestamp, args.Timestamp() + acceptableTimestampDeltaTicks); - - //lock.reset(); - - if (receivedMessageCount == messageCount) - { - allMessagesReceived.SetEvent(); - } + if ((uint64_t)delta > acceptableMaxTimestampDeltaTicks) + { + failureCount++; } - catch (...) + else { - VERIFY_FAIL(); + // we only add the delta when it's not an outlier + totalDeltaTicks += delta; + } + + if (receivedMessageCount == messageCount) + { + allMessagesReceived.SetEvent(); } }; @@ -96,23 +94,22 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messa // send messages - for (uint32_t i = 0; i < messageCount; i++) - { - uint32_t word = word0 + i; - - // std::cout << "Sending: 0x" << std::hex << word << std::endl; + std::thread sendThread([&]() + { + for (uint32_t i = 0; i < messageCount; i++) + { + uint32_t word = word0 + i; + // we increment the message value each time so we can keep track of order as well - // we increment the message value each time so we can keep track of order as well + /*auto sendResult = */connSend.SendSingleMessageWords(MidiClock::OffsetTimestampByMilliseconds(MidiClock::Now(), scheduledTimeStampOffsetMS), word); - auto sendResult = connSend.SendSingleMessageWords(MidiClock::OffsetTimestampByMilliseconds(MidiClock::Now(), scheduledTimeStampOffsetMS), word); + //VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(sendResult)); - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(sendResult)); + Sleep(1); + } + }); - // if we don't sleep here, the send and receive, and the TAEF output, get in the - // way of each other and mess up timing. That's entirely a client-side problem - // and isn't how "normal" apps would work anyway. - Sleep(1); - } + sendThread.detach(); // std::cout << "Waiting for response" << std::endl; @@ -120,15 +117,30 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messa if (!allMessagesReceived.wait(15000)) { std::cout << std::endl << "Failure waiting for messages, timed out." << std::endl; + VERIFY_FAIL(); } //std::cout << "Finished waiting. Unwiring event" << std::endl; connReceive.MessageReceived(eventRevokeToken); + auto averageDeltaTicks = totalDeltaTicks / (receivedMessageCount - failureCount); + + std::cout << std::endl; + std::cout << "Count messages: " << std::dec << messageCount << std::endl; + std::cout << std::endl; + std::cout << "Count exceeding max delta: " << std::dec << failureCount << std::endl; + std::cout << "Acceptable max timestamp delta: +/- " << std::dec << acceptableMaxTimestampDeltaTicks << " ticks" << " (" << MidiClock::ConvertTimestampTicksToMicroseconds(acceptableMaxTimestampDeltaTicks) << " microseconds)" << " (" << MidiClock::ConvertTimestampTicksToMilliseconds(acceptableMaxTimestampDeltaTicks) << " milliseconds)" << std::endl; + std::cout << std::endl; + std::cout << "Average good timing offset: " << std::dec << averageDeltaTicks << " ticks (" << MidiClock::ConvertTimestampTicksToMicroseconds(averageDeltaTicks) << " microseconds)" << " (" << MidiClock::ConvertTimestampTicksToMilliseconds(averageDeltaTicks) << " milliseconds)" << std::endl; + std::cout << "Acceptable average delta: +/- " << std::dec << acceptableAverageTimestampDeltaTicks << " ticks" << " (" << MidiClock::ConvertTimestampTicksToMicroseconds(acceptableAverageTimestampDeltaTicks) << " microseconds)" << " (" << MidiClock::ConvertTimestampTicksToMilliseconds(acceptableAverageTimestampDeltaTicks) << " milliseconds)" << std::endl; + std::cout << std::endl; + + VERIFY_ARE_EQUAL(receivedMessageCount, messageCount); + VERIFY_IS_LESS_THAN_OR_EQUAL(failureCount, (uint32_t)(receivedMessageCount *.03)); // allow up to 3% of messages to be out due to system burps + VERIFY_IS_LESS_THAN_OR_EQUAL((uint32_t)averageDeltaTicks, acceptableAverageTimestampDeltaTicks); // require that the average is within the range - //std::cout << "Disconnecting endpoints" << std::endl; // cleanup endpoint. Technically not required as session will do it session.DisconnectEndpointConnection(connSend.ConnectionId()); @@ -143,6 +155,8 @@ void MidiMessageSchedulerTests::TestScheduledMessagesOrder() { LOG_OUTPUT(L"TestScheduledMessages **********************************************************************"); + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + wil::unique_event_nothrow allMessagesReceived; wil::critical_section messageLock; diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiMessageSchedulerTests.h b/src/app-sdk/tests/Service.integrationtests/MidiMessageSchedulerTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiMessageSchedulerTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiMessageSchedulerTests.h diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiSessionTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiSessionTests.cpp similarity index 92% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiSessionTests.cpp rename to src/app-sdk/tests/Service.integrationtests/MidiSessionTests.cpp index c1569bd1a..f014e838a 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiSessionTests.cpp +++ b/src/app-sdk/tests/Service.integrationtests/MidiSessionTests.cpp @@ -11,6 +11,8 @@ void MidiSessionTests::TestCreateNewSession() { + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + winrt::hstring sessionName = L"Test Session Name"; auto session = MidiSession::Create(sessionName); @@ -28,6 +30,8 @@ void MidiSessionTests::TestCreateNewSession() void MidiSessionTests::TestSessionList() { + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + winrt::hstring session1Name = L"Session 1 Name"; winrt::hstring session2Name = L"Session 2 Name"; @@ -62,6 +66,8 @@ void MidiSessionTests::TestSessionList() void MidiSessionTests::TestUpdateSessionName() { + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + winrt::hstring oldSessionName = L"Test Session Name"; winrt::hstring newSessionName = L"New Session Name"; diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiSessionTests.h b/src/app-sdk/tests/Service.integrationtests/MidiSessionTests.h similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/MidiSessionTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiSessionTests.h diff --git a/src/app-sdk/tests/Service.integrationtests/MidiVirtualDeviceTests.cpp b/src/app-sdk/tests/Service.integrationtests/MidiVirtualDeviceTests.cpp new file mode 100644 index 000000000..01d75ec5f --- /dev/null +++ b/src/app-sdk/tests/Service.integrationtests/MidiVirtualDeviceTests.cpp @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License +// ============================================================================ +// This is part of the Windows MIDI Services App API and should be used +// in your Windows application via an official binary distribution. +// Further information: https://aka.ms/midi +// ============================================================================ + + +#include "stdafx.h" + + +void MidiVirtualDeviceTests::TestCreateVirtualDevice() +{ + LOG_OUTPUT(L"TestCreateVirtualDevice **********************************************************************"); + + VERIFY_IS_TRUE(MidiServicesInitializer::EnsureServiceAvailable()); + + + winrt::hstring endpointSuppliedName = L"Endpoint From Test"; + + winrt::hstring userSuppliedName = L"User Supplied Endpoint From Test"; + winrt::hstring userSuppliedDescription = L"This is the user-supplied description"; + + winrt::hstring transportSuppliedName = L"Transport Supplied Endpoint From Test"; + winrt::hstring transportSuppliedDescription = L"This is the transport-supplied description"; + winrt::hstring transportSuppliedManufacturerName = L"Manufacturer Name"; + + + // endpoint information returned from endpoint discovery + MidiDeclaredEndpointInfo declaredEndpointInfo{ }; + declaredEndpointInfo.Name = endpointSuppliedName; + declaredEndpointInfo.ProductInstanceId = L"TAEF_TEST_3263827"; // must be unique + declaredEndpointInfo.SpecificationVersionMajor = 1; // see latest MIDI 2 UMP spec + declaredEndpointInfo.SpecificationVersionMinor = 1; // see latest MIDI 2 UMP spec + declaredEndpointInfo.SupportsMidi10Protocol = true; + declaredEndpointInfo.SupportsMidi20Protocol = true; + declaredEndpointInfo.SupportsReceivingJitterReductionTimestamps = false; + declaredEndpointInfo.SupportsSendingJitterReductionTimestamps = false; + declaredEndpointInfo.HasStaticFunctionBlocks = true; + + MidiDeclaredDeviceIdentity declaredDeviceIdentity{ }; + // todo: set any device identity values if you want. This is optional + + MidiEndpointUserSuppliedInfo userSuppliedInfo{ }; + userSuppliedInfo.Name = userSuppliedName; // for names, this will bubble to the top in priority + userSuppliedInfo.Description = userSuppliedDescription; + + // create the config type to aggregate all this info + MidiVirtualDeviceCreationConfig config( + transportSuppliedName, // this could be a different "transport-supplied" name value here + transportSuppliedDescription, // transport-supplied description + transportSuppliedManufacturerName, // transport-supplied company name + declaredEndpointInfo, // for endpoint discovery + declaredDeviceIdentity, // for endpoint discovery + userSuppliedInfo + ); + + // Function blocks.The MIDI 2 UMP specification covers the meanings of these values + MidiFunctionBlock block1{ }; + block1.Number(0); + block1.Name(L"Test Output"); + block1.IsActive(true); + block1.UIHint(MidiFunctionBlockUIHint::Sender); + block1.FirstGroupIndex(0); + block1.GroupCount(1); + block1.Direction(MidiFunctionBlockDirection::Bidirectional); + block1.RepresentsMidi10Connection(MidiFunctionBlockRepresentsMidi10Connection::Not10); + block1.MaxSystemExclusive8Streams(0); + block1.MidiCIMessageVersionFormat(0); + + config.FunctionBlocks().Append(block1); + + MidiFunctionBlock block2{ }; + block2.Number(1); + block2.Name(L"A Test Function Block"); + block2.IsActive(true); + block2.UIHint(MidiFunctionBlockUIHint::Sender); + block2.FirstGroupIndex(1); + block2.GroupCount(2); + block2.Direction(MidiFunctionBlockDirection::Bidirectional); + block2.RepresentsMidi10Connection(MidiFunctionBlockRepresentsMidi10Connection::Not10); + block2.MaxSystemExclusive8Streams(0); + block2.MidiCIMessageVersionFormat(0); + + config.FunctionBlocks().Append(block2); + + + + // create the session. The name here is just convenience. + auto session = MidiSession::Create(config.Name()); + VERIFY_IS_NOT_NULL(session); + + // create the virtual device, so we can get the endpoint device id to connect to + auto virtualDevice = MidiVirtualDeviceManager::CreateVirtualDevice(config); + VERIFY_IS_NOT_NULL(virtualDevice); + VERIFY_IS_FALSE(virtualDevice.DeviceEndpointDeviceId().empty()); + LOG_OUTPUT(L"Created virtual device"); + LOG_OUTPUT(virtualDevice.DeviceEndpointDeviceId().c_str()); + + + // create the endpoint connection to the device-side endpoint + // to prevent confusion, this endpoint is not enumerated to + // apps when using the standard set of enumeration filters + auto connection = session.CreateEndpointConnection(virtualDevice.DeviceEndpointDeviceId()); + VERIFY_IS_NOT_NULL(connection); + + LOG_OUTPUT(L"Checking device properties"); + auto info = MidiEndpointDeviceInformation::CreateFromEndpointDeviceId(virtualDevice.DeviceEndpointDeviceId()); + VERIFY_IS_NOT_NULL(info); + + LOG_OUTPUT(info.Name().c_str()); + LOG_OUTPUT(info.EndpointDeviceId().c_str()); + + + // add the virtual device as a message processing plugin so it receives the messages + connection.AddMessageProcessingPlugin(virtualDevice); + + // wire up the stream configuration request received handler + //auto streamEventToken = virtualDevice.StreamConfigRequestReceived( + // { this, &MidiVirtualDeviceTests::OnStreamConfigurationRequestReceived }); + + //// wire up the message received handler on the connection itself + //auto messageEventToken = connection.MessageReceived( + // { this, &MidiVirtualDeviceTests::OnMidiMessageReceived }); + + // the client-side endpoint will become visible to other apps once Open() completes + VERIFY_IS_TRUE(connection.Open()); + + + +} + + diff --git a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/MidiVirtualDeviceTests.h b/src/app-sdk/tests/Service.integrationtests/MidiVirtualDeviceTests.h similarity index 95% rename from src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/MidiVirtualDeviceTests.h rename to src/app-sdk/tests/Service.integrationtests/MidiVirtualDeviceTests.h index 5f6dbb693..57ee692dc 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Endpoint.Virtual.unittests/MidiVirtualDeviceTests.h +++ b/src/app-sdk/tests/Service.integrationtests/MidiVirtualDeviceTests.h @@ -25,7 +25,7 @@ class MidiVirtualDeviceTests //TEST_METHOD_SETUP(TestSetup); //TEST_METHOD_CLEANUP(TestCleanup); - TEST_METHOD(TestVirtualDevice); + TEST_METHOD(TestCreateVirtualDevice); private: diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Module.cpp b/src/app-sdk/tests/Service.integrationtests/Module.cpp similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/Module.cpp rename to src/app-sdk/tests/Service.integrationtests/Module.cpp diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2.Sdk.Core.unittests.vcxproj b/src/app-sdk/tests/Service.integrationtests/Service.integrationtests.vcxproj similarity index 83% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2.Sdk.Core.unittests.vcxproj rename to src/app-sdk/tests/Service.integrationtests/Service.integrationtests.vcxproj index 06a5815a3..29846fe8b 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2.Sdk.Core.unittests.vcxproj +++ b/src/app-sdk/tests/Service.integrationtests/Service.integrationtests.vcxproj @@ -21,7 +21,7 @@ 17.0 - {14F12F86-9BDE-4DA3-B295-7FD990080E57} + {63FDB29C-5638-427B-86BF-05B318480571} Win32Proj 10.0 true @@ -30,7 +30,7 @@ C++/WinRT true true - Midi2.Sdk.Core.unittests + Service.integrationtests @@ -90,14 +90,14 @@ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)vsfiles\out\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\test\miditestcommon\$(Platform)\$(Configuration); - $(SolutionDir)vsfiles\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)vsfiles\out\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)vsfiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) @@ -153,8 +153,12 @@ + + + + @@ -162,8 +166,12 @@ + + + + @@ -171,9 +179,23 @@ - + + {25f09b3a-0d97-4245-8591-262a0dff4320} + true + true + + + {38e2cbfd-6c7a-45fb-b162-6bcc1734a0a1} + true + true + + + {3d2bc934-cdc7-4dc7-b7fc-f34b755bf726} + true + true + {9eaa3af3-7328-4f67-a011-e2dd8fbaa4c4} true @@ -184,13 +206,30 @@ true true + + {d3b84d5d-8bed-4cb7-b430-b0bf1e46f3a1} + true + true + + + {9b93146c-4d9d-4915-becb-5227df2667e2} + true + true + + + {0ca9273a-0bae-4ac4-8290-a72a985dd264} + true + true + {001601de-b7ab-41d1-81b7-40286b139841} true true - + {72d1a831-0492-41cc-aa58-bdd05c1099f7} + true + true diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2.Sdk.Core.unittests.vcxproj.filters b/src/app-sdk/tests/Service.integrationtests/Service.integrationtests.vcxproj.filters similarity index 51% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2.Sdk.Core.unittests.vcxproj.filters rename to src/app-sdk/tests/Service.integrationtests/Service.integrationtests.vcxproj.filters index 918cbed5d..c021d20f2 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/Midi2.Sdk.Core.unittests.vcxproj.filters +++ b/src/app-sdk/tests/Service.integrationtests/Service.integrationtests.vcxproj.filters @@ -1,76 +1,96 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + + + + {e1c991ae-4355-4c49-acde-242d0ae28638} - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd + + {00ce2739-d0b9-4957-b5e2-f355369fa098} - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + {6a1da353-e4dc-41c9-8d67-9a38a5573360} - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files + Support + + + Headers - Header Files + Headers - - Header Files + + Headers - Header Files + Headers + + + Headers + + + Headers - Header Files + Headers - - Header Files + + Headers - - Header Files + + Headers + + + Headers - - Resource Files - - - - - + + Support + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + + + Source + - + + Support + diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/packages.config b/src/app-sdk/tests/Service.integrationtests/packages.config similarity index 100% rename from src/app-sdk/tests/Midi2.Sdk.Core.OfflineOnly.unittests/packages.config rename to src/app-sdk/tests/Service.integrationtests/packages.config diff --git a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/stdafx.h b/src/app-sdk/tests/Service.integrationtests/stdafx.h similarity index 55% rename from src/app-sdk/tests/Midi2.Sdk.Core.unittests/stdafx.h rename to src/app-sdk/tests/Service.integrationtests/stdafx.h index 55e24e70e..2c60c1ad7 100644 --- a/src/app-sdk/tests/Midi2.Sdk.Core.unittests/stdafx.h +++ b/src/app-sdk/tests/Service.integrationtests/stdafx.h @@ -10,15 +10,28 @@ #include #include +namespace foundation = winrt::Windows::Foundation; +namespace collections = winrt::Windows::Foundation::Collections; + +#include #include +#include +#include #include +#include +#include #include -#include +#include using namespace winrt::Microsoft::Windows::Devices::Midi2; +using namespace winrt::Microsoft::Windows::Devices::Midi2::Initialization; +using namespace winrt::Microsoft::Windows::Devices::Midi2::CapabilityInquiry; +using namespace winrt::Microsoft::Windows::Devices::Midi2::ClientPlugins; using namespace winrt::Microsoft::Windows::Devices::Midi2::Diagnostics; +using namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback; +using namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual; using namespace winrt::Microsoft::Windows::Devices::Midi2::Messages; -using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; +using namespace winrt::Microsoft::Windows::Devices::Midi2::ServiceConfig; #include @@ -36,8 +49,14 @@ using namespace winrt::Microsoft::Windows::Devices::Midi2::Service; #include "MidiEndpointConnectionTests.h" #include "MidiEndpointCreationThreadTests.h" #include "MidiEndpointDeviceWatcherTests.h" +#include "MidiEndpointListenerTests.h" +#include "MidiLoopbackEndpointTests.h" #include "MidiMessageSchedulerTests.h" +#include "MidiInitializationTests.h" #include "MidiSessionTests.h" +#include "MidiVirtualDeviceTests.h" + + #ifndef LOG_OUTPUT #define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) diff --git a/src/app-sdk/tests/Service.integrationtests/te.exe.manifest b/src/app-sdk/tests/Service.integrationtests/te.exe.manifest new file mode 100644 index 000000000..971ff9b60 --- /dev/null +++ b/src/app-sdk/tests/Service.integrationtests/te.exe.manifest @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app-sdk/winrt-core/MidiEndpointConnection_Receive.cpp b/src/app-sdk/winrt-core/MidiEndpointConnection_Receive.cpp index 15f776103..24a223709 100644 --- a/src/app-sdk/winrt-core/MidiEndpointConnection_Receive.cpp +++ b/src/app-sdk/winrt-core/MidiEndpointConnection_Receive.cpp @@ -13,8 +13,29 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - HRESULT MidiEndpointConnection::Callback(PVOID data, UINT size, LONGLONG timestamp, LONGLONG) + HRESULT MidiEndpointConnection::Callback(PVOID data, UINT size, LONGLONG timestamp, LONGLONG context) { + UNREFERENCED_PARAMETER(context); + + if ((!m_messageReceivedEvent) && (!m_messageProcessingPlugins || m_messageProcessingPlugins.Size() == 0)) + { +#ifdef _DEBUG + TraceLoggingWrite( + Midi2SdkTelemetryProvider::Provider(), + MIDI_SDK_TRACE_EVENT_INFO, + TraceLoggingString(__FUNCTION__, MIDI_SDK_TRACE_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, MIDI_SDK_TRACE_THIS_FIELD), + TraceLoggingWideString(L"Exiting quickly due to no listeners", MIDI_SDK_TRACE_MESSAGE_FIELD), + TraceLoggingWideString(m_endpointDeviceId.c_str(), MIDI_SDK_TRACE_ENDPOINT_DEVICE_ID_FIELD), + TraceLoggingGuid(m_connectionId, MIDI_SDK_TRACE_CONNECTION_ID_FIELD) + ); +#endif + + // fast exit if there's nothing listening + return S_OK; + } + #ifdef _DEBUG // performance-critical function, so only trace when in a debug build TraceLoggingWrite( @@ -83,7 +104,6 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::implementation } catch (winrt::hresult_error const& ex) { - //internal::LogHresultError(__FUNCTION__, L"hresult exception activating stream. Service may be unavailable", ex, m_endpointDeviceId); LOG_IF_FAILED(static_cast(ex.code())); // this also generates a fallback error with file and line number info TraceLoggingWrite( @@ -92,7 +112,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::implementation TraceLoggingString(__FUNCTION__, MIDI_SDK_TRACE_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, MIDI_SDK_TRACE_THIS_FIELD), - TraceLoggingWideString(L"hresult exception activating stream. Service may be unavailable", MIDI_SDK_TRACE_MESSAGE_FIELD), + TraceLoggingWideString(L"hresult exception handling received message", MIDI_SDK_TRACE_MESSAGE_FIELD), TraceLoggingWideString(m_endpointDeviceId.c_str(), MIDI_SDK_TRACE_ENDPOINT_DEVICE_ID_FIELD), TraceLoggingHResult(static_cast(ex.code()), MIDI_SDK_TRACE_HRESULT_FIELD), TraceLoggingWideString(ex.message().c_str(), MIDI_SDK_TRACE_ERROR_FIELD) @@ -110,7 +130,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::implementation TraceLoggingString(__FUNCTION__, MIDI_SDK_TRACE_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, MIDI_SDK_TRACE_THIS_FIELD), - TraceLoggingWideString(L"Exception handling received messages.", MIDI_SDK_TRACE_MESSAGE_FIELD), + TraceLoggingWideString(L"std::exception handling received message", MIDI_SDK_TRACE_MESSAGE_FIELD), TraceLoggingWideString(m_endpointDeviceId.c_str(), MIDI_SDK_TRACE_ENDPOINT_DEVICE_ID_FIELD), TraceLoggingString(ex.what(), MIDI_SDK_TRACE_ERROR_FIELD) ); @@ -127,7 +147,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::implementation TraceLoggingString(__FUNCTION__, MIDI_SDK_TRACE_LOCATION_FIELD), TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, MIDI_SDK_TRACE_THIS_FIELD), - TraceLoggingWideString(L"Exception handling received message", MIDI_SDK_TRACE_MESSAGE_FIELD), + TraceLoggingWideString(L"General exception handling received message", MIDI_SDK_TRACE_MESSAGE_FIELD), TraceLoggingWideString(m_endpointDeviceId.c_str(), MIDI_SDK_TRACE_ENDPOINT_DEVICE_ID_FIELD) ); diff --git a/src/app-sdk/winrt-core/MidiEndpointConnection_SendMultipleMessages.cpp b/src/app-sdk/winrt-core/MidiEndpointConnection_SendMultipleMessages.cpp index 32348be27..d089ac6e2 100644 --- a/src/app-sdk/winrt-core/MidiEndpointConnection_SendMultipleMessages.cpp +++ b/src/app-sdk/winrt-core/MidiEndpointConnection_SendMultipleMessages.cpp @@ -88,7 +88,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::implementation while (true) { - uint8_t bytesInThisMessage = internal::GetUmpLengthInBytesFromFirstWord((uint32_t&)byteDataPointer); + uint8_t bytesInThisMessage = internal::GetUmpLengthInBytesFromFirstWord(*(uint32_t*)byteDataPointer); if (bytesProcessed + bytesInThisMessage <= byteCount) { diff --git a/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj b/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj index 066bd5a19..9148d73b2 100644 --- a/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj +++ b/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj @@ -260,8 +260,8 @@ - - MidiLoopbackEndpointDeletionConfig.idl + + MidiLoopbackEndpointRemovalConfig.idl MidiLoopbackEndpointManager.idl @@ -273,8 +273,8 @@ - - MidiLoopbackEndpointDeletionConfig.idl + + MidiLoopbackEndpointRemovalConfig.idl MidiLoopbackEndpointManager.idl @@ -287,7 +287,7 @@ - + diff --git a/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj.filters b/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj.filters index 1751adf66..7a82daa80 100644 --- a/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj.filters +++ b/src/app-sdk/winrt-endpoint-loopback/Microsoft.Windows.Devices.Midi2.Endpoints.Loopback.vcxproj.filters @@ -20,7 +20,7 @@ SDK\Configuration - + SDK\Configuration diff --git a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.cpp b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.cpp index 769ac136d..2375f6a76 100644 --- a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.cpp +++ b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.cpp @@ -16,7 +16,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implem bool MidiLoopbackEndpointManager::IsTransportAvailable() noexcept { // TODO: Check to see if service abstraction is installed and running. May require a new service call - return false; + return true; } @@ -65,6 +65,16 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implem else { //internal::LogGeneralError(__FUNCTION__, L"Device creation failed (payload has false success value)"); + + TraceLoggingWrite( + Midi2SdkTelemetryProvider::Provider(), + MIDI_SDK_TRACE_EVENT_ERROR, + TraceLoggingString(__FUNCTION__, MIDI_SDK_TRACE_LOCATION_FIELD), + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(MIDI_SDK_STATIC_THIS_PLACEHOLDER_FIELD_VALUE, MIDI_SDK_TRACE_THIS_FIELD), + TraceLoggingWideString(L"Device creation failed (payload has false success value)", MIDI_SDK_TRACE_MESSAGE_FIELD), + TraceLoggingGuid(creationConfig.AssociationId(), "association id") + ); } } else @@ -77,18 +87,18 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implem _Use_decl_annotations_ bool MidiLoopbackEndpointManager::RemoveTransientLoopbackEndpoints( - loop::MidiLoopbackEndpointDeletionConfig deletionConfig) + loop::MidiLoopbackEndpointRemovalConfig removalConfig) { // the success code in this defaults to False bool result = false; json::JsonObject configObject; - if (json::JsonObject::TryParse(deletionConfig.GetConfigJson(), configObject)) + if (json::JsonObject::TryParse(removalConfig.GetConfigJson(), configObject)) { // send it up - auto serviceResponse = svc::MidiServiceConfig::UpdateTransportPluginConfig(deletionConfig); + auto serviceResponse = svc::MidiServiceConfig::UpdateTransportPluginConfig(removalConfig); result = (serviceResponse.Status == svc::MidiServiceConfigResponseStatus::Success); } diff --git a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.h b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.h index 7c433fac9..ce5fbf25b 100644 --- a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.h +++ b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.h @@ -24,7 +24,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implem _In_ loop::MidiLoopbackEndpointCreationConfig creationConfig); static bool RemoveTransientLoopbackEndpoints( - _In_ loop::MidiLoopbackEndpointDeletionConfig deletionConfig); + _In_ loop::MidiLoopbackEndpointRemovalConfig deletionConfig); }; } namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::factory_implementation diff --git a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.idl b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.idl index 2e1416c1a..bb9e1c273 100644 --- a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.idl +++ b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointManager.idl @@ -9,7 +9,7 @@ import "MidiLoopbackEndpointCreationResult.idl"; import "MidiLoopbackEndpointCreationConfig.idl"; -import "MidiLoopbackEndpointDeletionConfig.idl"; +import "MidiLoopbackEndpointRemovalConfig.idl"; namespace Microsoft.Windows.Devices.Midi2.Endpoints.Loopback { @@ -24,7 +24,7 @@ namespace Microsoft.Windows.Devices.Midi2.Endpoints.Loopback MidiLoopbackEndpointCreationConfig creationConfig); static Boolean RemoveTransientLoopbackEndpoints( - MidiLoopbackEndpointDeletionConfig deletionConfig); + MidiLoopbackEndpointRemovalConfig removalConfig); } } diff --git a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.cpp b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.cpp similarity index 87% rename from src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.cpp rename to src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.cpp index b89057031..fe7a5f132 100644 --- a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.cpp +++ b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.cpp @@ -8,13 +8,13 @@ #include "pch.h" -#include "MidiLoopbackEndpointDeletionConfig.h" -#include "MidiLoopbackEndpointDeletionConfig.g.cpp" +#include "MidiLoopbackEndpointRemovalConfig.h" +#include "MidiLoopbackEndpointRemovalConfig.g.cpp" namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implementation { _Use_decl_annotations_ - MidiLoopbackEndpointDeletionConfig::MidiLoopbackEndpointDeletionConfig(winrt::guid const& associationId) + MidiLoopbackEndpointRemovalConfig::MidiLoopbackEndpointRemovalConfig(winrt::guid const& associationId) { m_associationId = associationId; } @@ -29,7 +29,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implem // } // } // } - winrt::hstring MidiLoopbackEndpointDeletionConfig::GetConfigJson() + winrt::hstring MidiLoopbackEndpointRemovalConfig::GetConfigJson() { json::JsonArray endpointDeletionArray; json::JsonObject abstractionObject; diff --git a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.h b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.h similarity index 68% rename from src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.h rename to src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.h index e1448755e..d05d25de7 100644 --- a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.h +++ b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.h @@ -8,14 +8,14 @@ #pragma once -#include "MidiLoopbackEndpointDeletionConfig.g.h" +#include "MidiLoopbackEndpointRemovalConfig.g.h" namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implementation { - struct MidiLoopbackEndpointDeletionConfig : MidiLoopbackEndpointDeletionConfigT + struct MidiLoopbackEndpointRemovalConfig : MidiLoopbackEndpointRemovalConfigT { - MidiLoopbackEndpointDeletionConfig() = default; - MidiLoopbackEndpointDeletionConfig(_In_ winrt::guid const& associationId); + MidiLoopbackEndpointRemovalConfig() = default; + MidiLoopbackEndpointRemovalConfig(_In_ winrt::guid const& associationId); winrt::guid TransportId() { return loop::MidiLoopbackEndpointManager::AbstractionId(); } bool IsFromCurrentConfigFile() { return false; } @@ -31,7 +31,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::implem } namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Loopback::factory_implementation { - struct MidiLoopbackEndpointDeletionConfig : MidiLoopbackEndpointDeletionConfigT + struct MidiLoopbackEndpointRemovalConfig : MidiLoopbackEndpointRemovalConfigT { }; } diff --git a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.idl b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.idl similarity index 75% rename from src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.idl rename to src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.idl index 364dc56df..821cb2a1a 100644 --- a/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointDeletionConfig.idl +++ b/src/app-sdk/winrt-endpoint-loopback/MidiLoopbackEndpointRemovalConfig.idl @@ -12,9 +12,9 @@ import "MidiLoopbackEndpointDefinition.idl"; namespace Microsoft.Windows.Devices.Midi2.Endpoints.Loopback { [default_interface] - runtimeclass MidiLoopbackEndpointDeletionConfig : Microsoft.Windows.Devices.Midi2.ServiceConfig.IMidiServiceTransportPluginConfig + runtimeclass MidiLoopbackEndpointRemovalConfig : Microsoft.Windows.Devices.Midi2.ServiceConfig.IMidiServiceTransportPluginConfig { - MidiLoopbackEndpointDeletionConfig(Guid associationId); + MidiLoopbackEndpointRemovalConfig(Guid associationId); Guid AssociationId; } diff --git a/src/app-sdk/winrt-endpoint-loopback/pch.h b/src/app-sdk/winrt-endpoint-loopback/pch.h index 826ec9d43..e1f443f9a 100644 --- a/src/app-sdk/winrt-endpoint-loopback/pch.h +++ b/src/app-sdk/winrt-endpoint-loopback/pch.h @@ -105,5 +105,6 @@ namespace implementation = ::winrt::Microsoft::Windows::Devices::Midi2::Endpoint //#include "resource.h" #include "MidiLoopbackEndpointCreationConfig.h" +#include "MidiLoopbackEndpointRemovalConfig.h" #include "MidiLoopbackEndpointManager.h" diff --git a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDevice.cpp b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDevice.cpp index 3da64b9c9..20cc05fc5 100644 --- a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDevice.cpp +++ b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDevice.cpp @@ -26,7 +26,6 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual::impleme m_declaredDeviceIdentity = config.DeclaredDeviceIdentity(); m_declaredEndpointInfo = config.DeclaredEndpointInfo(); - m_name = L"Virtual: " + m_declaredEndpointInfo.Name; m_id = winrt::Windows::Foundation::GuidHelper::CreateNewGuid(); diff --git a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceCreationConfig.idl b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceCreationConfig.idl index dd8670863..7701d1d94 100644 --- a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceCreationConfig.idl +++ b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceCreationConfig.idl @@ -48,7 +48,6 @@ namespace Microsoft.Windows.Devices.Midi2.Endpoints.Virtual Guid AssociationId{ get; }; - Microsoft.Windows.Devices.Midi2.MidiDeclaredDeviceIdentity DeclaredDeviceIdentity; Microsoft.Windows.Devices.Midi2.MidiDeclaredEndpointInfo DeclaredEndpointInfo; Microsoft.Windows.Devices.Midi2.MidiEndpointUserSuppliedInfo UserSuppliedInfo; diff --git a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.cpp b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.cpp index f0689202a..c0b9d6407 100644 --- a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.cpp +++ b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.cpp @@ -68,6 +68,10 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual::impleme return *device; } } + else + { + // couldn't parse the json + } } else { diff --git a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.h b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.h index b69f89e77..a9e548d48 100644 --- a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.h +++ b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.h @@ -21,6 +21,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual::impleme static const winrt::guid AbstractionId() noexcept { return internal::StringToGuid(L"{8FEAAD91-70E1-4A19-997A-377720A719C1}"); } static virt::MidiVirtualDevice CreateVirtualDevice(_In_ virt::MidiVirtualDeviceCreationConfig creationConfig) noexcept; + //static bool RemoveVirtualDevice(_In_ virt::MidiVirtualDeviceRemovalConfig removalConfig) noexcept; }; } namespace winrt::Microsoft::Windows::Devices::Midi2::Endpoints::Virtual::factory_implementation diff --git a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.idl b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.idl index 2b1c8879e..dc7bbb286 100644 --- a/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.idl +++ b/src/app-sdk/winrt-endpoint-virtual/MidiVirtualDeviceManager.idl @@ -22,7 +22,7 @@ namespace Microsoft.Windows.Devices.Midi2.Endpoints.Virtual static MidiVirtualDevice CreateVirtualDevice( MidiVirtualDeviceCreationConfig creationConfig); - //static Boolean RemoveTransientLoopbackEndpoints( - // MidiLoopbackEndpointDeletionConfiguration deletionConfiguration); + //static Boolean RemoveVirtualDevice( + // MidiVirtualDeviceRemovalConfig removalConfig); } } \ No newline at end of file diff --git a/src/app-sdk/winrt-service-config/MidiServiceConfig.cpp b/src/app-sdk/winrt-service-config/MidiServiceConfig.cpp index 36953fee0..1f5031696 100644 --- a/src/app-sdk/winrt-service-config/MidiServiceConfig.cpp +++ b/src/app-sdk/winrt-service-config/MidiServiceConfig.cpp @@ -84,6 +84,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::ServiceConfig::implementati TraceLoggingWideString(L"Failed to initialize config manager", MIDI_SDK_TRACE_MESSAGE_FIELD), TraceLoggingHResult(initializeResult, MIDI_SDK_TRACE_HRESULT_FIELD) ); + // return a fail result return response; } @@ -234,6 +235,7 @@ namespace winrt::Microsoft::Windows::Devices::Midi2::ServiceConfig::implementati if (success) { response.Status = svc::MidiServiceConfigResponseStatus::Success; + response.ResponseJson = responseJsonObject.Stringify(); return response; } diff --git a/src/oob-setup/api-package/WindowsMidiServices.wxs b/src/oob-setup/api-package/WindowsMidiServices.wxs index b5e55637a..e6a392b26 100644 --- a/src/oob-setup/api-package/WindowsMidiServices.wxs +++ b/src/oob-setup/api-package/WindowsMidiServices.wxs @@ -49,9 +49,9 @@ Directory="SERVICE_INSTALLFOLDER" Guid="76dbd487-7646-4c4b-a5c7-fde28a2102c7" > - + @@ -108,10 +108,6 @@ - - - - @@ -144,6 +140,7 @@ + diff --git a/src/shared/api-ref/Arm64EC/WindowsMidiServices.h b/src/shared/api-ref/Arm64EC/WindowsMidiServices.h index be6986afb..e77a32c06 100644 --- a/src/shared/api-ref/Arm64EC/WindowsMidiServices.h +++ b/src/shared/api-ref/Arm64EC/WindowsMidiServices.h @@ -157,6 +157,13 @@ typedef interface IMidiSessionTracker IMidiSessionTracker; #endif /* __IMidiSessionTracker_FWD_DEFINED__ */ +#ifndef __IMidiProtocolNegotiationCompleteCallback_FWD_DEFINED__ +#define __IMidiProtocolNegotiationCompleteCallback_FWD_DEFINED__ +typedef interface IMidiProtocolNegotiationCompleteCallback IMidiProtocolNegotiationCompleteCallback; + +#endif /* __IMidiProtocolNegotiationCompleteCallback_FWD_DEFINED__ */ + + #ifndef __IMidiEndpointProtocolManagerInterface_FWD_DEFINED__ #define __IMidiEndpointProtocolManagerInterface_FWD_DEFINED__ typedef interface IMidiEndpointProtocolManagerInterface IMidiEndpointProtocolManagerInterface; @@ -1555,7 +1562,6 @@ typedef /* [public] */ struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0011_00 BOOL IsRuntimeCreatableBySettings; BOOL IsSystemManaged; BOOL IsClientConfigurable; - BSTR ClientConfigurationAssemblyName; } ABSTRACTIONMETADATA; typedef struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0011_0001 *PABSTRACTIONMETADATA; @@ -1572,7 +1578,6 @@ typedef /* [public] */ struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0011_00 BOOL IsRuntimeCreatableBySettings; BOOL IsSystemManaged; BOOL IsClientConfigurable; - BSTR ClientConfigurationAssemblyName; } TRANSFORMMETADATA; typedef struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0011_0002 *PTRANSFORMMETADATA; @@ -2054,19 +2059,117 @@ typedef /* [public] */ struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0015_00 BOOL EndpointSupportsMIDI1Protocol; LPCWSTR EndpointSuppliedName; LPCWSTR EndpointSuppliedProductInstanceId; - BYTE NumberOfFunctionBlocksDeclared; - BYTE NumberOfFunctionBlocksReceived; + BYTE CountFunctionBlocksDeclared; + BYTE CountFunctionBlocksReceived; BOOL FunctionBlocksAreStatic; PDISCOVEREDFUNCTIONBLOCK DiscoveredFunctionBlocks; } ENDPOINTPROTOCOLNEGOTIATIONRESULTS; typedef struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0015_0002 *PENDPOINTPROTOCOLNEGOTIATIONRESULTS; +typedef /* [public][public] */ struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0015_0003 + { + BOOL PreferToSendJRTimestampsToEndpoint; + BOOL PreferToReceiveJRTimestampsFromEndpoint; + BYTE PreferredMidiProtocol; + WORD TimeoutMilliseconds; + } ENDPOINTPROTOCOLNEGOTIATIONPARAMS; + +typedef struct __MIDL___MIDL_itf_WindowsMidiServices_0000_0015_0003 *PENDPOINTPROTOCOLNEGOTIATIONPARAMS; + extern RPC_IF_HANDLE __MIDL_itf_WindowsMidiServices_0000_0015_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_WindowsMidiServices_0000_0015_v0_0_s_ifspec; +#ifndef __IMidiProtocolNegotiationCompleteCallback_INTERFACE_DEFINED__ +#define __IMidiProtocolNegotiationCompleteCallback_INTERFACE_DEFINED__ + +/* interface IMidiProtocolNegotiationCompleteCallback */ +/* [unique][uuid][local][object] */ + + +EXTERN_C const IID IID_IMidiProtocolNegotiationCompleteCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("f948dc64-e03a-4e24-bc6e-437ad729cd50") + IMidiProtocolNegotiationCompleteCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ProtocolNegotiationCompleteCallback( + /* [in] */ GUID AbstractionGuid, + /* [in] */ LPCWSTR DeviceInterfaceId, + /* [in] */ PENDPOINTPROTOCOLNEGOTIATIONRESULTS Results) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IMidiProtocolNegotiationCompleteCallbackVtbl + { + BEGIN_INTERFACE + + DECLSPEC_XFGVIRT(IUnknown, QueryInterface) + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IMidiProtocolNegotiationCompleteCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + DECLSPEC_XFGVIRT(IUnknown, AddRef) + ULONG ( STDMETHODCALLTYPE *AddRef )( + IMidiProtocolNegotiationCompleteCallback * This); + + DECLSPEC_XFGVIRT(IUnknown, Release) + ULONG ( STDMETHODCALLTYPE *Release )( + IMidiProtocolNegotiationCompleteCallback * This); + + DECLSPEC_XFGVIRT(IMidiProtocolNegotiationCompleteCallback, ProtocolNegotiationCompleteCallback) + HRESULT ( STDMETHODCALLTYPE *ProtocolNegotiationCompleteCallback )( + IMidiProtocolNegotiationCompleteCallback * This, + /* [in] */ GUID AbstractionGuid, + /* [in] */ LPCWSTR DeviceInterfaceId, + /* [in] */ PENDPOINTPROTOCOLNEGOTIATIONRESULTS Results); + + END_INTERFACE + } IMidiProtocolNegotiationCompleteCallbackVtbl; + + interface IMidiProtocolNegotiationCompleteCallback + { + CONST_VTBL struct IMidiProtocolNegotiationCompleteCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IMidiProtocolNegotiationCompleteCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IMidiProtocolNegotiationCompleteCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IMidiProtocolNegotiationCompleteCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IMidiProtocolNegotiationCompleteCallback_ProtocolNegotiationCompleteCallback(This,AbstractionGuid,DeviceInterfaceId,Results) \ + ( (This)->lpVtbl -> ProtocolNegotiationCompleteCallback(This,AbstractionGuid,DeviceInterfaceId,Results) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IMidiProtocolNegotiationCompleteCallback_INTERFACE_DEFINED__ */ + + #ifndef __IMidiEndpointProtocolManagerInterface_INTERFACE_DEFINED__ #define __IMidiEndpointProtocolManagerInterface_INTERFACE_DEFINED__ @@ -2085,11 +2188,8 @@ EXTERN_C const IID IID_IMidiEndpointProtocolManagerInterface; virtual HRESULT STDMETHODCALLTYPE NegotiateAndRequestMetadata( /* [in] */ GUID AbstractionGuid, /* [in] */ LPCWSTR DeviceInterfaceId, - /* [in] */ BOOL PreferToSendJRTimestampsToEndpoint, - /* [in] */ BOOL PreferToReceiveJRTimestampsFromEndpoint, - /* [in] */ BYTE PreferredMidiProtocol, - /* [in] */ WORD TimeoutMilliseconds, - /* [retval][out] */ PENDPOINTPROTOCOLNEGOTIATIONRESULTS *NegotiationResults) = 0; + /* [in] */ ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + /* [in] */ IMidiProtocolNegotiationCompleteCallback *NegotiationCompleteCallback) = 0; }; @@ -2120,11 +2220,8 @@ EXTERN_C const IID IID_IMidiEndpointProtocolManagerInterface; IMidiEndpointProtocolManagerInterface * This, /* [in] */ GUID AbstractionGuid, /* [in] */ LPCWSTR DeviceInterfaceId, - /* [in] */ BOOL PreferToSendJRTimestampsToEndpoint, - /* [in] */ BOOL PreferToReceiveJRTimestampsFromEndpoint, - /* [in] */ BYTE PreferredMidiProtocol, - /* [in] */ WORD TimeoutMilliseconds, - /* [retval][out] */ PENDPOINTPROTOCOLNEGOTIATIONRESULTS *NegotiationResults); + /* [in] */ ENDPOINTPROTOCOLNEGOTIATIONPARAMS NegotiationParams, + /* [in] */ IMidiProtocolNegotiationCompleteCallback *NegotiationCompleteCallback); END_INTERFACE } IMidiEndpointProtocolManagerInterfaceVtbl; @@ -2149,8 +2246,8 @@ EXTERN_C const IID IID_IMidiEndpointProtocolManagerInterface; ( (This)->lpVtbl -> Release(This) ) -#define IMidiEndpointProtocolManagerInterface_NegotiateAndRequestMetadata(This,AbstractionGuid,DeviceInterfaceId,PreferToSendJRTimestampsToEndpoint,PreferToReceiveJRTimestampsFromEndpoint,PreferredMidiProtocol,TimeoutMilliseconds,NegotiationResults) \ - ( (This)->lpVtbl -> NegotiateAndRequestMetadata(This,AbstractionGuid,DeviceInterfaceId,PreferToSendJRTimestampsToEndpoint,PreferToReceiveJRTimestampsFromEndpoint,PreferredMidiProtocol,TimeoutMilliseconds,NegotiationResults) ) +#define IMidiEndpointProtocolManagerInterface_NegotiateAndRequestMetadata(This,AbstractionGuid,DeviceInterfaceId,NegotiationParams,NegotiationCompleteCallback) \ + ( (This)->lpVtbl -> NegotiateAndRequestMetadata(This,AbstractionGuid,DeviceInterfaceId,NegotiationParams,NegotiationCompleteCallback) ) #endif /* COBJMACROS */ diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj index 5061c8604..e5e612086 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Microsoft.Midi.Settings.csproj @@ -82,13 +82,13 @@ + - diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs index 7a90719b6..7b2de52fd 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Models/AppState.cs @@ -61,16 +61,16 @@ private void StartDeviceWatcher(bool includeAll) ShutDownDeviceWatcher(); } - var filter = MidiEndpointDeviceInformationFilters.AllTypicalEndpoints; + var filter = MidiEndpointDeviceInformationFilters.AllStandardEndpoints; if (includeAll) { - filter |= MidiEndpointDeviceInformationFilters.IncludeDiagnosticLoopback; - filter |= MidiEndpointDeviceInformationFilters.IncludeDiagnosticPing; - filter |= MidiEndpointDeviceInformationFilters.IncludeVirtualDeviceResponder; + filter |= MidiEndpointDeviceInformationFilters.DiagnosticLoopback; + filter |= MidiEndpointDeviceInformationFilters.DiagnosticPing; + filter |= MidiEndpointDeviceInformationFilters.VirtualDeviceResponder; } - _watcher = MidiEndpointDeviceWatcher.CreateWatcher(filter); + _watcher = MidiEndpointDeviceWatcher.Create(filter); _watcher.Stopped += OnDeviceWatcherStopped; //_watcher.Updated += OnDeviceWatcherEndpointUpdated; diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Usings.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Usings.cs index c5a49ff07..6e4a150e9 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Usings.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Usings.cs @@ -1,3 +1,7 @@ global using WinUIEx; global using Microsoft.Midi.Settings.Helpers; -global using Windows.Devices.Midi2; \ No newline at end of file +global using Microsoft.Windows.Devices.Midi2; +global using Microsoft.Windows.Devices.Midi2.Initialization; +global using Microsoft.Windows.Devices.Midi2.Messages; +global using Microsoft.Windows.Devices.Midi2.Diagnostics; +global using Microsoft.Windows.Devices.Midi2.ServiceConfig; \ No newline at end of file diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DevicesViewModel.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DevicesViewModel.cs index e82051e35..a0118507d 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DevicesViewModel.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DevicesViewModel.cs @@ -18,8 +18,6 @@ //using Microsoft.Midi.Settings.SdkMock; -using Windows.Devices.Midi2; - namespace Microsoft.Midi.Settings.ViewModels { public class DevicesViewModel : ObservableRecipient, INavigationAware @@ -70,7 +68,7 @@ public void RefreshDeviceCollection(bool showDiagnosticsEndpoints = false) // pre-populate with transports - foreach (var transport in MidiService.GetInstalledTransportPlugins()) + foreach (var transport in MidiReporting.GetInstalledTransportPlugins()) { var t = new MidiEndpointDevicesByTransport(transport); @@ -83,7 +81,7 @@ public void RefreshDeviceCollection(bool showDiagnosticsEndpoints = false) { // Get the transport - var transportId = endpointDevice.TransportId; + var transportId = endpointDevice.GetTransportSuppliedInfo().TransportId; var parentTransport = tempCollection.Where(x => x.Transport.Id == transportId).FirstOrDefault(); @@ -105,7 +103,7 @@ public void RefreshDeviceCollection(bool showDiagnosticsEndpoints = false) { // TODO: this is a hack. Probably shouldn't be using the mnemonic directly // Instead, need a transport properly for purpose like we have with endpoints - if (item.Transport.Mnemonic == "DIAG") + if (item.Transport.Abbreviation == "DIAG") { if (showDiagnosticsEndpoints) {