diff --git a/build/staging/version/BundleInfo.wxi b/build/staging/version/BundleInfo.wxi index b32045fb..1001cbb3 100644 --- a/build/staging/version/BundleInfo.wxi +++ b/build/staging/version/BundleInfo.wxi @@ -1,4 +1,4 @@ - + diff --git a/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiAbstraction.vcxproj b/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiAbstraction.vcxproj index 23f17559..f38ac476 100644 --- a/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiAbstraction.vcxproj +++ b/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {8795821B-541D-4B9B-BF7F-50CA976FC54E} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,10 +144,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.BluetoothMidiAbstraction.def @@ -162,10 +162,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.BluetoothMidiAbstraction.def @@ -180,10 +180,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.BluetoothMidiAbstraction.def @@ -217,10 +217,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.BluetoothMidiAbstraction.def @@ -234,10 +234,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.BluetoothMidiAbstraction.def @@ -261,10 +261,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.BluetoothMidiAbstraction.def @@ -311,12 +311,12 @@ - + 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/Abstraction/BleMidiAbstraction/packages.config b/src/api/Abstraction/BleMidiAbstraction/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Abstraction/BleMidiAbstraction/packages.config +++ b/src/api/Abstraction/BleMidiAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/BleMidiAbstraction/pch.h b/src/api/Abstraction/BleMidiAbstraction/pch.h index 09c1ce36..f7713b9b 100644 --- a/src/api/Abstraction/BleMidiAbstraction/pch.h +++ b/src/api/Abstraction/BleMidiAbstraction/pch.h @@ -69,19 +69,20 @@ namespace bt = ::winrt::Windows::Devices::Bluetooth; #include "setupapi.h" //#include "Devpkey.h" -// AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" + #include "MidiXProc.h" -namespace internal = ::Windows::Devices::Midi2::Internal; class CMidi2BluetoothMidiConfigurationManager; class CMidi2BluetoothMidiEndpointManager; diff --git a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsAbstraction.vcxproj b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsAbstraction.vcxproj index 3277b24a..f7520afe 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsAbstraction.vcxproj +++ b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {093852BE-32B8-4EB8-814E-91410FFDB4F6} Win32Proj - 10.0.20348.0 + 10.0 Midi2.DiagnosticsAbstraction @@ -151,10 +151,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.DiagnosticsAbstraction.def @@ -169,10 +169,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.DiagnosticsAbstraction.def @@ -187,10 +187,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.DiagnosticsAbstraction.def @@ -224,10 +224,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.DiagnosticsAbstraction.def @@ -241,10 +241,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.DiagnosticsAbstractionn.def @@ -268,10 +268,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.DiagnosticsAbstraction.def @@ -317,12 +317,12 @@ - + 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/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp index deaeaede..e953639e 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp +++ b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp @@ -26,8 +26,6 @@ CMidi2DiagnosticsEndpointManager::Initialize( ) { - OutputDebugString(L"" __FUNCTION__ " Enter"); - TraceLoggingWrite( MidiDiagnosticsAbstractionTelemetryProvider::Provider(), __FUNCTION__, @@ -56,7 +54,12 @@ CMidi2DiagnosticsEndpointManager::Initialize( HRESULT CMidi2DiagnosticsEndpointManager::CreateParentDevice() { - OutputDebugString(L"" __FUNCTION__); + TraceLoggingWrite( + MidiDiagnosticsAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this") + ); // the parent device parameters are set by the transport (this) std::wstring parentDeviceName{ TRANSPORT_PARENT_DEVICE_NAME }; diff --git a/src/api/Abstraction/DiagnosticsAbstraction/packages.config b/src/api/Abstraction/DiagnosticsAbstraction/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/packages.config +++ b/src/api/Abstraction/DiagnosticsAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/DiagnosticsAbstraction/pch.h b/src/api/Abstraction/DiagnosticsAbstraction/pch.h index b717611c..4592f4d2 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/pch.h +++ b/src/api/Abstraction/DiagnosticsAbstraction/pch.h @@ -47,25 +47,26 @@ #include "SWDevice.h" #include #include "setupapi.h" -//#include "Devpkey.h" +#include "Devpkey.h" #include "strsafe.h" #include "wstring_util.h" // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" -#include "MidiXProc.h" +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" -namespace internal = ::Windows::Devices::Midi2::Internal; +#include "MidiXProc.h" #include "abstraction_defs.h" diff --git a/src/api/Abstraction/KSAbstraction/Midi2.KSAbstraction.vcxproj b/src/api/Abstraction/KSAbstraction/Midi2.KSAbstraction.vcxproj index a0fa44b3..fae00ce3 100644 --- a/src/api/Abstraction/KSAbstraction/Midi2.KSAbstraction.vcxproj +++ b/src/api/Abstraction/KSAbstraction/Midi2.KSAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {22ABB513-5E77-474D-AA11-E56B8071EB4C} Win32Proj - 10.0.20348.0 + 10.0 @@ -138,10 +138,10 @@ Create pch.h true - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -158,10 +158,10 @@ Create pch.h true - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -178,10 +178,10 @@ Create pch.h true - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -198,10 +198,10 @@ Create pch.h true - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -213,7 +213,7 @@ $(IntDir)$(ProjectName).tlb - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -222,12 +222,12 @@ Create pch.h true - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -236,7 +236,7 @@ Create pch.h true - stdcpp17 + stdcpp20 MaxSpeed @@ -283,12 +283,12 @@ - + 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/Abstraction/KSAbstraction/packages.config b/src/api/Abstraction/KSAbstraction/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Abstraction/KSAbstraction/packages.config +++ b/src/api/Abstraction/KSAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/KSAbstraction/pch.h b/src/api/Abstraction/KSAbstraction/pch.h index bb80cd83..427498e6 100644 --- a/src/api/Abstraction/KSAbstraction/pch.h +++ b/src/api/Abstraction/KSAbstraction/pch.h @@ -54,10 +54,24 @@ namespace json = winrt::Windows::Data::Json; #include "Devpkey.h" #include +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; + +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" + +#include "MidiXProc.h" + + #include "strsafe.h" #include "abstraction_defs.h" -#include "midi_config_json.h" #include "midiabstraction_i.c" #include "midiabstraction.h" diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.vcxproj b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.vcxproj index 7d1e693c..65ca5646 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.vcxproj +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {0F94A751-9159-4A88-8A71-347151124548} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,10 +144,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.LoopbackMidiAbstraction.def @@ -162,10 +162,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.LoopbackMidiAbstraction.def @@ -180,10 +180,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.LoopbackMidiAbstraction.def @@ -217,10 +217,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.LoopbackMidiAbstraction.def @@ -234,10 +234,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.LoopbackMidiAbstraction.def @@ -261,10 +261,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.LoopbackMidiAbstraction.def @@ -309,12 +309,12 @@ - + 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/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp index c11f4ce5..fed39864 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp @@ -167,22 +167,22 @@ CMidi2LoopbackMidiConfigurationManager::UpdateConfiguration( // all good - internal::JsonSetBoolProperty( - responseObject, + auto successVal = json::JsonValue::CreateBooleanValue(true); + responseObject.SetNamedValue( MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, - true); + successVal); // update the return json with the new Ids - - internal::JsonSetWStringProperty( - responseObject, + auto endpointIdAVal = json::JsonValue::CreateStringValue(definitionA->CreatedEndpointInterfaceId); + responseObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_A_ID_KEY, - definitionA->CreatedEndpointInterfaceId); + endpointIdAVal); - internal::JsonSetWStringProperty( - responseObject, + auto endpointIdBVal = json::JsonValue::CreateStringValue(definitionB->CreatedEndpointInterfaceId); + responseObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_B_ID_KEY, - definitionB->CreatedEndpointInterfaceId); + endpointIdAVal); + } else { @@ -277,10 +277,10 @@ CMidi2LoopbackMidiConfigurationManager::UpdateConfiguration( { AbstractionState::Current().GetEndpointTable()->RemoveDevice(associationId.c_str()); - internal::JsonSetBoolProperty( - responseObject, + auto removeSuccessVal = json::JsonValue::CreateBooleanValue(true); + responseObject.SetNamedValue( MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, - true); + removeSuccessVal); } else { diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/packages.config b/src/api/Abstraction/LoopbackMidiAbstraction/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/packages.config +++ b/src/api/Abstraction/LoopbackMidiAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/pch.h b/src/api/Abstraction/LoopbackMidiAbstraction/pch.h index 94f64b1f..1aaa10fc 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/pch.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/pch.h @@ -59,10 +59,10 @@ #include "SWDevice.h" #include #include "setupapi.h" -//#include "Devpkey.h" +#include "Devpkey.h" #include "strsafe.h" -#include "wstring_util.h" + //#pragma push_macro("GetObject") #undef GetObject @@ -73,19 +73,19 @@ namespace json = ::winrt::Windows::Data::Json; // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" -#include "swd_shared.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" -#include "MidiXProc.h" +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" -namespace internal = ::Windows::Devices::Midi2::Internal; +#include "MidiXProc.h" #include "abstraction_defs.h" diff --git a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.cpp b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.cpp index 8c0bbfab..324f25d2 100644 --- a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.cpp +++ b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.cpp @@ -137,6 +137,14 @@ GetMidiSrvBindingHandle(handle_t* BindingHandle nullptr, &stringBinding)); + //RETURN_IF_WIN32_ERROR(RpcStringBindingCompose( + // nullptr, + // reinterpret_cast(MIDISRV_LRPC_PROTOCOL), + // nullptr, + // reinterpret_cast(MIDISRV_ENDPOINT), + // nullptr, + // &stringBinding)); + RETURN_IF_WIN32_ERROR(RpcBindingFromStringBinding( stringBinding, BindingHandle)); diff --git a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.vcxproj b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.vcxproj index 28dfb3dc..8d5b1200 100644 --- a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.vcxproj +++ b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,7 +144,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midiks.lib;midixproc.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) @@ -162,7 +162,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midiks.lib;midixproc.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) @@ -180,7 +180,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midiks.lib;midixproc.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) @@ -213,7 +213,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midiks.lib;midixproc.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) @@ -231,7 +231,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midiks.lib;midixproc.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) @@ -249,7 +249,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midiks.lib;midixproc.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) @@ -298,12 +298,12 @@ - + 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/Abstraction/MidiSrvAbstraction/packages.config b/src/api/Abstraction/MidiSrvAbstraction/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Abstraction/MidiSrvAbstraction/packages.config +++ b/src/api/Abstraction/MidiSrvAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/NetworkMidiAbstraction/Midi2.NetworkMidiAbstraction.vcxproj b/src/api/Abstraction/NetworkMidiAbstraction/Midi2.NetworkMidiAbstraction.vcxproj index b1e46bb7..0058ea9a 100644 --- a/src/api/Abstraction/NetworkMidiAbstraction/Midi2.NetworkMidiAbstraction.vcxproj +++ b/src/api/Abstraction/NetworkMidiAbstraction/Midi2.NetworkMidiAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,10 +144,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.NetworkMidiAbstraction.def @@ -162,10 +162,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.NetworkMidiAbstraction.def @@ -180,10 +180,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.NetworkMidiAbstraction.def @@ -217,10 +217,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.NetworkMidiAbstraction.def @@ -234,10 +234,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.NetworkMidiAbstraction.def @@ -261,10 +261,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.NetworkMidiAbstraction.def @@ -313,12 +313,12 @@ - + 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/Abstraction/NetworkMidiAbstraction/packages.config b/src/api/Abstraction/NetworkMidiAbstraction/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Abstraction/NetworkMidiAbstraction/packages.config +++ b/src/api/Abstraction/NetworkMidiAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/NetworkMidiAbstraction/pch.h b/src/api/Abstraction/NetworkMidiAbstraction/pch.h index 593f54f2..a602981d 100644 --- a/src/api/Abstraction/NetworkMidiAbstraction/pch.h +++ b/src/api/Abstraction/NetworkMidiAbstraction/pch.h @@ -62,18 +62,19 @@ namespace json = ::winrt::Windows::Data::Json; // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" -#include "MidiXProc.h" +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" -namespace internal = ::Windows::Devices::Midi2::Internal; +#include "MidiXProc.h" #include "Midi2NetworkMidiAbstraction_i.c" #include "Midi2NetworkMidiAbstraction.h" diff --git a/src/api/Abstraction/SampleAbstraction/Midi2.SampleAbstraction.vcxproj b/src/api/Abstraction/SampleAbstraction/Midi2.SampleAbstraction.vcxproj index 07de8143..01130e41 100644 --- a/src/api/Abstraction/SampleAbstraction/Midi2.SampleAbstraction.vcxproj +++ b/src/api/Abstraction/SampleAbstraction/Midi2.SampleAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {3D391727-2A65-4BA6-A730-EC10406AF543} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,10 +144,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.SampleAbstraction.def @@ -162,10 +162,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.SampleAbstraction.def @@ -180,10 +180,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.SampleAbstraction.def @@ -217,10 +217,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.SampleAbstraction.def @@ -234,10 +234,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.SampleAbstraction.def @@ -261,10 +261,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.SampleAbstraction.def @@ -303,12 +303,12 @@ - + 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/Abstraction/SampleAbstraction/packages.config b/src/api/Abstraction/SampleAbstraction/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Abstraction/SampleAbstraction/packages.config +++ b/src/api/Abstraction/SampleAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/SampleAbstraction/pch.h b/src/api/Abstraction/SampleAbstraction/pch.h index 9f95eac3..118b86b6 100644 --- a/src/api/Abstraction/SampleAbstraction/pch.h +++ b/src/api/Abstraction/SampleAbstraction/pch.h @@ -39,15 +39,18 @@ #include // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" + #include "MidiXProc.h" namespace internal = ::Windows::Devices::Midi2::Internal; diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiAbstraction.vcxproj b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiAbstraction.vcxproj index 7fef3cb1..d6745e27 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiAbstraction.vcxproj +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {03009B2B-E3E8-49DC-A0D6-0FA90AE3B15B} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,10 +144,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualMidiAbstraction.def @@ -162,10 +162,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualMidiAbstraction.def @@ -180,10 +180,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualMidiAbstraction.def @@ -217,10 +217,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualMidiAbstraction.def @@ -234,10 +234,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualMidiAbstraction.def @@ -261,10 +261,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualMidiAbstraction.def @@ -308,12 +308,12 @@ - + 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/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp index ea66e93f..cfb97557 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp @@ -86,7 +86,7 @@ CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( return E_FAIL; } - auto createArray = internal::JsonGetArrayProperty(jsonObject, MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_CREATE_ARRAY_KEY); + auto createArray = jsonObject.GetNamedArray(MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_CREATE_ARRAY_KEY, nullptr); if (createArray == nullptr || createArray.Size() == 0) { @@ -107,25 +107,10 @@ CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( { MidiVirtualDeviceEndpointEntry deviceEntry; - deviceEntry.VirtualEndpointAssociationId = internal::JsonGetWStringProperty( - jsonEntry, - MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_ASSOCIATION_ID_PROPERTY_KEY, - L""); - - deviceEntry.ShortUniqueId = internal::JsonGetWStringProperty( - jsonEntry, - MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, - L""); - - deviceEntry.BaseEndpointName = internal::JsonGetWStringProperty( - jsonEntry, - MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, - L""); - - deviceEntry.Description = internal::JsonGetWStringProperty( - jsonEntry, - MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, - L""); + deviceEntry.VirtualEndpointAssociationId = jsonEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_ASSOCIATION_ID_PROPERTY_KEY, L""); + deviceEntry.ShortUniqueId = jsonEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, L""); + deviceEntry.BaseEndpointName = jsonEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, L""); + deviceEntry.Description = jsonEntry.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, L""); // TODO: if no association id, or it already exists in the table, bail @@ -154,10 +139,10 @@ CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( // TODO: Actual Success or fail response - internal::JsonSetBoolProperty( - responseObject, + auto responseVal = json::JsonValue::CreateBooleanValue(true); + responseObject.SetNamedValue( MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, - true); + responseVal); TraceLoggingWrite( MidiVirtualMidiAbstractionTelemetryProvider::Provider(), diff --git a/src/api/Abstraction/VirtualMidiAbstraction/packages.config b/src/api/Abstraction/VirtualMidiAbstraction/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/packages.config +++ b/src/api/Abstraction/VirtualMidiAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/VirtualMidiAbstraction/pch.h b/src/api/Abstraction/VirtualMidiAbstraction/pch.h index 5f908c1f..70a4315f 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/pch.h +++ b/src/api/Abstraction/VirtualMidiAbstraction/pch.h @@ -62,24 +62,23 @@ #include "SWDevice.h" #include #include "setupapi.h" -//#include "Devpkey.h" +#include "Devpkey.h" #include "strsafe.h" #include "wstring_util.h" // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" -#include "MidiXProc.h" - -namespace internal = ::Windows::Devices::Midi2::Internal; +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" #include "abstraction_defs.h" @@ -95,7 +94,6 @@ namespace internal = ::Windows::Devices::Midi2::Internal; #include "dllmain.h" -#include "swd_shared.h" class CMidi2VirtualMidiEndpointManager; class CMidi2VirtualMidiBiDi; diff --git a/src/api/Abstraction/VirtualPatchBayAbstraction/Midi2.VirtualPatchBayAbstraction.vcxproj b/src/api/Abstraction/VirtualPatchBayAbstraction/Midi2.VirtualPatchBayAbstraction.vcxproj index 4fb3129a..f5e55f1b 100644 --- a/src/api/Abstraction/VirtualPatchBayAbstraction/Midi2.VirtualPatchBayAbstraction.vcxproj +++ b/src/api/Abstraction/VirtualPatchBayAbstraction/Midi2.VirtualPatchBayAbstraction.vcxproj @@ -30,7 +30,7 @@ 17.0 {7427BC7A-4247-42B0-AC9B-7DA10418AA9D} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,10 +144,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualPatchBayAbstraction.def @@ -162,10 +162,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualPatchBayAbstraction.def @@ -180,10 +180,10 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualPatchBayAbstraction.def @@ -217,10 +217,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualPatchBayAbstraction.def @@ -234,10 +234,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualPatchBayAbstraction.def @@ -261,10 +261,10 @@ true Create pch.h - stdcpp17 + stdcpp20 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies); Midi2.VirtualPatchBayAbstraction.def @@ -305,12 +305,12 @@ - + 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/Abstraction/VirtualPatchBayAbstraction/packages.config b/src/api/Abstraction/VirtualPatchBayAbstraction/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Abstraction/VirtualPatchBayAbstraction/packages.config +++ b/src/api/Abstraction/VirtualPatchBayAbstraction/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h b/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h index c159d2d1..3ac61112 100644 --- a/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h +++ b/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h @@ -65,15 +65,18 @@ namespace json = ::winrt::Windows::Data::Json; //#include "Devpkey.h" // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; #include "MidiDefs.h" #include "MidiDataFormat.h" #include "MidiFlow.h" #include "MidiAbstraction.h" +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" + #include "MidiXProc.h" namespace internal = ::Windows::Devices::Midi2::Internal; diff --git a/src/api/Client/Midi2Client-Projection/Windows.Devices.Midi2.NET.csproj b/src/api/Client/Midi2Client-Projection/Windows.Devices.Midi2.NET.csproj index 31ec0f9a..534e21d2 100644 --- a/src/api/Client/Midi2Client-Projection/Windows.Devices.Midi2.NET.csproj +++ b/src/api/Client/Midi2Client-Projection/Windows.Devices.Midi2.NET.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/api/Client/Midi2Client-Projection/nuget/Windows.Devices.Midi2.nuspec b/src/api/Client/Midi2Client-Projection/nuget/Windows.Devices.Midi2.nuspec index 57b51dc0..f71b6934 100644 --- a/src/api/Client/Midi2Client-Projection/nuget/Windows.Devices.Midi2.nuspec +++ b/src/api/Client/Midi2Client-Projection/nuget/Windows.Devices.Midi2.nuspec @@ -2,7 +2,7 @@ Windows.Devices.Midi2 - 1.0.0-preview.5-0172 + 1.0.0-preview.5-0174 Microsoft Corporation Windows MIDI Services API. Minimum package necessary to use Windows MIDI Services from an app on a PC that has Windows MIDI Services installed. MIT diff --git a/src/api/Client/Midi2Client/IMidiUniversalPacket.idl b/src/api/Client/Midi2Client/IMidiUniversalPacket.idl index ec1bd11d..7cc3b86e 100644 --- a/src/api/Client/Midi2Client/IMidiUniversalPacket.idl +++ b/src/api/Client/Midi2Client/IMidiUniversalPacket.idl @@ -28,9 +28,9 @@ namespace Windows.Devices.Midi2 UInt32 PeekFirstWord(); - IVectorView GetAllWords(); + IVector GetAllWords(); UInt8 AppendAllMessageWordsToVector(IVector targetVector); - UInt8 AddAllMessageBytesToBuffer(Windows.Foundation.IMemoryBuffer buffer, UInt32 byteOffset); + UInt8 AddAllMessageBytesToBuffer(UInt32 byteOffset, Windows.Foundation.IMemoryBuffer buffer); }; } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiEndpointConnection.h b/src/api/Client/Midi2Client/MidiEndpointConnection.h index 0931ae8c..460fce11 100644 --- a/src/api/Client/Midi2Client/MidiEndpointConnection.h +++ b/src/api/Client/Midi2Client/MidiEndpointConnection.h @@ -54,80 +54,86 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::hstring const endpointDeviceId); - midi2::MidiSendMessageResult SendMessagePacket( + midi2::MidiSendMessageResult SendSingleMessagePacket( _In_ midi2::IMidiUniversalPacket const& ump) noexcept; - midi2::MidiSendMessageResult SendMessageStruct( - _In_ internal::MidiTimestamp timestamp, - _In_ midi2::MidiMessageStruct const& message, - _In_ uint8_t wordCount) noexcept; + midi2::MidiSendMessageResult SendSingleMessageStruct( + _In_ internal::MidiTimestamp const timestamp, + _In_ uint8_t wordCount, + _In_ midi2::MidiMessageStruct const& message + ) noexcept; - midi2::MidiSendMessageResult SendMessageWords( + midi2::MidiSendMessageResult SendSingleMessageWords( _In_ internal::MidiTimestamp const timestamp, _In_ uint32_t const word0) noexcept; - midi2::MidiSendMessageResult SendMessageWords( + midi2::MidiSendMessageResult SendSingleMessageWords( _In_ internal::MidiTimestamp const timestamp, _In_ uint32_t const word0, _In_ uint32_t const word1) noexcept; - midi2::MidiSendMessageResult SendMessageWords( + midi2::MidiSendMessageResult SendSingleMessageWords( _In_ internal::MidiTimestamp const timestamp, _In_ uint32_t const word0, _In_ uint32_t const word1, _In_ uint32_t const word2) noexcept; - midi2::MidiSendMessageResult SendMessageWords( + midi2::MidiSendMessageResult SendSingleMessageWords( _In_ internal::MidiTimestamp const timestamp, _In_ uint32_t const word0, _In_ uint32_t const word1, _In_ uint32_t const word2, _In_ uint32_t const word3) noexcept; - midi2::MidiSendMessageResult SendMessageWordArray( + midi2::MidiSendMessageResult SendSingleMessageWordArray( _In_ internal::MidiTimestamp const timestamp, - _In_ winrt::array_view words, _In_ uint32_t const startIndex, - _In_ uint8_t const wordCount) noexcept; + _In_ uint8_t const wordCount, + _In_ winrt::array_view words + ) noexcept; - midi2::MidiSendMessageResult SendMessageBuffer( - _In_ internal::MidiTimestamp timestamp, - _In_ foundation::IMemoryBuffer const& buffer, - _In_ uint32_t byteOffset, - _In_ uint8_t byteCount) noexcept; + midi2::MidiSendMessageResult SendSingleMessageBuffer( + _In_ internal::MidiTimestamp const timestamp, + _In_ uint32_t const byteOffset, + _In_ uint8_t const byteCount, + _In_ foundation::IMemoryBuffer const& buffer + ) noexcept; midi2::MidiSendMessageResult SendMultipleMessagesWordList( - _In_ internal::MidiTimestamp timestamp, - _In_ collections::IVectorView const& words) noexcept; + _In_ internal::MidiTimestamp const timestamp, + _In_ collections::IIterable const& words) noexcept; midi2::MidiSendMessageResult SendMultipleMessagesWordArray( - _In_ internal::MidiTimestamp timestamp, - _In_ winrt::array_view words) noexcept; + _In_ internal::MidiTimestamp const timestamp, + _In_ uint32_t const startIndex, + _In_ uint32_t const wordCount, + _In_ winrt::array_view words) noexcept; midi2::MidiSendMessageResult SendMultipleMessagesPacketList( - _In_ collections::IVectorView const& messages) noexcept; + _In_ collections::IIterable const& messages) noexcept; //midi2::MidiSendMessageResult SendMultipleMessagesPacketArray( // _In_ winrt::array_view messages) noexcept; midi2::MidiSendMessageResult SendMultipleMessagesStructList( - _In_ internal::MidiTimestamp timestamp, - _In_ collections::IVectorView const& messages) noexcept; + _In_ internal::MidiTimestamp const timestamp, + _In_ collections::IIterable const& messages) noexcept; midi2::MidiSendMessageResult SendMultipleMessagesStructArray( - _In_ internal::MidiTimestamp timestamp, - _In_ winrt::array_view messages) noexcept; + _In_ internal::MidiTimestamp const timestamp, + _In_ winrt::array_view messages) noexcept; midi2::MidiSendMessageResult SendMultipleMessagesBuffer( - _In_ internal::MidiTimestamp timestamp, - _In_ foundation::IMemoryBuffer const& buffer, - _In_ uint32_t byteOffset, - _In_ uint32_t byteCount) noexcept; + _In_ internal::MidiTimestamp const timestamp, + _In_ uint32_t const byteOffset, + _In_ uint32_t const byteCount, + _In_ foundation::IMemoryBuffer const& buffer + ) noexcept; _Success_(return == true) diff --git a/src/api/Client/Midi2Client/MidiEndpointConnection.idl b/src/api/Client/Midi2Client/MidiEndpointConnection.idl index 842a513d..9c8bff36 100644 --- a/src/api/Client/Midi2Client/MidiEndpointConnection.idl +++ b/src/api/Client/Midi2Client/MidiEndpointConnection.idl @@ -60,39 +60,39 @@ namespace Windows.Devices.Midi2 // send the UMP interface used by strongly-typed Midi Message classes in the SDK - MidiSendMessageResult SendMessagePacket(IMidiUniversalPacket message); + MidiSendMessageResult SendSingleMessagePacket(IMidiUniversalPacket message); - MidiSendMessageResult SendMessageStruct(MIDI_TIMESTAMP timestamp, ref const MidiMessageStruct message, UInt8 wordCount); + MidiSendMessageResult SendSingleMessageStruct(MIDI_TIMESTAMP timestamp, UInt8 wordCount, ref const MidiMessageStruct message); // Uses projection-specific array conversion operators for sending data. Not all languages support this // Also, arrays are often passed by-val in WinRT, so this may involve a lot of data copying, depending // upon implementation. For large buffers without copying, use the IMemoryBuffer - MidiSendMessageResult SendMessageWordArray(MIDI_TIMESTAMP timestamp, ref UInt32[] words, UInt32 startIndex, UInt8 wordCount); + MidiSendMessageResult SendSingleMessageWordArray(MIDI_TIMESTAMP timestamp, UInt32 startIndex, UInt8 wordCount, UInt32[] words); // sending words is a very fast approach, but does work with copies of the data. For the most common cases, // the amount of data being copied is quite small (32 and 64 bit messages being the most common), and smaller // than an equivalent pointer. - MidiSendMessageResult SendMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0); - MidiSendMessageResult SendMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0, UInt32 word1); - MidiSendMessageResult SendMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0, UInt32 word1, UInt32 word2); - MidiSendMessageResult SendMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0, UInt32 word1, UInt32 word2, UInt32 word3); + MidiSendMessageResult SendSingleMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0); + MidiSendMessageResult SendSingleMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0, UInt32 word1); + MidiSendMessageResult SendSingleMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0, UInt32 word1, UInt32 word2); + MidiSendMessageResult SendSingleMessageWords(MIDI_TIMESTAMP timestamp, UInt32 word0, UInt32 word1, UInt32 word2, UInt32 word3); // for sending a section of a pre-existing buffer. Used when a client app is maintaining its own memory - MidiSendMessageResult SendMessageBuffer(MIDI_TIMESTAMP timestamp, Windows.Foundation.IMemoryBuffer buffer, UInt32 byteOffset, UInt8 byteCount); + MidiSendMessageResult SendSingleMessageBuffer(MIDI_TIMESTAMP timestamp, UInt32 byteOffset, UInt8 byteCount, Windows.Foundation.IMemoryBuffer buffer); // These methods will send multiple messages. The words must be ordered correctly // so they are in order from word-0 to word-n for each message. - MidiSendMessageResult SendMultipleMessagesWordList(MIDI_TIMESTAMP timestamp, IVectorView words); - MidiSendMessageResult SendMultipleMessagesWordArray(MIDI_TIMESTAMP timestamp, ref UInt32[] words); + MidiSendMessageResult SendMultipleMessagesWordList(MIDI_TIMESTAMP timestamp, IIterable words); + MidiSendMessageResult SendMultipleMessagesWordArray(MIDI_TIMESTAMP timestamp, UInt32 startIndex, UInt32 wordCount, UInt32[] words); // a convenience for sending multiple packets. We can do this because these are self-describing MidiSendMessageResult SendMultipleMessagesPacketList(IVectorView messages); //MidiSendMessageResult SendMultipleMessagesPacketArray(ref IMidiUniversalPacket[] messages); - MidiSendMessageResult SendMultipleMessagesStructList(MIDI_TIMESTAMP timestamp, IVectorView messages); - MidiSendMessageResult SendMultipleMessagesStructArray(MIDI_TIMESTAMP timestamp, ref MidiMessageStruct[] messages); + MidiSendMessageResult SendMultipleMessagesStructList(MIDI_TIMESTAMP timestamp, IIterable messages); + MidiSendMessageResult SendMultipleMessagesStructArray(MIDI_TIMESTAMP timestamp, MidiMessageStruct[] messages); - MidiSendMessageResult SendMultipleMessagesBuffer(MIDI_TIMESTAMP timestamp, Windows.Foundation.IMemoryBuffer buffer, UInt32 byteOffset, UInt32 byteCount); + MidiSendMessageResult SendMultipleMessagesBuffer(MIDI_TIMESTAMP timestamp, UInt32 byteOffset, UInt32 byteCount, Windows.Foundation.IMemoryBuffer buffer); } diff --git a/src/api/Client/Midi2Client/MidiEndpointConnection_SendMultipleMessages.cpp b/src/api/Client/Midi2Client/MidiEndpointConnection_SendMultipleMessages.cpp index b3f5da9a..4ec3e4df 100644 --- a/src/api/Client/Midi2Client/MidiEndpointConnection_SendMultipleMessages.cpp +++ b/src/api/Client/Midi2Client/MidiEndpointConnection_SendMultipleMessages.cpp @@ -17,10 +17,11 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiSendMessageResult MidiEndpointConnection::SendMultipleMessagesBuffer( - internal::MidiTimestamp timestamp, - foundation::IMemoryBuffer const& buffer, - uint32_t byteOffset, - uint32_t byteCount) noexcept + internal::MidiTimestamp const timestamp, + uint32_t const byteOffset, + uint32_t const byteCount, + foundation::IMemoryBuffer const& buffer + ) noexcept { internal::LogInfo(__FUNCTION__, L"Enter"); @@ -113,8 +114,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiSendMessageResult MidiEndpointConnection::SendMultipleMessagesWordList( - internal::MidiTimestamp timestamp, - collections::IVectorView const& words) noexcept + internal::MidiTimestamp const timestamp, + collections::IIterable const& words) noexcept { internal::LogInfo(__FUNCTION__, L"Enter"); @@ -122,19 +123,19 @@ namespace winrt::Windows::Devices::Midi2::implementation uint32_t messageWords[4]{ 0,0,0,0 }; // we reuse this storage - collections::IIterable iterable = words.as>(); + //collections::IIterable iterable = words.as>(); - auto iter = iterable.First(); + auto iter = words.First(); - auto vectorSize = words.Size(); + //auto vectorSize = words.Size(); while (iter.HasCurrent()) { //auto messageWordCount = internal::GetUmpLengthInMidiWordsFromFirstWord(words.GetAt(i)); auto messageWordCount = internal::GetUmpLengthInMidiWordsFromFirstWord(iter.Current()); - if (i + messageWordCount <= vectorSize) - { + //if (i + messageWordCount <= vectorSize) + //{ for (uint32_t j = 0; j < messageWordCount; j++) { //messageWords[j] = words.GetAt(i + j); @@ -159,7 +160,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } i += messageWordCount; - } + //} } return midi2::MidiSendMessageResult::Succeeded; @@ -168,14 +169,17 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiSendMessageResult MidiEndpointConnection::SendMultipleMessagesWordArray( - internal::MidiTimestamp timestamp, - winrt::array_view words) noexcept + internal::MidiTimestamp const timestamp, + uint32_t const startIndex, + uint32_t const wordCount, + winrt::array_view words) noexcept { internal::LogInfo(__FUNCTION__, L"Enter"); - uint32_t i{ 0 }; + uint32_t i{ startIndex }; + uint32_t wordsSent{ 0 }; - while (i < words.size()) + while (i < words.size() && wordsSent < wordCount) { auto messageWordCount = internal::GetUmpLengthInMidiWordsFromFirstWord(words[i]); @@ -197,6 +201,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } i += messageWordCount; + wordsSent += messageWordCount; } else { @@ -215,8 +220,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiSendMessageResult MidiEndpointConnection::SendMultipleMessagesStructList( - internal::MidiTimestamp timestamp, - collections::IVectorView const& messages) noexcept + internal::MidiTimestamp const timestamp, + collections::IIterable const& messages) noexcept { internal::LogInfo(__FUNCTION__, L"Enter"); @@ -241,8 +246,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiSendMessageResult MidiEndpointConnection::SendMultipleMessagesStructArray( - internal::MidiTimestamp timestamp, - winrt::array_view messages) noexcept + internal::MidiTimestamp const timestamp, + winrt::array_view messages) noexcept { internal::LogInfo(__FUNCTION__, L"Enter"); @@ -267,7 +272,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiSendMessageResult MidiEndpointConnection::SendMultipleMessagesPacketList( - collections::IVectorView const& messages) noexcept + collections::IIterable const& messages) noexcept { internal::LogInfo(__FUNCTION__, L"Sending multiple message packet list"); diff --git a/src/api/Client/Midi2Client/MidiEndpointConnection_SendSingleMessage.cpp b/src/api/Client/Midi2Client/MidiEndpointConnection_SendSingleMessage.cpp index 9b67187d..e38fcb73 100644 --- a/src/api/Client/Midi2Client/MidiEndpointConnection_SendSingleMessage.cpp +++ b/src/api/Client/Midi2Client/MidiEndpointConnection_SendSingleMessage.cpp @@ -16,10 +16,11 @@ namespace winrt::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageStruct( - internal::MidiTimestamp timestamp, - midi2::MidiMessageStruct const& message, - uint8_t wordCount) noexcept + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageStruct( + internal::MidiTimestamp const timestamp, + uint8_t const wordCount, + midi2::MidiMessageStruct const& message + ) noexcept { internal::LogInfo(__FUNCTION__, L"Sending message struct"); @@ -37,11 +38,12 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageBuffer( - const internal::MidiTimestamp timestamp, - winrt::Windows::Foundation::IMemoryBuffer const& buffer, - const uint32_t byteOffset, - const uint8_t byteCount) noexcept + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageBuffer( + internal::MidiTimestamp const timestamp, + uint32_t const byteOffset, + uint8_t const byteCount, + winrt::Windows::Foundation::IMemoryBuffer const& buffer + ) noexcept { internal::LogInfo(__FUNCTION__, L"Sending message buffer"); @@ -96,12 +98,12 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageWordArray( + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageWordArray( internal::MidiTimestamp const timestamp, - winrt::array_view words, uint32_t const startIndex, - uint8_t const wordCount - ) noexcept + uint8_t const wordCount, + winrt::array_view words + ) noexcept { internal::LogInfo(__FUNCTION__, L"Sending message word array"); @@ -140,7 +142,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageWords( + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageWords( internal::MidiTimestamp const timestamp, uint32_t const word0) noexcept { @@ -173,7 +175,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageWords( + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageWords( internal::MidiTimestamp const timestamp, uint32_t const word0, uint32_t const word1) noexcept @@ -210,7 +212,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageWords( + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageWords( internal::MidiTimestamp const timestamp, uint32_t const word0, uint32_t const word1, @@ -250,7 +252,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessageWords( + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessageWords( internal::MidiTimestamp const timestamp, uint32_t const word0, uint32_t const word1, @@ -291,7 +293,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ - midi2::MidiSendMessageResult MidiEndpointConnection::SendMessagePacket( + midi2::MidiSendMessageResult MidiEndpointConnection::SendSingleMessagePacket( midi2::IMidiUniversalPacket const& message) noexcept { internal::LogInfo(__FUNCTION__, L"Sending message packet"); diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.cpp b/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.cpp index c8267e16..1ef551ad 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.cpp +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.cpp @@ -198,13 +198,13 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ bool MidiEndpointDeviceInformation::DeviceMatchesFilter( midi2::MidiEndpointDeviceInformation const& deviceInformation, - midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept + midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept { // check if diagnostic loopback if (deviceInformation.EndpointPurpose() == MidiEndpointDevicePurpose::DiagnosticLoopback) { - if ((endpointFilter & midi2::MidiEndpointDeviceInformationFilter::IncludeDiagnosticLoopback) == - midi2::MidiEndpointDeviceInformationFilter::IncludeDiagnosticLoopback) + if ((endpointFilters & midi2::MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback) == + midi2::MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback) { return true; } @@ -213,8 +213,8 @@ namespace winrt::Windows::Devices::Midi2::implementation // check if diagnostic ping else if (deviceInformation.EndpointPurpose() == MidiEndpointDevicePurpose::DiagnosticPing) { - if ((endpointFilter & midi2::MidiEndpointDeviceInformationFilter::IncludeDiagnosticPing) == - midi2::MidiEndpointDeviceInformationFilter::IncludeDiagnosticPing) + if ((endpointFilters & midi2::MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing) == + midi2::MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing) { return true; } @@ -223,8 +223,8 @@ namespace winrt::Windows::Devices::Midi2::implementation // check if virtual device responder else if (deviceInformation.EndpointPurpose() == MidiEndpointDevicePurpose::VirtualDeviceResponder) { - if ((endpointFilter & midi2::MidiEndpointDeviceInformationFilter::IncludeVirtualDeviceResponder) == - midi2::MidiEndpointDeviceInformationFilter::IncludeVirtualDeviceResponder) + if ((endpointFilters & midi2::MidiEndpointDeviceInformationFilters::IncludeVirtualDeviceResponder) == + midi2::MidiEndpointDeviceInformationFilters::IncludeVirtualDeviceResponder) { return true; } @@ -234,8 +234,8 @@ namespace winrt::Windows::Devices::Midi2::implementation else if ((deviceInformation.EndpointPurpose() == MidiEndpointDevicePurpose::NormalMessageEndpoint) && (deviceInformation.NativeDataFormat() == MidiEndpointNativeDataFormat::ByteStream)) { - if ((endpointFilter & midi2::MidiEndpointDeviceInformationFilter::IncludeClientByteStreamNative) == - midi2::MidiEndpointDeviceInformationFilter::IncludeClientByteStreamNative) + if ((endpointFilters & midi2::MidiEndpointDeviceInformationFilters::IncludeClientByteStreamNative) == + midi2::MidiEndpointDeviceInformationFilters::IncludeClientByteStreamNative) { return true; } @@ -246,7 +246,7 @@ namespace winrt::Windows::Devices::Midi2::implementation (deviceInformation.NativeDataFormat() == MidiEndpointNativeDataFormat::UniversalMidiPacket || deviceInformation.NativeDataFormat() == MidiEndpointNativeDataFormat::Unknown)) { - if ((endpointFilter & midi2::MidiEndpointDeviceInformationFilter::IncludeClientUmpNative) == midi2::MidiEndpointDeviceInformationFilter::IncludeClientUmpNative) + if ((endpointFilters & midi2::MidiEndpointDeviceInformationFilters::IncludeClientUmpNative) == midi2::MidiEndpointDeviceInformationFilters::IncludeClientUmpNative) { return true; } @@ -265,7 +265,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ collections::IVectorView MidiEndpointDeviceInformation::FindAll( midi2::MidiEndpointDeviceInformationSortOrder const& sortOrder, - midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept + midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept { std::vector midiDevices{}; @@ -286,7 +286,7 @@ namespace winrt::Windows::Devices::Midi2::implementation midiDevice->UpdateFromDeviceInformation(di); - if (DeviceMatchesFilter(*midiDevice, endpointFilter)) + if (DeviceMatchesFilter(*midiDevice, endpointFilters)) { midiDevices.push_back(*midiDevice); } @@ -409,8 +409,8 @@ namespace winrt::Windows::Devices::Midi2::implementation midi2::MidiEndpointDeviceInformationSortOrder const& sortOrder) noexcept { return FindAll(sortOrder, - midi2::MidiEndpointDeviceInformationFilter::IncludeClientUmpNative | - midi2::MidiEndpointDeviceInformationFilter::IncludeClientByteStreamNative + midi2::MidiEndpointDeviceInformationFilters::IncludeClientUmpNative | + midi2::MidiEndpointDeviceInformationFilters::IncludeClientByteStreamNative ); } diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.h b/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.h index bdf62a8d..074bf850 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.h +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.h @@ -28,7 +28,7 @@ namespace winrt::Windows::Devices::Midi2::implementation static collections::IVectorView FindAll( _In_ midi2::MidiEndpointDeviceInformationSortOrder const& sortOrder, - _In_ midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept; + _In_ midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept; static collections::IVectorView FindAll( _In_ midi2::MidiEndpointDeviceInformationSortOrder const& sortOrder) noexcept; @@ -38,11 +38,11 @@ namespace winrt::Windows::Devices::Midi2::implementation static collections::IVectorView GetAdditionalPropertiesList() noexcept; static winrt::Windows::Devices::Enumeration::DeviceWatcher CreateWatcher( - _In_ midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept; + _In_ midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept; static bool DeviceMatchesFilter( _In_ midi2::MidiEndpointDeviceInformation const& deviceInformation, - _In_ midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept; + _In_ midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept; winrt::hstring Id() const noexcept; winrt::guid ContainerId() const noexcept { return GetGuidProperty(L"System.Devices.ContainerId", winrt::guid{}); } diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.idl b/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.idl index 54eebf99..a6cc171b 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.idl +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformation.idl @@ -16,7 +16,7 @@ import "MidiEndpointDevicePurposeEnum.idl"; import "MidiFunctionBlock.idl"; import "MidiEndpointDeviceInformationSortOrderEnum.idl"; -import "MidiEndpointDeviceInformationFilterEnum.idl"; +import "MidiEndpointDeviceInformationFiltersEnum.idl"; namespace Windows.Devices.Midi2 { @@ -28,7 +28,7 @@ namespace Windows.Devices.Midi2 static IVectorView FindAll(); static IVectorView FindAll(MidiEndpointDeviceInformationSortOrder sortOrder); - static IVectorView FindAll(MidiEndpointDeviceInformationSortOrder sortOrder, MidiEndpointDeviceInformationFilter endpointFilter); + static IVectorView FindAll(MidiEndpointDeviceInformationSortOrder sortOrder, MidiEndpointDeviceInformationFilters endpointFilters); static String DiagnosticsLoopbackAEndpointId{ get; }; static String DiagnosticsLoopbackBEndpointId{ get; }; @@ -37,7 +37,7 @@ namespace Windows.Devices.Midi2 static IVectorView GetAdditionalPropertiesList(); - static Boolean DeviceMatchesFilter(MidiEndpointDeviceInformation deviceInformation, MidiEndpointDeviceInformationFilter endpointFilter); + static Boolean DeviceMatchesFilter(MidiEndpointDeviceInformation deviceInformation, MidiEndpointDeviceInformationFilters endpointFilters); diff --git a/src/api/Libs/AbstractionUtilities/src/swd_property_builders.cpp b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.cpp similarity index 57% rename from src/api/Libs/AbstractionUtilities/src/swd_property_builders.cpp rename to src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.cpp index 04647332..9d9ed636 100644 --- a/src/api/Libs/AbstractionUtilities/src/swd_property_builders.cpp +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.cpp @@ -7,14 +7,18 @@ // ============================================================================ #include "pch.h" +#include "MidiEndpointDeviceInformationAddedEventArgs.h" +#include "MidiEndpointDeviceInformationAddedEventArgs.g.cpp" -namespace Windows::Devices::Midi2::Internal + +namespace winrt::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - DEVPROPERTY BuildEmptyDevProperty(DEVPROPKEY const key) + void MidiEndpointDeviceInformationAddedEventArgs::InternalInitialize( + midi2::MidiEndpointDeviceInformation const& addedDevice + ) noexcept { - return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_EMPTY, 0, nullptr }; - + m_addedDevice = addedDevice; } + } diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.h b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.h new file mode 100644 index 00000000..e1167219 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.h @@ -0,0 +1,31 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once +#include "MidiEndpointDeviceInformationAddedEventArgs.g.h" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiEndpointDeviceInformationAddedEventArgs : MidiEndpointDeviceInformationAddedEventArgsT + { + MidiEndpointDeviceInformationAddedEventArgs() = default; + + midi2::MidiEndpointDeviceInformation AddedDevice() const noexcept { return m_addedDevice; } + + + void InternalInitialize( + _In_ midi2::MidiEndpointDeviceInformation const& addedDevice + ) noexcept; + + + private: + midi2::MidiEndpointDeviceInformation m_addedDevice{ nullptr }; + + }; +} diff --git a/src/api/Client/Midi2Client/MidiEndpointDiscoveryFilterFlagsEnum.idl b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.idl similarity index 62% rename from src/api/Client/Midi2Client/MidiEndpointDiscoveryFilterFlagsEnum.idl rename to src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.idl index 9b2799e1..38a44896 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDiscoveryFilterFlagsEnum.idl +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationAddedEventArgs.idl @@ -9,20 +9,15 @@ #include "midl_defines.h" MIDI_IDL_IMPORT +import "MidiEndpointDeviceInformation.idl"; namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] - [flags] - enum MidiEndpointDiscoveryFilterFlags + [default_interface] + runtimeclass MidiEndpointDeviceInformationAddedEventArgs { - None = 0x00000000, - RequestEndpointInformation = 0x00000001, - RequestDeviceIdentity = 0x00000002, - RequestEndpointName = 0x00000004, - RequestProductInstanceId = 0x00000008, - RequestStreamConfiguration = 0x00000010, + MidiEndpointDeviceInformation AddedDevice{ get; }; + } +} - - }; -} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationFilterEnum.idl b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationFiltersEnum.idl similarity index 96% rename from src/api/Client/Midi2Client/MidiEndpointDeviceInformationFilterEnum.idl rename to src/api/Client/Midi2Client/MidiEndpointDeviceInformationFiltersEnum.idl index da0807ec..c201fde0 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationFilterEnum.idl +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationFiltersEnum.idl @@ -13,7 +13,7 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [flags] - enum MidiEndpointDeviceInformationFilter + enum MidiEndpointDeviceInformationFilters { // Normal client devices to connect to to send/receive. // These two are all most apps need diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.cpp b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.cpp new file mode 100644 index 00000000..f207ceda --- /dev/null +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.cpp @@ -0,0 +1,25 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#include "pch.h" +#include "MidiEndpointDeviceInformationRemovedEventArgs.h" +#include "MidiEndpointDeviceInformationRemovedEventArgs.g.cpp" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + _Use_decl_annotations_ + void MidiEndpointDeviceInformationRemovedEventArgs::InternalInitialize( + winrt::hstring const removedDeviceId, + winrt::Windows::Devices::Enumeration::DeviceInformationUpdate const& deviceInformationUpdate + ) noexcept + { + m_removedDeviceId = removedDeviceId; + m_deviceInformationUpdate = deviceInformationUpdate; + } +} diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.h b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.h new file mode 100644 index 00000000..e913494f --- /dev/null +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.h @@ -0,0 +1,33 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once +#include "MidiEndpointDeviceInformationRemovedEventArgs.g.h" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiEndpointDeviceInformationRemovedEventArgs : MidiEndpointDeviceInformationRemovedEventArgsT + { + MidiEndpointDeviceInformationRemovedEventArgs() = default; + + winrt::hstring Id() const noexcept { return m_removedDeviceId; } + winrt::Windows::Devices::Enumeration::DeviceInformationUpdate DeviceInformationUpdate() const noexcept { return m_deviceInformationUpdate; } + + void InternalInitialize( + _In_ winrt::hstring const removedDeviceId, + _In_ winrt::Windows::Devices::Enumeration::DeviceInformationUpdate const& deviceInformationUpdate + ) noexcept; + + private: + winrt::hstring m_removedDeviceId{}; + winrt::Windows::Devices::Enumeration::DeviceInformationUpdate m_deviceInformationUpdate{ nullptr }; + + + }; +} diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.idl b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.idl new file mode 100644 index 00000000..22a244bd --- /dev/null +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationRemovedEventArgs.idl @@ -0,0 +1,23 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#include "midl_defines.h" +MIDI_IDL_IMPORT + +namespace Windows.Devices.Midi2 +{ + [MIDI_API_CONTRACT(1)] + [default_interface] + runtimeclass MidiEndpointDeviceInformationRemovedEventArgs + { + String Id { get; }; + + Windows.Devices.Enumeration.DeviceInformationUpdate DeviceInformationUpdate{ get; }; + } +} + diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.h b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.h deleted file mode 100644 index aebe7045..00000000 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once -#include "MidiEndpointDeviceInformationUpdateEventArgs.g.h" - -namespace winrt::Windows::Devices::Midi2::implementation -{ - struct MidiEndpointDeviceInformationUpdateEventArgs : MidiEndpointDeviceInformationUpdateEventArgsT - { - MidiEndpointDeviceInformationUpdateEventArgs() = default; - - winrt::hstring Id() { return m_endpointDeviceId; } - - bool UpdatedName() { return m_updatedName; } - bool UpdatedEndpointInformation() { return m_updatedInProtocolEndpointInformation; } - bool UpdatedDeviceIdentity() { return m_updatedDeviceIdentity; } - bool UpdatedStreamConfiguration() { return m_updatedStreamConfiguration; } - bool UpdatedFunctionBlocks() { return m_updatedFunctionBlocks; } - bool UpdatedUserMetadata() { return m_updatedUserMetadata; } - bool UpdatedAdditionalCapabilities() { return m_updatedAdditionalCapabilities; } - - winrt::Windows::Devices::Enumeration::DeviceInformationUpdate DeviceInformationUpdate() { return m_deviceInformationUpdate; } - - void InternalInitialize( - _In_ winrt::hstring endpointDeviceId, - _In_ winrt::Windows::Devices::Enumeration::DeviceInformationUpdate deviceInformationUpdate, - _In_ bool updatedName, - _In_ bool updatedInProtocolEndpointInformation, - _In_ bool updatedDeviceIdentity, - _In_ bool updatedStreamConfiguration, - _In_ bool updatedFunctionBlocks, - _In_ bool updatedUserMetadata, - _In_ bool updatedAdditionalCapabilities - ); - - private: - bool m_updatedName{ false }; - bool m_updatedInProtocolEndpointInformation{ false }; - bool m_updatedDeviceIdentity{ false }; - bool m_updatedStreamConfiguration{ false }; - bool m_updatedFunctionBlocks{ false }; - bool m_updatedUserMetadata{ false }; - bool m_updatedAdditionalCapabilities{ false }; - - winrt::hstring m_endpointDeviceId{}; - winrt::Windows::Devices::Enumeration::DeviceInformationUpdate m_deviceInformationUpdate{ nullptr }; - }; -} diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.cpp b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.cpp similarity index 65% rename from src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.cpp rename to src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.cpp index 244c6852..32689a3a 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.cpp +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.cpp @@ -7,24 +7,24 @@ // ============================================================================ #include "pch.h" -#include "MidiEndpointDeviceInformationUpdateEventArgs.h" -#include "MidiEndpointDeviceInformationUpdateEventArgs.g.cpp" +#include "MidiEndpointDeviceInformationUpdatedEventArgs.h" +#include "MidiEndpointDeviceInformationUpdatedEventArgs.g.cpp" namespace winrt::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - void MidiEndpointDeviceInformationUpdateEventArgs::InternalInitialize( - winrt::hstring endpointDeviceId, - winrt::Windows::Devices::Enumeration::DeviceInformationUpdate deviceInformationUpdate, - bool updatedName, - bool updatedInProtocolEndpointInformation, - bool updatedDeviceIdentity, - bool updatedStreamConfiguration, - bool updatedFunctionBlocks, - bool updatedUserMetadata, - bool updatedAdditionalCapabilities - ) + void MidiEndpointDeviceInformationUpdatedEventArgs::InternalInitialize( + winrt::hstring const endpointDeviceId, + winrt::Windows::Devices::Enumeration::DeviceInformationUpdate const& deviceInformationUpdate, + bool const updatedName, + bool const updatedInProtocolEndpointInformation, + bool const updatedDeviceIdentity, + bool const updatedStreamConfiguration, + bool const updatedFunctionBlocks, + bool const updatedUserMetadata, + bool const updatedAdditionalCapabilities + ) noexcept { m_updatedName = updatedName; diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.h b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.h new file mode 100644 index 00000000..7207cc1b --- /dev/null +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.h @@ -0,0 +1,54 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once +#include "MidiEndpointDeviceInformationUpdatedEventArgs.g.h" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiEndpointDeviceInformationUpdatedEventArgs : MidiEndpointDeviceInformationUpdatedEventArgsT + { + MidiEndpointDeviceInformationUpdatedEventArgs() = default; + + winrt::hstring Id() const noexcept { return m_endpointDeviceId; } + + bool UpdatedName() const noexcept { return m_updatedName; } + bool UpdatedEndpointInformation() const noexcept { return m_updatedInProtocolEndpointInformation; } + bool UpdatedDeviceIdentity() const noexcept { return m_updatedDeviceIdentity; } + bool UpdatedStreamConfiguration() const noexcept { return m_updatedStreamConfiguration; } + bool UpdatedFunctionBlocks() const noexcept { return m_updatedFunctionBlocks; } + bool UpdatedUserMetadata() const noexcept { return m_updatedUserMetadata; } + bool UpdatedAdditionalCapabilities() const noexcept { return m_updatedAdditionalCapabilities; } + + winrt::Windows::Devices::Enumeration::DeviceInformationUpdate DeviceInformationUpdate() const noexcept { return m_deviceInformationUpdate; } + + void InternalInitialize( + _In_ winrt::hstring const endpointDeviceId, + _In_ winrt::Windows::Devices::Enumeration::DeviceInformationUpdate const& deviceInformationUpdate, + _In_ bool const updatedName, + _In_ bool const updatedInProtocolEndpointInformation, + _In_ bool const updatedDeviceIdentity, + _In_ bool const updatedStreamConfiguration, + _In_ bool const updatedFunctionBlocks, + _In_ bool const updatedUserMetadata, + _In_ bool const updatedAdditionalCapabilities + ) noexcept; + + private: + bool m_updatedName{ false }; + bool m_updatedInProtocolEndpointInformation{ false }; + bool m_updatedDeviceIdentity{ false }; + bool m_updatedStreamConfiguration{ false }; + bool m_updatedFunctionBlocks{ false }; + bool m_updatedUserMetadata{ false }; + bool m_updatedAdditionalCapabilities{ false }; + + winrt::hstring m_endpointDeviceId{}; + winrt::Windows::Devices::Enumeration::DeviceInformationUpdate m_deviceInformationUpdate{ nullptr }; + }; +} diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.idl b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.idl similarity index 95% rename from src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.idl rename to src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.idl index c359c83f..6f933bfb 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdateEventArgs.idl +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceInformationUpdatedEventArgs.idl @@ -13,7 +13,7 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiEndpointDeviceInformationUpdateEventArgs + runtimeclass MidiEndpointDeviceInformationUpdatedEventArgs { String Id {get; }; diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.cpp b/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.cpp index 01f650f3..59699993 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.cpp +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.cpp @@ -14,6 +14,8 @@ namespace winrt::Windows::Devices::Midi2::implementation { void MidiEndpointDeviceWatcher::Start() { + internal::LogInfo(__FUNCTION__, L"Enter"); + m_enumeratedEndpointDevices.Clear(); if (m_watcher) @@ -24,6 +26,8 @@ namespace winrt::Windows::Devices::Midi2::implementation void MidiEndpointDeviceWatcher::Stop() { + internal::LogInfo(__FUNCTION__, L"Enter"); + if (m_watcher) { m_watcher.Stop(); @@ -32,6 +36,8 @@ namespace winrt::Windows::Devices::Midi2::implementation MidiEndpointDeviceWatcher::~MidiEndpointDeviceWatcher() { + internal::LogInfo(__FUNCTION__, L"Enter"); + try { m_enumeratedEndpointDevices.Clear(); @@ -57,9 +63,11 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::Windows::Devices::Enumeration::DeviceWatcher source, _In_ winrt::Windows::Devices::Enumeration::DeviceInformation args) { + internal::LogInfo(__FUNCTION__, L"Enter"); + try { - auto midiEndpointDeviceInformation = winrt::make_self(); + auto midiEndpointDeviceInformation = winrt::make_self(); midiEndpointDeviceInformation->UpdateFromDeviceInformation(args); @@ -70,7 +78,7 @@ namespace winrt::Windows::Devices::Midi2::implementation { // add to our map - auto mapKey = internal::ToLowerHStringCopy(midiEndpointDeviceInformation->Id()); + auto mapKey = internal::NormalizeEndpointInterfaceIdHStringCopy(midiEndpointDeviceInformation->Id()); if (!m_enumeratedEndpointDevices.HasKey(mapKey)) { @@ -78,7 +86,10 @@ namespace winrt::Windows::Devices::Midi2::implementation if (m_deviceAddedEvent) { - m_deviceAddedEvent(*this, *midiEndpointDeviceInformation); + auto newArgs = winrt::make_self(); + newArgs->InternalInitialize(*midiEndpointDeviceInformation); + + m_deviceAddedEvent(*this, *newArgs); } } else @@ -98,11 +109,11 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::Windows::Devices::Enumeration::DeviceWatcher source, _In_ winrt::Windows::Devices::Enumeration::DeviceInformationUpdate args) { - // TODO: check to see if the device matches one in our list + internal::LogInfo(__FUNCTION__, L"Enter"); try { - auto mapKey = internal::ToLowerHStringCopy(args.Id()); + auto mapKey = internal::NormalizeEndpointInterfaceIdHStringCopy(args.Id()); if (m_enumeratedEndpointDevices.HasKey(mapKey)) { @@ -112,7 +123,7 @@ namespace winrt::Windows::Devices::Midi2::implementation if (m_deviceUpdatedEvent) { - auto newArgs = winrt::make_self(); + auto newArgs = winrt::make_self(); bool updatedName{ false }; bool updatedInProtocolEndpointInformation{ false }; @@ -122,7 +133,6 @@ namespace winrt::Windows::Devices::Midi2::implementation bool updatedUserMetadata{ false }; bool updatedAdditionalCapabilities{ false }; - // TODO: check changed properties and set the flags here if (args.Properties().HasKey(STRING_PKEY_MIDI_TransportSuppliedEndpointName) || args.Properties().HasKey(L"System.ItemNameDisplay") || @@ -186,6 +196,9 @@ namespace winrt::Windows::Devices::Midi2::implementation } + + + newArgs->InternalInitialize( args.Id(), args, @@ -212,11 +225,15 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::Windows::Devices::Enumeration::DeviceWatcher source, _In_ winrt::Windows::Devices::Enumeration::DeviceInformationUpdate args) { - // TODO: check to see if the device matches one in our list + internal::LogInfo(__FUNCTION__, L"Enter"); try { - auto mapKey = internal::ToLowerHStringCopy(args.Id()); + auto mapKey = internal::NormalizeEndpointInterfaceIdHStringCopy(args.Id()); + + auto newArgs = winrt::make_self(); + + newArgs->InternalInitialize(args.Id(), args); if (m_enumeratedEndpointDevices.HasKey(mapKey)) { @@ -224,7 +241,7 @@ namespace winrt::Windows::Devices::Midi2::implementation if (m_deviceRemovedEvent) { - m_deviceRemovedEvent(*this, args); + m_deviceRemovedEvent(*this, *newArgs); } } } @@ -238,6 +255,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::Windows::Devices::Enumeration::DeviceWatcher source, _In_ winrt::Windows::Foundation::IInspectable args) { + internal::LogInfo(__FUNCTION__, L"Enter"); + try { if (m_enumerationCompletedEvent) m_enumerationCompletedEvent(*this, args); @@ -252,6 +271,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::Windows::Devices::Enumeration::DeviceWatcher source, _In_ winrt::Windows::Foundation::IInspectable args) { + internal::LogInfo(__FUNCTION__, L"Enter"); + try { if (m_stoppedEvent) m_stoppedEvent(*this, args); @@ -265,10 +286,12 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ void MidiEndpointDeviceWatcher::InternalInitialize( - midi2::MidiEndpointDeviceInformationFilter const& endpointFilter, + midi2::MidiEndpointDeviceInformationFilters const& endpointFilters, winrt::Windows::Devices::Enumeration::DeviceWatcher const& baseWatcher) { - m_endpointFilter = endpointFilter; + internal::LogInfo(__FUNCTION__, L"Enter"); + + m_endpointFilter = endpointFilters; m_watcher = baseWatcher; if (m_watcher != nullptr) @@ -285,8 +308,10 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiEndpointDeviceWatcher MidiEndpointDeviceWatcher::CreateWatcher( - midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept + midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept { + internal::LogInfo(__FUNCTION__, L"Enter"); + try { // the properties we would filter on are GUID properties, so we can't use @@ -299,7 +324,7 @@ namespace winrt::Windows::Devices::Midi2::implementation midi2::MidiEndpointDeviceInformation::GetAdditionalPropertiesList(), winrt::Windows::Devices::Enumeration::DeviceInformationKind::DeviceInterface); - watcher->InternalInitialize(endpointFilter, baseWatcher); + watcher->InternalInitialize(endpointFilters, baseWatcher); return *watcher; } @@ -314,6 +339,8 @@ namespace winrt::Windows::Devices::Midi2::implementation winrt::Windows::Devices::Enumeration::DeviceWatcherStatus MidiEndpointDeviceWatcher::Status() { + internal::LogInfo(__FUNCTION__, L"Enter"); + if (m_watcher) { return m_watcher.Status(); diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.h b/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.h index c3641c10..0dd3e265 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.h +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.h @@ -17,14 +17,14 @@ namespace winrt::Windows::Devices::Midi2::implementation MidiEndpointDeviceWatcher() = default; ~MidiEndpointDeviceWatcher(); - static midi2::MidiEndpointDeviceWatcher CreateWatcher(_In_ midi2::MidiEndpointDeviceInformationFilter const& endpointFilter) noexcept; + static midi2::MidiEndpointDeviceWatcher CreateWatcher(_In_ midi2::MidiEndpointDeviceInformationFilters const& endpointFilters) noexcept; void Start(); void Stop(); winrt::Windows::Devices::Enumeration::DeviceWatcherStatus Status(); - winrt::event_token Added(_In_ winrt::Windows::Foundation::TypedEventHandler const& handler) + winrt::event_token Added(_In_ winrt::Windows::Foundation::TypedEventHandler const& handler) { return m_deviceAddedEvent.add(handler); } @@ -33,7 +33,7 @@ namespace winrt::Windows::Devices::Midi2::implementation if (m_deviceAddedEvent) m_deviceAddedEvent.remove(token); } - winrt::event_token Removed(_In_ winrt::Windows::Foundation::TypedEventHandler const& handler) + winrt::event_token Removed(_In_ winrt::Windows::Foundation::TypedEventHandler const& handler) { return m_deviceRemovedEvent.add(handler); } @@ -43,7 +43,7 @@ namespace winrt::Windows::Devices::Midi2::implementation if (m_deviceRemovedEvent) m_deviceRemovedEvent.remove(token); } - winrt::event_token Updated(_In_ winrt::Windows::Foundation::TypedEventHandler const& handler) + winrt::event_token Updated(_In_ winrt::Windows::Foundation::TypedEventHandler const& handler) { return m_deviceUpdatedEvent.add(handler); } @@ -77,7 +77,7 @@ namespace winrt::Windows::Devices::Midi2::implementation private: void InternalInitialize( - _In_ midi2::MidiEndpointDeviceInformationFilter const& endpointFilter, + _In_ midi2::MidiEndpointDeviceInformationFilters const& endpointFilters, _In_ winrt::Windows::Devices::Enumeration::DeviceWatcher const& baseWatcher); @@ -103,13 +103,13 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ winrt::Windows::Foundation::IInspectable args); - midi2::MidiEndpointDeviceInformationFilter m_endpointFilter{ - MidiEndpointDeviceInformationFilter::IncludeClientByteStreamNative | MidiEndpointDeviceInformationFilter::IncludeClientUmpNative }; + midi2::MidiEndpointDeviceInformationFilters m_endpointFilter{ + MidiEndpointDeviceInformationFilters::IncludeClientByteStreamNative | MidiEndpointDeviceInformationFilters::IncludeClientUmpNative }; - winrt::event> m_deviceAddedEvent; - winrt::event> m_deviceUpdatedEvent; - winrt::event> m_deviceRemovedEvent; + winrt::event> m_deviceAddedEvent; + winrt::event> m_deviceUpdatedEvent; + winrt::event> m_deviceRemovedEvent; winrt::event> m_enumerationCompletedEvent; winrt::event> m_stoppedEvent; diff --git a/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.idl b/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.idl index 47502b0a..4c9f7534 100644 --- a/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.idl +++ b/src/api/Client/Midi2Client/MidiEndpointDeviceWatcher.idl @@ -9,9 +9,12 @@ #include "midl_defines.h" MIDI_IDL_IMPORT -import "MidiEndpointDeviceInformationFilterEnum.idl"; +import "MidiEndpointDeviceInformationFiltersEnum.idl"; import "MidiEndpointDeviceInformation.idl"; -import "MidiEndpointDeviceInformationUpdateEventArgs.idl"; + +import "MidiEndpointDeviceInformationUpdatedEventArgs.idl"; +import "MidiEndpointDeviceInformationRemovedEventArgs.idl"; +import "MidiEndpointDeviceInformationAddedEventArgs.idl"; namespace Windows.Devices.Midi2 { @@ -19,7 +22,7 @@ namespace Windows.Devices.Midi2 [default_interface] runtimeclass MidiEndpointDeviceWatcher { - static MidiEndpointDeviceWatcher CreateWatcher(MidiEndpointDeviceInformationFilter endpointFilter); + static MidiEndpointDeviceWatcher CreateWatcher(MidiEndpointDeviceInformationFilters endpointFilters); void Start(); void Stop(); @@ -28,9 +31,9 @@ namespace Windows.Devices.Midi2 Windows.Devices.Enumeration.DeviceWatcherStatus Status{ get; }; - event Windows.Foundation.TypedEventHandler Added; - event Windows.Foundation.TypedEventHandler Removed; - event Windows.Foundation.TypedEventHandler Updated; + event Windows.Foundation.TypedEventHandler Added; + event Windows.Foundation.TypedEventHandler Removed; + event Windows.Foundation.TypedEventHandler Updated; event Windows.Foundation.TypedEventHandler EnumerationCompleted; event Windows.Foundation.TypedEventHandler Stopped; diff --git a/src/api/Client/Midi2Client/MidiEndpointDiscoveryRequestsEnum.idl b/src/api/Client/Midi2Client/MidiEndpointDiscoveryRequestsEnum.idl new file mode 100644 index 00000000..6cd09af8 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiEndpointDiscoveryRequestsEnum.idl @@ -0,0 +1,26 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#include "midl_defines.h" +MIDI_IDL_IMPORT + + +namespace Windows.Devices.Midi2 +{ + [MIDI_API_CONTRACT(1)] + [flags] + enum MidiEndpointDiscoveryRequests + { + None = 0x00000000, + RequestEndpointInfo = 0x00000001, + RequestDeviceIdentity = 0x00000002, + RequestEndpointName = 0x00000004, + RequestProductInstanceId = 0x00000008, + RequestStreamConfiguration = 0x00000010, + }; +} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryFilterFlagsEnum.idl b/src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryRequestsEnum.idl similarity index 75% rename from src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryFilterFlagsEnum.idl rename to src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryRequestsEnum.idl index 0ce0eacd..8cc817dd 100644 --- a/src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryFilterFlagsEnum.idl +++ b/src/api/Client/Midi2Client/MidiFunctionBlockDiscoveryRequestsEnum.idl @@ -14,10 +14,10 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [flags] - enum MidiFunctionBlockDiscoveryFilterFlags + enum MidiFunctionBlockDiscoveryRequests { - None = 0x00000000, - RequestFunctionBlockInformation = 0x00000001, - RequestFunctionBlockName = 0x00000002, + None = 0x00000000, + RequestFunctionBlockInfo = 0x00000001, + RequestFunctionBlockName = 0x00000002, }; } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiMessage128.cpp b/src/api/Client/Midi2Client/MidiMessage128.cpp index 7fd1e55c..40dc932a 100644 --- a/src/api/Client/Midi2Client/MidiMessage128.cpp +++ b/src/api/Client/Midi2Client/MidiMessage128.cpp @@ -12,7 +12,7 @@ namespace winrt::Windows::Devices::Midi2::implementation { - collections::IVectorView MidiMessage128::GetAllWords() const noexcept + collections::IVector MidiMessage128::GetAllWords() const noexcept { auto vec = winrt::single_threaded_vector(); @@ -21,7 +21,7 @@ namespace winrt::Windows::Devices::Midi2::implementation vec.Append(m_ump.word2); vec.Append(m_ump.word3); - return vec.GetView(); + return vec; } _Use_decl_annotations_ @@ -36,7 +36,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - uint8_t MidiMessage128::AddAllMessageBytesToBuffer(foundation::IMemoryBuffer const& buffer, uint32_t const byteOffset) const noexcept + uint8_t MidiMessage128::AddAllMessageBytesToBuffer(uint32_t const byteOffset, foundation::IMemoryBuffer const& buffer) const noexcept { const uint8_t numWordsInPacket = 4; const uint8_t numBytesInPacket = numWordsInPacket * sizeof(uint32_t); diff --git a/src/api/Client/Midi2Client/MidiMessage128.h b/src/api/Client/Midi2Client/MidiMessage128.h index a9b7ca3b..84f99ede 100644 --- a/src/api/Client/Midi2Client/MidiMessage128.h +++ b/src/api/Client/Midi2Client/MidiMessage128.h @@ -65,10 +65,14 @@ namespace winrt::Windows::Devices::Midi2::implementation { return midi2::MidiPacketType::UniversalMidiPacket128; } - collections::IVectorView GetAllWords() const noexcept; - uint8_t AppendAllMessageWordsToVector(_Inout_ collections::IVector targetVector) const noexcept; - - uint8_t AddAllMessageBytesToBuffer(_In_ foundation::IMemoryBuffer const& buffer, _In_ uint32_t const byteOffset) const noexcept; + collections::IVector GetAllWords() const noexcept; + uint8_t AppendAllMessageWordsToVector( + _Inout_ collections::IVector targetVector) const noexcept; + + uint8_t AddAllMessageBytesToBuffer( + _In_ uint32_t const byteOffset, + _In_ foundation::IMemoryBuffer const& buffer + ) const noexcept; // IStringable winrt::hstring ToString(); diff --git a/src/api/Client/Midi2Client/MidiMessage32.cpp b/src/api/Client/Midi2Client/MidiMessage32.cpp index d7eea024..384b3656 100644 --- a/src/api/Client/Midi2Client/MidiMessage32.cpp +++ b/src/api/Client/Midi2Client/MidiMessage32.cpp @@ -15,13 +15,13 @@ namespace winrt::Windows::Devices::Midi2::implementation { - collections::IVectorView MidiMessage32::GetAllWords() const noexcept + collections::IVector MidiMessage32::GetAllWords() const noexcept { auto vec = winrt::single_threaded_vector(); vec.Append(m_ump.word0); - return vec.GetView(); + return vec; } _Use_decl_annotations_ @@ -33,7 +33,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - uint8_t MidiMessage32::AddAllMessageBytesToBuffer(foundation::IMemoryBuffer const& buffer, uint32_t const byteOffset) const noexcept + uint8_t MidiMessage32::AddAllMessageBytesToBuffer(uint32_t const byteOffset, foundation::IMemoryBuffer const& buffer) const noexcept { const uint8_t numWordsInPacket = 2; const uint8_t numBytesInPacket = numWordsInPacket * sizeof(uint32_t); diff --git a/src/api/Client/Midi2Client/MidiMessage32.h b/src/api/Client/Midi2Client/MidiMessage32.h index ea110c12..93c67e39 100644 --- a/src/api/Client/Midi2Client/MidiMessage32.h +++ b/src/api/Client/Midi2Client/MidiMessage32.h @@ -46,10 +46,15 @@ namespace winrt::Windows::Devices::Midi2::implementation uint32_t PeekFirstWord() { return Word0(); } - collections::IVectorView GetAllWords() const noexcept; - uint8_t AppendAllMessageWordsToVector(_Inout_ collections::IVector targetVector) const noexcept; - - uint8_t AddAllMessageBytesToBuffer(_In_ foundation::IMemoryBuffer const& buffer, _In_ uint32_t const byteOffset) const noexcept; + collections::IVector GetAllWords() const noexcept; + uint8_t AppendAllMessageWordsToVector( + _Inout_ collections::IVector targetVector + ) const noexcept; + + uint8_t AddAllMessageBytesToBuffer( + _In_ uint32_t const byteOffset, + _In_ foundation::IMemoryBuffer const& buffer + ) const noexcept; // internal for the sending code internal::PackedUmp32* GetInternalUmpDataPointer() { return &m_ump; } diff --git a/src/api/Client/Midi2Client/MidiMessage64.cpp b/src/api/Client/Midi2Client/MidiMessage64.cpp index 49722f5d..9573adeb 100644 --- a/src/api/Client/Midi2Client/MidiMessage64.cpp +++ b/src/api/Client/Midi2Client/MidiMessage64.cpp @@ -1,121 +1,121 @@ -// 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://github.com/microsoft/MIDI/ -// ============================================================================ - -#include "pch.h" -#include "MidiMessage64.h" -#include "MidiMessage64.g.cpp" - - -namespace winrt::Windows::Devices::Midi2::implementation -{ - collections::IVectorView MidiMessage64::GetAllWords() const noexcept - { - auto vec = winrt::single_threaded_vector(); - - vec.Append(m_ump.word0); - vec.Append(m_ump.word1); - - return vec.GetView(); - } - - _Use_decl_annotations_ - uint8_t MidiMessage64::AppendAllMessageWordsToVector(collections::IVector targetVector) const noexcept - { - targetVector.Append(m_ump.word0); - targetVector.Append(m_ump.word1); - - return 2; - } - - _Use_decl_annotations_ - uint8_t MidiMessage64::AddAllMessageBytesToBuffer(foundation::IMemoryBuffer const& buffer, uint32_t const byteOffset) const noexcept - { - const uint8_t numWordsInPacket = 2; - const uint8_t numBytesInPacket = numWordsInPacket * sizeof(uint32_t); - - try - { - auto ref = buffer.CreateReference(); - auto interop = ref.as(); - - uint8_t* value{}; - uint32_t valueSize{}; - - // get a pointer to the buffer - if (SUCCEEDED(interop->GetBuffer(&value, &valueSize))) - { - if (byteOffset + numBytesInPacket > valueSize) - { - // no room - return 0; - } - else - { - uint32_t* bufferWordPointer = reinterpret_cast(value + byteOffset); - - // copy the number of valid bytes in our internal UMP structure - memcpy(bufferWordPointer, &m_ump, numBytesInPacket); - - return numBytesInPacket; - } - } - else - { - return 0; - } - - } - catch (...) - { - return 0; - } - } - - - _Use_decl_annotations_ - MidiMessage64::MidiMessage64( - internal::MidiTimestamp const timestamp, - uint32_t const word0, - uint32_t const word1) - { - m_timestamp = timestamp; - - m_ump.word0 = word0; - m_ump.word1 = word1; - } - - // internal constructor for reading from the service callback - _Use_decl_annotations_ - void MidiMessage64::InternalInitializeFromPointer( - internal::MidiTimestamp const timestamp, - PVOID data) - { - if (data == nullptr) return; - - m_timestamp = timestamp; - - // need to have some safeties around this - memcpy((void*)&m_ump, data, sizeof(internal::PackedUmp64)); - } - - - winrt::hstring MidiMessage64::ToString() - { - std::stringstream stream; - - stream << "64-bit MIDI message:" - << " 0x" << std::hex << std::setw(8) << std::setfill('0') << Word0() - << " 0x" << std::hex << std::setw(8) << std::setfill('0') << Word1(); - - return winrt::to_hstring(stream.str()); - } - - - -} - +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#include "pch.h" +#include "MidiMessage64.h" +#include "MidiMessage64.g.cpp" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + collections::IVectorView MidiMessage64::GetAllWords() const noexcept + { + auto vec = winrt::single_threaded_vector(); + + vec.Append(m_ump.word0); + vec.Append(m_ump.word1); + + return vec; + } + + _Use_decl_annotations_ + uint8_t MidiMessage64::AppendAllMessageWordsToVector(collections::IVector targetVector) const noexcept + { + targetVector.Append(m_ump.word0); + targetVector.Append(m_ump.word1); + + return 2; + } + + _Use_decl_annotations_ + uint8_t MidiMessage64::AddAllMessageBytesToBuffer(uint32_t const byteOffset, foundation::IMemoryBuffer const& buffer) const noexcept + { + const uint8_t numWordsInPacket = 2; + const uint8_t numBytesInPacket = numWordsInPacket * sizeof(uint32_t); + + try + { + auto ref = buffer.CreateReference(); + auto interop = ref.as(); + + uint8_t* value{}; + uint32_t valueSize{}; + + // get a pointer to the buffer + if (SUCCEEDED(interop->GetBuffer(&value, &valueSize))) + { + if (byteOffset + numBytesInPacket > valueSize) + { + // no room + return 0; + } + else + { + uint32_t* bufferWordPointer = reinterpret_cast(value + byteOffset); + + // copy the number of valid bytes in our internal UMP structure + memcpy(bufferWordPointer, &m_ump, numBytesInPacket); + + return numBytesInPacket; + } + } + else + { + return 0; + } + + } + catch (...) + { + return 0; + } + } + + + _Use_decl_annotations_ + MidiMessage64::MidiMessage64( + internal::MidiTimestamp const timestamp, + uint32_t const word0, + uint32_t const word1) + { + m_timestamp = timestamp; + + m_ump.word0 = word0; + m_ump.word1 = word1; + } + + // internal constructor for reading from the service callback + _Use_decl_annotations_ + void MidiMessage64::InternalInitializeFromPointer( + internal::MidiTimestamp const timestamp, + PVOID data) + { + if (data == nullptr) return; + + m_timestamp = timestamp; + + // need to have some safeties around this + memcpy((void*)&m_ump, data, sizeof(internal::PackedUmp64)); + } + + + winrt::hstring MidiMessage64::ToString() + { + std::stringstream stream; + + stream << "64-bit MIDI message:" + << " 0x" << std::hex << std::setw(8) << std::setfill('0') << Word0() + << " 0x" << std::hex << std::setw(8) << std::setfill('0') << Word1(); + + return winrt::to_hstring(stream.str()); + } + + + +} + diff --git a/src/api/Client/Midi2Client/MidiMessage64.h b/src/api/Client/Midi2Client/MidiMessage64.h index 9a343431..0181cef8 100644 --- a/src/api/Client/Midi2Client/MidiMessage64.h +++ b/src/api/Client/Midi2Client/MidiMessage64.h @@ -58,10 +58,14 @@ namespace winrt::Windows::Devices::Midi2::implementation // IStringable winrt::hstring ToString(); - collections::IVectorView GetAllWords() const noexcept; - uint8_t AppendAllMessageWordsToVector(_Inout_ collections::IVector targetVector) const noexcept; - - uint8_t AddAllMessageBytesToBuffer(_In_ foundation::IMemoryBuffer const& buffer, _In_ uint32_t const byteOffset) const noexcept; + collections::IVector GetAllWords() const noexcept; + uint8_t AppendAllMessageWordsToVector( + _Inout_ collections::IVector targetVector) const noexcept; + + uint8_t AddAllMessageBytesToBuffer( + _In_ uint32_t const byteOffset, + _In_ foundation::IMemoryBuffer const& buffer + ) const noexcept; // internal for the sending code internal::PackedUmp64* GetInternalUmpDataPointer() { return &m_ump; } diff --git a/src/api/Client/Midi2Client/MidiMessage96.cpp b/src/api/Client/Midi2Client/MidiMessage96.cpp index 6868bf69..8d0cdfd3 100644 --- a/src/api/Client/Midi2Client/MidiMessage96.cpp +++ b/src/api/Client/Midi2Client/MidiMessage96.cpp @@ -12,7 +12,7 @@ namespace winrt::Windows::Devices::Midi2::implementation { - collections::IVectorView MidiMessage96::GetAllWords() const noexcept + collections::IVector MidiMessage96::GetAllWords() const noexcept { auto vec = winrt::single_threaded_vector(); @@ -20,7 +20,7 @@ namespace winrt::Windows::Devices::Midi2::implementation vec.Append(m_ump.word1); vec.Append(m_ump.word2); - return vec.GetView(); + return vec; } _Use_decl_annotations_ @@ -35,7 +35,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ - uint8_t MidiMessage96::AddAllMessageBytesToBuffer(foundation::IMemoryBuffer const& buffer, uint32_t const byteOffset) const noexcept + uint8_t MidiMessage96::AddAllMessageBytesToBuffer(uint32_t const byteOffset, foundation::IMemoryBuffer const& buffer) const noexcept { const uint8_t numWordsInPacket = 3; const uint8_t numBytesInPacket = numWordsInPacket * sizeof(uint32_t); diff --git a/src/api/Client/Midi2Client/MidiMessage96.h b/src/api/Client/Midi2Client/MidiMessage96.h index 016fb32d..356356f4 100644 --- a/src/api/Client/Midi2Client/MidiMessage96.h +++ b/src/api/Client/Midi2Client/MidiMessage96.h @@ -60,10 +60,14 @@ namespace winrt::Windows::Devices::Midi2::implementation midi2::MidiPacketType PacketType() const noexcept { return midi2::MidiPacketType::UniversalMidiPacket96; } - collections::IVectorView GetAllWords() const noexcept; - uint8_t AppendAllMessageWordsToVector(_Inout_ collections::IVector targetVector) const noexcept; - - uint8_t AddAllMessageBytesToBuffer(_In_ foundation::IMemoryBuffer const& buffer, _In_ uint32_t const byteOffset) const noexcept; + collections::IVector GetAllWords() const noexcept; + uint8_t AppendAllMessageWordsToVector( + _Inout_ collections::IVector targetVector) const noexcept; + + uint8_t AddAllMessageBytesToBuffer( + _In_ uint32_t const byteOffset, + _In_ foundation::IMemoryBuffer const& buffer + ) const noexcept; // IStringable diff --git a/src/api/Client/Midi2Client/MidiMessageBuilder.cpp b/src/api/Client/Midi2Client/MidiMessageBuilder.cpp index fc2f7f2f..7fac9e41 100644 --- a/src/api/Client/Midi2Client/MidiMessageBuilder.cpp +++ b/src/api/Client/Midi2Client/MidiMessageBuilder.cpp @@ -34,7 +34,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage32 MidiMessageBuilder::BuildSystemMessage( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, uint8_t const status, uint8_t const midi1Byte2, uint8_t const midi1Byte3) noexcept @@ -43,7 +43,7 @@ namespace winrt::Windows::Devices::Midi2::implementation timestamp, (uint32_t)( 0x1 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | status << 16 | internal::CleanupByte7(midi1Byte2) << 8 | internal::CleanupByte7(midi1Byte3)) @@ -53,9 +53,9 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage32 MidiMessageBuilder::BuildMidi1ChannelVoiceMessage( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, midi2::Midi1ChannelVoiceMessageStatus const& status, - uint8_t const channelIndex, + midi2::MidiChannel const& channel, uint8_t const byte3, uint8_t const byte4) noexcept { @@ -63,9 +63,9 @@ namespace winrt::Windows::Devices::Midi2::implementation timestamp, (uint32_t)( 0x2 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | internal::CleanupNibble((uint8_t)status) << 20 | - internal::CleanupNibble(channelIndex) << 16 | + channel.Index() << 16 | internal::CleanupByte7(byte3) << 8 | internal::CleanupByte7(byte4)) ); @@ -74,7 +74,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage64 MidiMessageBuilder::BuildSystemExclusive7Message( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, uint8_t const status, uint8_t const numberOfBytes, uint8_t const dataByte0, @@ -89,7 +89,7 @@ namespace winrt::Windows::Devices::Midi2::implementation timestamp, (uint32_t)( 0x3 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | internal::CleanupNibble(status) << 20 | internal::CleanupNibble(numberOfBytes) << 16 | internal::CleanupByte7(dataByte0) << 8 | @@ -109,9 +109,9 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage64 MidiMessageBuilder::BuildMidi2ChannelVoiceMessage( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, midi2::Midi2ChannelVoiceMessageStatus const& status, - uint8_t const channelIndex, + midi2::MidiChannel const& channel, uint16_t const index, uint32_t const data) noexcept { @@ -119,9 +119,9 @@ namespace winrt::Windows::Devices::Midi2::implementation timestamp, (uint32_t)( 0x4 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | internal::CleanupNibble((uint8_t)status) << 20 | - internal::CleanupNibble(channelIndex) << 16 | + channel.Index() << 16 | index), data); } @@ -129,7 +129,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage128 MidiMessageBuilder::BuildSystemExclusive8Message( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, midi2::MidiSystemExclusive8Status const& status, uint8_t const numberOfValidDataBytesThisMessage, uint8_t const streamId, @@ -151,7 +151,7 @@ namespace winrt::Windows::Devices::Midi2::implementation timestamp, (uint32_t)( 0x5 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | internal::CleanupNibble((uint8_t)status) << 20 | internal::CleanupNibble(numberOfValidDataBytesThisMessage) << 16 | streamId << 8 | @@ -166,7 +166,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage128 MidiMessageBuilder::BuildMixedDataSetChunkHeaderMessage( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, uint8_t const mdsId, uint16_t const numberValidDataBytesInThisChunk, uint16_t const numberChunksInMixedDataSet, @@ -184,7 +184,7 @@ namespace winrt::Windows::Devices::Midi2::implementation // message type is 5. status is 8 word0 = 0x5 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | 0x8 << 20 | internal::CleanupNibble(mdsId) << 16 | numberValidDataBytesInThisChunk; @@ -214,7 +214,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage128 MidiMessageBuilder::BuildMixedDataSetChunkDataMessage( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, uint8_t const mdsId, uint8_t const dataByte00, uint8_t const dataByte01, @@ -239,7 +239,7 @@ namespace winrt::Windows::Devices::Midi2::implementation // message type is 5. status is 8 word0 = 0x5 << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | 0x9 << 20 | internal::CleanupNibble(mdsId) << 16 | dataByte00 << 8 | @@ -277,10 +277,10 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ midi2::MidiMessage128 MidiMessageBuilder::BuildFlexDataMessage( internal::MidiTimestamp const timestamp, - uint8_t const groupIndex, + midi2::MidiGroup const& group, uint8_t const form, uint8_t const address, - uint8_t const channel, + midi2::MidiChannel const& channel, uint8_t const statusBank, uint8_t const status, uint32_t const word1Data, @@ -291,10 +291,10 @@ namespace winrt::Windows::Devices::Midi2::implementation timestamp, (uint32_t)( 0xD << 28 | - internal::CleanupNibble(groupIndex) << 24 | + group.Index() << 24 | internal::CleanupCrumb(form) << 22 | internal::CleanupCrumb(address) << 20 | - internal::CleanupNibble(channel) << 16 | + channel.Index() << 16 | statusBank << 8 | status), word1Data, diff --git a/src/api/Client/Midi2Client/MidiMessageBuilder.h b/src/api/Client/Midi2Client/MidiMessageBuilder.h index bf4fd3c8..36dfd42a 100644 --- a/src/api/Client/Midi2Client/MidiMessageBuilder.h +++ b/src/api/Client/Midi2Client/MidiMessageBuilder.h @@ -22,23 +22,23 @@ namespace winrt::Windows::Devices::Midi2::implementation static midi2::MidiMessage32 BuildSystemMessage( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, + _In_ midi2::MidiGroup const& group, _In_ uint8_t const status, _In_ uint8_t const midi1Byte2, _In_ uint8_t const midi1Byte3) noexcept; static midi2::MidiMessage32 BuildMidi1ChannelVoiceMessage( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, + _In_ midi2::MidiGroup const& group, _In_ midi2::Midi1ChannelVoiceMessageStatus const& status, - _In_ uint8_t const channelIndex, - _In_ uint8_t const byte3, + _In_ midi2::MidiChannel const& channel, + _In_ uint8_t const byte3, _In_ uint8_t const byte4) noexcept; static midi2::MidiMessage64 BuildSystemExclusive7Message( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, - _In_ uint8_t const status, + _In_ midi2::MidiGroup const& group, + _In_ uint8_t const status, _In_ uint8_t const numberOfBytes, _In_ uint8_t const dataByte0, _In_ uint8_t const dataByte1, @@ -49,15 +49,15 @@ namespace winrt::Windows::Devices::Midi2::implementation static midi2::MidiMessage64 BuildMidi2ChannelVoiceMessage( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, + _In_ midi2::MidiGroup const& group, _In_ midi2::Midi2ChannelVoiceMessageStatus const& status, - _In_ uint8_t const channelIndex, + _In_ midi2::MidiChannel const& channel, _In_ uint16_t const index, _In_ uint32_t const data) noexcept; static midi2::MidiMessage128 BuildSystemExclusive8Message( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, + _In_ midi2::MidiGroup const& group, _In_ midi2::MidiSystemExclusive8Status const& status, _In_ uint8_t const numberOfValidDataBytesThisMessage, _In_ uint8_t const streamId, @@ -77,7 +77,7 @@ namespace winrt::Windows::Devices::Midi2::implementation static midi2::MidiMessage128 BuildMixedDataSetChunkHeaderMessage( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, + _In_ midi2::MidiGroup const& group, _In_ uint8_t const mdsId, _In_ uint16_t const numberValidDataBytesInThisChunk, _In_ uint16_t const numberChunksInMixedDataSet, @@ -89,8 +89,8 @@ namespace winrt::Windows::Devices::Midi2::implementation static midi2::MidiMessage128 BuildMixedDataSetChunkDataMessage( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, - _In_ uint8_t const mdsId, + _In_ midi2::MidiGroup const& group, + _In_ uint8_t const mdsId, _In_ uint8_t const dataByte00, _In_ uint8_t const dataByte01, _In_ uint8_t const dataByte02, @@ -108,10 +108,10 @@ namespace winrt::Windows::Devices::Midi2::implementation static midi2::MidiMessage128 BuildFlexDataMessage( _In_ internal::MidiTimestamp const timestamp, - _In_ uint8_t const groupIndex, + _In_ midi2::MidiGroup const& group, _In_ uint8_t const form, _In_ uint8_t const address, - _In_ uint8_t const channel, + _In_ midi2::MidiChannel const& channel, _In_ uint8_t const statusBank, _In_ uint8_t const status, _In_ uint32_t const word1Data, diff --git a/src/api/Client/Midi2Client/MidiMessageBuilder.idl b/src/api/Client/Midi2Client/MidiMessageBuilder.idl index a29bd1c2..32a498f0 100644 --- a/src/api/Client/Midi2Client/MidiMessageBuilder.idl +++ b/src/api/Client/Midi2Client/MidiMessageBuilder.idl @@ -18,6 +18,9 @@ import "MidiMessage64.idl"; import "MidiMessage96.idl"; import "MidiMessage128.idl"; +import "MidiGroup.idl"; +import "MidiChannel.idl"; + import "MidiSystemExclusive8StatusEnum.idl"; import "Midi1ChannelVoiceMessageStatusEnum.idl"; @@ -41,7 +44,7 @@ namespace Windows.Devices.Midi2 // Type 1 System common and System Real-time messages static MidiMessage32 BuildSystemMessage( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, + MidiGroup group, UInt8 status, UInt8 midi1Byte2, UInt8 midi1Byte3); @@ -49,9 +52,9 @@ namespace Windows.Devices.Midi2 // Type 2 MIDI 1.0 Channel Voice messages static MidiMessage32 BuildMidi1ChannelVoiceMessage( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, + MidiGroup group, Midi1ChannelVoiceMessageStatus status, - UInt8 channelIndex, + MidiChannel channel, UInt8 byte3, UInt8 byte4); @@ -59,8 +62,8 @@ namespace Windows.Devices.Midi2 [default_overload] static MidiMessage64 BuildSystemExclusive7Message( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, - UInt8 status, + MidiGroup group, + UInt8 status, UInt8 numberOfBytes, UInt8 dataByte0, UInt8 dataByte1, @@ -73,17 +76,17 @@ namespace Windows.Devices.Midi2 // Type 4 MIDI 2.0 Channel Voice message static MidiMessage64 BuildMidi2ChannelVoiceMessage( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, - Midi2ChannelVoiceMessageStatus status, - UInt8 channelIndex, - UInt16 index, + MidiGroup group, + Midi2ChannelVoiceMessageStatus status, + MidiChannel channel, + UInt16 index, UInt32 data); // Type 5 8-bit System Exclusive. SDK has more comprehensive SysEx management as these typically span multiple messages static MidiMessage128 BuildSystemExclusive8Message( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, - MidiSystemExclusive8Status status, + MidiGroup group, + MidiSystemExclusive8Status status, UInt8 numberOfValidDataBytesThisMessage, UInt8 streamId, UInt8 dataByte00, @@ -105,8 +108,8 @@ namespace Windows.Devices.Midi2 // Chunk header. Status = 0x8 static MidiMessage128 BuildMixedDataSetChunkHeaderMessage( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, - UInt8 mdsId, + MidiGroup group, + UInt8 mdsId, UInt16 numberValidDataBytesInThisChunk, UInt16 numberChunksInMixedDataSet, UInt16 numberOfThisChunk, @@ -118,8 +121,8 @@ namespace Windows.Devices.Midi2 // Chunk payload. Status = 0x9 static MidiMessage128 BuildMixedDataSetChunkDataMessage( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, - UInt8 mdsId, + MidiGroup group, + UInt8 mdsId, UInt8 dataByte00, UInt8 dataByte01, UInt8 dataByte02, @@ -138,10 +141,10 @@ namespace Windows.Devices.Midi2 // Type D Flex Data message static MidiMessage128 BuildFlexDataMessage( MIDI_TIMESTAMP timestamp, - UInt8 groupIndex, - UInt8 form, + MidiGroup group, + UInt8 form, UInt8 address, - UInt8 channel, + MidiChannel channel, UInt8 statusBank, UInt8 status, UInt32 word1Data, diff --git a/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.cpp b/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.cpp index 5beeed8d..e0c78a02 100644 --- a/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.cpp +++ b/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.cpp @@ -254,8 +254,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ uint8_t MidiMessageReceivedEventArgs::FillWordArray( - winrt::array_view words, - uint32_t const startIndex + uint32_t const startIndex, + winrt::array_view words ) { uint8_t messageWordCount = GetValidMessageWordCount(); @@ -278,8 +278,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ uint8_t MidiMessageReceivedEventArgs::FillByteArray( - winrt::array_view bytes, - uint32_t const startIndex + uint32_t const startIndex, + winrt::array_view bytes ) { uint8_t messageByteCount = GetValidMessageWordCount() * sizeof(uint32_t); @@ -304,8 +304,8 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ uint8_t MidiMessageReceivedEventArgs::FillBuffer( - foundation::IMemoryBuffer const& buffer, - uint32_t const byteOffset + uint32_t const byteOffset, + foundation::IMemoryBuffer const& buffer ) { try diff --git a/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.h b/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.h index 4cc9df97..b06f3042 100644 --- a/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.h +++ b/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.h @@ -61,16 +61,19 @@ namespace winrt::Windows::Devices::Midi2::implementation // https://devblogs.microsoft.com/oldnewthing/20200205-00/?p=103398/ uint8_t FillWordArray( - _In_ array_view words, - _In_ uint32_t const startIndex); + _In_ uint32_t const startIndex, + _In_ array_view words + ); uint8_t FillByteArray( - _In_ array_view bytes, - _In_ uint32_t const startIndex); + _In_ uint32_t const startIndex, + _In_ array_view bytes + ); uint8_t FillBuffer( - _In_ foundation::IMemoryBuffer const& buffer, - _In_ uint32_t const byteOffset); + _In_ uint32_t const byteOffset, + _In_ foundation::IMemoryBuffer const& buffer + ); private: uint8_t GetValidMessageWordCount() { return internal::GetUmpLengthInMidiWordsFromFirstWord(m_data.Word0); } diff --git a/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.idl b/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.idl index 81972ed6..d26a6a95 100644 --- a/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.idl +++ b/src/api/Client/Midi2Client/MidiMessageReceivedEventArgs.idl @@ -62,11 +62,11 @@ namespace Windows.Devices.Midi2 // Use existing arrays instead of allocating new ones. Array should be at least as large // as the UMP being read. Returns the count of elements written (Words in the case of the // first, and bytes in the case of the second) - UInt8 FillWordArray(ref UInt32[] words, UInt32 startIndex); - UInt8 FillByteArray(ref UInt8[] bytes, UInt32 startIndex); + UInt8 FillWordArray(UInt32 startIndex, ref UInt32[] words); + UInt8 FillByteArray(UInt32 startIndex, ref UInt8[] bytes); // Fill a spot in an existing IMemoryBuffer controlled by the caller. Returns the number of BYTES written - UInt8 FillBuffer(Windows.Foundation.IMemoryBuffer buffer, UInt32 byteOffset); + UInt8 FillBuffer(UInt32 byteOffset, Windows.Foundation.IMemoryBuffer buffer); } } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiMessageTypeEnum.idl b/src/api/Client/Midi2Client/MidiMessageTypeEnum.idl index e479b39a..1fecbcb3 100644 --- a/src/api/Client/Midi2Client/MidiMessageTypeEnum.idl +++ b/src/api/Client/Midi2Client/MidiMessageTypeEnum.idl @@ -15,21 +15,21 @@ namespace Windows.Devices.Midi2 [MIDI_API_CONTRACT(1)] enum MidiMessageType { - UtilityMessage32 = 0x0, - SystemCommon32 = 0x1, - Midi1ChannelVoice32 = 0x2, - DataMessage64 = 0x3, - Midi2ChannelVoice64 = 0x4, - DataMessage128 = 0x5, - FutureReserved632 = 0x6, - FutureReserved732 = 0x7, - FutureReserved864 = 0x8, - FutureReserved964 = 0x9, - FutureReservedA64 = 0xA, - FutureReservedB96 = 0xB, - FutureReservedC96 = 0xC, - FlexData128 = 0xD, - FutureReservedE128 = 0xE, - Stream128 = 0xF + UtilityMessage32 = 0x0, + SystemCommon32 = 0x1, + Midi1ChannelVoice32 = 0x2, + DataMessage64 = 0x3, + Midi2ChannelVoice64 = 0x4, + DataMessage128 = 0x5, + FutureReserved632 = 0x6, + FutureReserved732 = 0x7, + FutureReserved864 = 0x8, + FutureReserved964 = 0x9, + FutureReservedA64 = 0xA, + FutureReservedB96 = 0xB, + FutureReservedC96 = 0xC, + FlexData128 = 0xD, + FutureReservedE128 = 0xE, + Stream128 = 0xF }; } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiMessageUtility.cpp b/src/api/Client/Midi2Client/MidiMessageUtility.cpp index 23a9024f..c5347a74 100644 --- a/src/api/Client/Midi2Client/MidiMessageUtility.cpp +++ b/src/api/Client/Midi2Client/MidiMessageUtility.cpp @@ -15,81 +15,72 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ collections::IVector MidiMessageUtility::GetPacketListFromWordList( uint64_t const timestamp, - collections::IVectorView const& words) + collections::IIterable const& words) { - uint32_t index{ 0 }; - auto result = winrt::single_threaded_vector(); + auto iter = words.First(); - while (index < words.Size()) + while (iter.HasCurrent()) { - auto wordsLeft = words.Size() - index; + // auto wordsLeft = words.Size() - index; - uint8_t numWords = internal::GetUmpLengthInMidiWordsFromFirstWord(words.GetAt(index)); + uint8_t numWords = internal::GetUmpLengthInMidiWordsFromFirstWord(iter.Current()); if (numWords == 1) { MidiMessage32 ump{}; ump.Timestamp(timestamp); - ump.Word0(index + 0); + + ump.Word0(iter.Current()); + iter.MoveNext(); + result.Append(ump); - index += 1; } else if (numWords == 2) { - if (wordsLeft >= 2) - { - MidiMessage64 ump{}; - ump.Timestamp(timestamp); - ump.Word0(index + 0); - ump.Word1(index + 1); - result.Append(ump); - index += 2; - } - else - { - break; - } + MidiMessage64 ump{}; + ump.Timestamp(timestamp); + + ump.Word0(iter.Current()); + + if (iter.MoveNext()) ump.Word1(iter.Current()); else break; + + iter.MoveNext(); + + result.Append(ump); } else if (numWords == 3) { - if (wordsLeft >= 3) - { - MidiMessage96 ump{}; - ump.Timestamp(timestamp); - ump.Word0(index + 0); - ump.Word1(index + 1); - ump.Word2(index + 2); - result.Append(ump); - index += 3; - } - else - { - break; - } + MidiMessage96 ump{}; + ump.Timestamp(timestamp); + + ump.Word0(iter.Current()); + iter.MoveNext(); + + if (iter.MoveNext()) ump.Word1(iter.Current()); else break; + if (iter.MoveNext()) ump.Word2(iter.Current()); else break; + + iter.MoveNext(); + + result.Append(ump); } else if (numWords == 4) { - if (wordsLeft >= 4) - { + MidiMessage128 ump{}; + ump.Timestamp(timestamp); - MidiMessage128 ump{}; - ump.Timestamp(timestamp); - ump.Word0(index + 0); - ump.Word1(index + 1); - ump.Word2(index + 2); - ump.Word3(index + 3); - result.Append(ump); - index += 4; - } - else - { - break; - } + ump.Word0(iter.Current()); + iter.MoveNext(); + + if (iter.MoveNext()) ump.Word1(iter.Current()); else break; + if (iter.MoveNext()) ump.Word2(iter.Current()); else break; + if (iter.MoveNext()) ump.Word3(iter.Current()); else break; + + result.Append(ump); } } @@ -98,7 +89,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ collections::IVector MidiMessageUtility::GetWordListFromPacketList( - collections::IVectorView const& messages) + collections::IIterable const& messages) { // we're doing this the safe and easy way, but there's likely a more efficient way to copy the memory over diff --git a/src/api/Client/Midi2Client/MidiMessageUtility.h b/src/api/Client/Midi2Client/MidiMessageUtility.h index fdfa77f2..fbcbce41 100644 --- a/src/api/Client/Midi2Client/MidiMessageUtility.h +++ b/src/api/Client/Midi2Client/MidiMessageUtility.h @@ -58,8 +58,12 @@ namespace winrt::Windows::Devices::Midi2::implementation static uint8_t GetStatusBankFromFlexDataMessageFirstWord(_In_ uint32_t const word0) noexcept; static uint8_t GetStatusFromFlexDataMessageFirstWord(_In_ uint32_t const word0) noexcept; - static collections::IVector GetPacketListFromWordList(_In_ uint64_t const timestamp, _In_ collections::IVectorView const& words); - static collections::IVector GetWordListFromPacketList(_In_ collections::IVectorView const& messages); + static collections::IVector GetPacketListFromWordList( + _In_ uint64_t const timestamp, + _In_ collections::IIterable const& words); + + static collections::IVector GetWordListFromPacketList( + _In_ collections::IIterable const& messages); }; diff --git a/src/api/Client/Midi2Client/MidiMessageUtility.idl b/src/api/Client/Midi2Client/MidiMessageUtility.idl index 171a6d1a..d619fb62 100644 --- a/src/api/Client/Midi2Client/MidiMessageUtility.idl +++ b/src/api/Client/Midi2Client/MidiMessageUtility.idl @@ -68,7 +68,7 @@ namespace Windows.Devices.Midi2 static String GetMessageFriendlyNameFromFirstWord(UInt32 word0); - static IVector GetPacketListFromWordList(MIDI_TIMESTAMP timestamp, IVectorView words); - static IVector GetWordListFromPacketList(IVectorView words); + static IVector GetPacketListFromWordList(MIDI_TIMESTAMP timestamp, IIterable words); + static IVector GetWordListFromPacketList(IIterable words); }; } diff --git a/src/api/Client/Midi2Client/MidiPacketTypeEnum.idl b/src/api/Client/Midi2Client/MidiPacketTypeEnum.idl index e7b5b6c1..1deaf397 100644 --- a/src/api/Client/Midi2Client/MidiPacketTypeEnum.idl +++ b/src/api/Client/Midi2Client/MidiPacketTypeEnum.idl @@ -16,10 +16,10 @@ namespace Windows.Devices.Midi2 [MIDI_API_CONTRACT(1)] enum MidiPacketType { - UnknownOrInvalid = 0, - UniversalMidiPacket32 = 1, - UniversalMidiPacket64 = 2, - UniversalMidiPacket96 = 3, - UniversalMidiPacket128 = 4, + UnknownOrInvalid = 0, + UniversalMidiPacket32 = 1, + UniversalMidiPacket64 = 2, + UniversalMidiPacket96 = 3, + UniversalMidiPacket128 = 4, }; } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiService.cpp b/src/api/Client/Midi2Client/MidiService.cpp index 259bffb3..1bd71a8f 100644 --- a/src/api/Client/Midi2Client/MidiService.cpp +++ b/src/api/Client/Midi2Client/MidiService.cpp @@ -20,7 +20,9 @@ namespace winrt::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - midi2::MidiServicePingResponseSummary MidiService::PingService(uint8_t const pingCount, uint32_t timeoutMilliseconds) noexcept + midi2::MidiServicePingResponseSummary MidiService::PingService( + uint8_t const pingCount, + uint32_t timeoutMilliseconds) noexcept { internal::LogInfo(__FUNCTION__, L"Enter"); @@ -160,7 +162,7 @@ namespace winrt::Windows::Devices::Midi2::implementation pings[pingIndex] = response; // send the ping - endpoint.SendMessageWords(timestamp, request.Word0, pingSourceId, pingIndex, request.Padding); + endpoint.SendSingleMessageWords(timestamp, request.Word0, pingSourceId, pingIndex, request.Padding); //Sleep(0); } @@ -211,29 +213,29 @@ namespace winrt::Windows::Devices::Midi2::implementation - foundation::Collections::IVectorView MidiService::GetInstalledTransportPlugins() + foundation::Collections::IVector MidiService::GetInstalledTransportPlugins() { // TODO: Need to implement GetInstalledTransportPlugins. For now, return an empty collection instead of throwing // This can be read from the registry, but the additional metadata requires calling into the objects themselves - return winrt::single_threaded_vector().GetView(); + return winrt::single_threaded_vector(); } - foundation::Collections::IVectorView MidiService::GetInstalledMessageProcessingPlugins() + foundation::Collections::IVector MidiService::GetInstalledMessageProcessingPlugins() { // TODO: Need to implement GetInstalledMessageProcessingPlugins. For now, return an empty collection instead of throwing // This can be read from the registry, but the additional metadata requires calling into the objects themselves - return winrt::single_threaded_vector().GetView(); + return winrt::single_threaded_vector(); } - foundation::Collections::IVectorView MidiService::GetActiveSessions() noexcept + foundation::Collections::IVector MidiService::GetActiveSessions() noexcept { - auto sessionList = winrt::single_threaded_vector(); + auto sessionList = winrt::single_threaded_vector(); try { @@ -263,7 +265,7 @@ namespace winrt::Windows::Devices::Midi2::implementation if (jsonObject != nullptr) { - auto sessionJsonArray = internal::JsonGetArrayProperty(jsonObject, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ARRAY_PROPERTY_KEY); + auto sessionJsonArray = jsonObject.GetNamedArray(MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ARRAY_PROPERTY_KEY); GUID defaultGuid{}; std::chrono::time_point noTime; @@ -271,7 +273,7 @@ namespace winrt::Windows::Devices::Midi2::implementation for (uint32_t i = 0; i < sessionJsonArray.Size(); i++) { auto sessionJson = sessionJsonArray.GetObjectAt(i); - auto sessionObject = winrt::make_self(); + auto sessionObject = winrt::make_self(); // auto startTimeString = internal::JsonGetWStringProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_TIME_PROPERTY_KEY, L"").c_str(); @@ -279,29 +281,29 @@ namespace winrt::Windows::Devices::Midi2::implementation sessionObject->InternalInitialize( internal::JsonGetGuidProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ID_PROPERTY_KEY, defaultGuid), - internal::JsonGetWStringProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_NAME_PROPERTY_KEY, L"").c_str(), - std::stol(internal::JsonGetWStringProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_ID_PROPERTY_KEY, L"0")), - internal::JsonGetWStringProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_NAME_PROPERTY_KEY, L"").c_str(), + sessionJson.GetNamedString(MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_NAME_PROPERTY_KEY, L"").c_str(), + std::stol(sessionJson.GetNamedString(MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_ID_PROPERTY_KEY, L"0").c_str()), + sessionJson.GetNamedString(MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_NAME_PROPERTY_KEY, L"").c_str(), winrt::clock::from_sys(startTime) ); // Add connections - auto connectionsJsonArray = internal::JsonGetArrayProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ARRAY_PROPERTY_KEY); + auto connectionsJsonArray = sessionJson.GetNamedArray(MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ARRAY_PROPERTY_KEY, nullptr); - if (connectionsJsonArray.Size() > 0) + if (connectionsJsonArray != nullptr && connectionsJsonArray.Size() > 0) { for (uint32_t j = 0; j < connectionsJsonArray.Size(); j++) { auto connectionJson = connectionsJsonArray.GetObjectAt(j); - auto connectionObject = winrt::make_self(); + auto connectionObject = winrt::make_self(); auto earliestConnectionTime = internal::JsonGetDateTimeProperty(connectionJson, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_TIME_PROPERTY_KEY, noTime); connectionObject->InternalInitialize( - internal::JsonGetWStringProperty(connectionJson, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ENDPOINT_ID_PROPERTY_KEY, L"").c_str(), - (uint16_t)(internal::JsonGetDoubleProperty(connectionJson, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_COUNT_PROPERTY_KEY, 0)), + connectionJson.GetNamedString(MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ENDPOINT_ID_PROPERTY_KEY, L"").c_str(), + (uint16_t)(connectionJson.GetNamedNumber(MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_COUNT_PROPERTY_KEY, 0)), winrt::clock::from_sys(earliestConnectionTime) ); @@ -321,7 +323,7 @@ namespace winrt::Windows::Devices::Midi2::implementation internal::LogGeneralError(__FUNCTION__, L"Exception processing session tracker result json"); } - return sessionList.GetView(); + return sessionList; } @@ -374,80 +376,68 @@ namespace winrt::Windows::Devices::Midi2::implementation // build Endpoint A - internal::JsonSetWStringProperty( - endpointDeviceAObject, + endpointDeviceAObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, - endpointDefinitionA.Name().c_str()); + json::JsonValue::CreateStringValue(endpointDefinitionA.Name().c_str())); - internal::JsonSetWStringProperty( - endpointDeviceAObject, + endpointDeviceAObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, - endpointDefinitionA.Description().c_str()); + json::JsonValue::CreateStringValue(endpointDefinitionA.Description().c_str())); - internal::JsonSetWStringProperty( - endpointDeviceAObject, + endpointDeviceAObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, - endpointDefinitionA.UniqueId().c_str()); - + json::JsonValue::CreateStringValue(endpointDefinitionA.UniqueId().c_str())); //MIDI_CONFIG_JSON_ENDPOINT_COMMON_MANUFACTURER_PROPERTY // build Endpoint B - internal::JsonSetWStringProperty( - endpointDeviceBObject, + endpointDeviceBObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, - endpointDefinitionB.Name().c_str()); + json::JsonValue::CreateStringValue(endpointDefinitionB.Name().c_str())); - internal::JsonSetWStringProperty( - endpointDeviceBObject, + endpointDeviceBObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, - endpointDefinitionB.Description().c_str()); + json::JsonValue::CreateStringValue(endpointDefinitionB.Description().c_str())); - internal::JsonSetWStringProperty( - endpointDeviceBObject, + endpointDeviceBObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, - endpointDefinitionB.UniqueId().c_str()); + json::JsonValue::CreateStringValue(endpointDefinitionB.UniqueId().c_str())); + // create the association object with the two devices as children - internal::JsonSetObjectProperty( - endpointAssociationObject, + endpointAssociationObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_A_KEY, endpointDeviceAObject); - internal::JsonSetObjectProperty( - endpointAssociationObject, + endpointAssociationObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_B_KEY, endpointDeviceBObject); // create the creation node with the association object as the child property - internal::JsonSetObjectProperty( - endpointCreationObject, + endpointCreationObject.SetNamedValue( internal::GuidToString(associationId), endpointAssociationObject); // create the abstraction object with the child creation node - internal::JsonSetObjectProperty( - abstractionObject, + abstractionObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_CREATE_KEY, endpointCreationObject); // create the main node - internal::JsonSetObjectProperty( - topLevelTransportPluginSettingsObject, + topLevelTransportPluginSettingsObject.SetNamedValue( internal::GuidToString(loopbackDeviceAbstractionId), abstractionObject); // wrap it all up so the json is valid - internal::JsonSetObjectProperty( - wrapperObject, + wrapperObject.SetNamedValue( MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT, topLevelTransportPluginSettingsObject); @@ -456,14 +446,14 @@ namespace winrt::Windows::Devices::Midi2::implementation json::JsonObject responseObject = InternalSendConfigurationJsonAndGetResponse(loopbackDeviceAbstractionId, wrapperObject); // parse the results - auto successResult = internal::JsonGetBoolProperty(responseObject, MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, false); + auto successResult = responseObject.GetNamedBoolean(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, false); if (successResult) { internal::LogInfo(__FUNCTION__, L"JSON payload indicates success"); - auto deviceIdA = internal::JsonGetWStringProperty(responseObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_A_ID_KEY, L""); - auto deviceIdB = internal::JsonGetWStringProperty(responseObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_B_ID_KEY, L""); + auto deviceIdA = responseObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_A_ID_KEY, L""); + auto deviceIdB = responseObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_B_ID_KEY, L""); if (deviceIdA.empty()) { @@ -616,23 +606,20 @@ namespace winrt::Windows::Devices::Midi2::implementation // create the abstraction object with the child creation node - internal::JsonSetArrayProperty( - abstractionObject, + abstractionObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_REMOVE_KEY, endpointDeletionArray); // create the main node - internal::JsonSetObjectProperty( - topLevelTransportPluginSettingsObject, + topLevelTransportPluginSettingsObject.SetNamedValue( internal::GuidToString(loopbackDeviceAbstractionId), abstractionObject); // wrap it all up so the json is valid - internal::JsonSetObjectProperty( - wrapperObject, + wrapperObject.SetNamedValue( MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT, topLevelTransportPluginSettingsObject); @@ -645,7 +632,7 @@ namespace winrt::Windows::Devices::Midi2::implementation // parse the results - auto successResult = internal::JsonGetBoolProperty(responseObject, MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, false); + auto successResult = responseObject.GetNamedBoolean(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, false); if (successResult) { diff --git a/src/api/Client/Midi2Client/MidiService.h b/src/api/Client/Midi2Client/MidiService.h index 12352297..6c1df655 100644 --- a/src/api/Client/Midi2Client/MidiService.h +++ b/src/api/Client/Midi2Client/MidiService.h @@ -1,62 +1,62 @@ -// 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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once -#include "MidiService.g.h" - -namespace winrt::Windows::Devices::Midi2::implementation -{ - struct MidiService : MidiServiceT - { - MidiService() = default; - - static midi2::MidiServicePingResponseSummary PingService( - _In_ uint8_t const pingCount - ) noexcept; - - static midi2::MidiServicePingResponseSummary PingService( - _In_ uint8_t const pingCount, - _In_ uint32_t const timeoutMilliseconds - ) noexcept; - - static foundation::Collections::IVectorView GetInstalledTransportPlugins(); - static foundation::Collections::IVectorView GetInstalledMessageProcessingPlugins(); - -// static uint32_t GetOutgoingMessageQueueMaxMessageCapacity() noexcept { return (uint32_t)MIDI_OUTGOING_MESSAGE_QUEUE_MAX_MESSAGE_COUNT; } - - static foundation::Collections::IVectorView GetActiveSessions() noexcept; - - static midi2::MidiServiceLoopbackEndpointCreationResult CreateTemporaryLoopbackEndpoints( - _In_ winrt::guid const& associationId, - _In_ midi2::MidiServiceLoopbackEndpointDefinition const& endpointDefinitionA, - _In_ midi2::MidiServiceLoopbackEndpointDefinition const& endpointDefinitionB) noexcept; - - static bool RemoveTemporaryLoopbackEndpoints(_In_ winrt::guid const& associationId) noexcept; - - static midi2::MidiServiceConfigurationResponse UpdateTransportPluginConfiguration( - _In_ midi2::IMidiServiceTransportPluginConfiguration const& configurationUpdate) noexcept; - - static midi2::MidiServiceConfigurationResponse UpdateProcessingPluginConfiguration( - _In_ midi2::IMidiServiceMessageProcessingPluginConfiguration const& configurationUpdate) noexcept; - - - - - static json::JsonObject InternalSendConfigurationJsonAndGetResponse(_In_ winrt::guid const& abstractionId, _In_ json::JsonObject const& configObject) noexcept; - - private: - - - }; -} -namespace winrt::Windows::Devices::Midi2::factory_implementation -{ - struct MidiService : MidiServiceT - { - }; -} +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once +#include "MidiService.g.h" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiService : MidiServiceT + { + MidiService() = default; + + static midi2::MidiServicePingResponseSummary PingService( + _In_ uint8_t const pingCount + ) noexcept; + + static midi2::MidiServicePingResponseSummary PingService( + _In_ uint8_t const pingCount, + _In_ uint32_t const timeoutMilliseconds + ) noexcept; + + static foundation::Collections::IVector GetInstalledTransportPlugins(); + static foundation::Collections::IVector GetInstalledMessageProcessingPlugins(); + +// static uint32_t GetOutgoingMessageQueueMaxMessageCapacity() noexcept { return (uint32_t)MIDI_OUTGOING_MESSAGE_QUEUE_MAX_MESSAGE_COUNT; } + + static foundation::Collections::IVector GetActiveSessions() noexcept; + + static midi2::MidiServiceLoopbackEndpointCreationResult CreateTemporaryLoopbackEndpoints( + _In_ winrt::guid const& associationId, + _In_ midi2::MidiServiceLoopbackEndpointDefinition const& endpointDefinitionA, + _In_ midi2::MidiServiceLoopbackEndpointDefinition const& endpointDefinitionB) noexcept; + + static bool RemoveTemporaryLoopbackEndpoints(_In_ winrt::guid const& associationId) noexcept; + + static midi2::MidiServiceConfigurationResponse UpdateTransportPluginConfiguration( + _In_ midi2::IMidiServiceTransportPluginConfiguration const& configurationUpdate) noexcept; + + static midi2::MidiServiceConfigurationResponse UpdateProcessingPluginConfiguration( + _In_ midi2::IMidiServiceMessageProcessingPluginConfiguration const& configurationUpdate) noexcept; + + + + + static json::JsonObject InternalSendConfigurationJsonAndGetResponse(_In_ winrt::guid const& abstractionId, _In_ json::JsonObject const& configObject) noexcept; + + private: + + + }; +} +namespace winrt::Windows::Devices::Midi2::factory_implementation +{ + struct MidiService : MidiServiceT + { + }; +} diff --git a/src/api/Client/Midi2Client/MidiService.idl b/src/api/Client/Midi2Client/MidiService.idl index 1a4d21ca..9974a262 100644 --- a/src/api/Client/Midi2Client/MidiService.idl +++ b/src/api/Client/Midi2Client/MidiService.idl @@ -9,11 +9,11 @@ #include "midl_defines.h" MIDI_IDL_IMPORT -import "MidiServiceTransportPluginInformation.idl"; -import "MidiServiceMessageProcessingPluginInformation.idl"; +import "MidiServiceTransportPluginInfo.idl"; +import "MidiServiceMessageProcessingPluginInfo.idl"; import "MidiServicePingResponseSummary.idl"; -import "MidiServiceSessionInformation.idl"; +import "MidiServiceSessionInfo.idl"; import "MidiServiceLoopbackEndpointCreationResult.idl"; import "MidiServiceLoopbackEndpointDefinition.idl"; @@ -32,8 +32,8 @@ namespace Windows.Devices.Midi2 static MidiServicePingResponseSummary PingService(UInt8 pingCount, UInt32 timeoutMilliseconds); // list all the installed transports like Virtual, USB, BLE1, etc - static IVectorView GetInstalledTransportPlugins(); - static IVectorView GetInstalledMessageProcessingPlugins(); + static IVector GetInstalledTransportPlugins(); + static IVector GetInstalledMessageProcessingPlugins(); // for the first release, this will always return false. But developers want to be able @@ -44,7 +44,7 @@ namespace Windows.Devices.Midi2 // static UInt32 GetOutgoingMessageQueueMaxMessageCapacity(); - static IVectorView GetActiveSessions(); + static IVector GetActiveSessions(); // creates loopback endpoints that live for only as long as the service is running. diff --git a/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.cpp b/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.cpp similarity index 89% rename from src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.cpp rename to src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.cpp index 24ec9ad3..4a22bcb9 100644 --- a/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.cpp +++ b/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.cpp @@ -7,7 +7,7 @@ // ============================================================================ #include "pch.h" -#include "MidiServiceMessageProcessingPluginInformation.g.cpp" +#include "MidiServiceMessageProcessingPluginInfo.g.cpp" namespace winrt::Windows::Devices::Midi2::implementation { diff --git a/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.h b/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.h similarity index 86% rename from src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.h rename to src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.h index 2a9e430d..d68b3835 100644 --- a/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.h +++ b/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.h @@ -8,13 +8,13 @@ #pragma once -#include "MidiServiceMessageProcessingPluginInformation.g.h" +#include "MidiServiceMessageProcessingPluginInfo.g.h" namespace winrt::Windows::Devices::Midi2::implementation { - struct MidiServiceMessageProcessingPluginInformation : MidiServiceMessageProcessingPluginInformationT + struct MidiServiceMessageProcessingPluginInfo : MidiServiceMessageProcessingPluginInfoT { - MidiServiceMessageProcessingPluginInformation() = default; + MidiServiceMessageProcessingPluginInfo() = default; winrt::guid ClassId() const { return m_classId; } winrt::hstring RegistryKey() const { return m_registryKey; } diff --git a/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.idl b/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.idl similarity index 96% rename from src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.idl rename to src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.idl index feb4ef55..74eccf39 100644 --- a/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInformation.idl +++ b/src/api/Client/Midi2Client/MidiServiceMessageProcessingPluginInfo.idl @@ -14,7 +14,7 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiServiceMessageProcessingPluginInformation + runtimeclass MidiServiceMessageProcessingPluginInfo { Guid ClassId{ get; }; // from registry String RegistryKey{ get; }; // from registry diff --git a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.cpp b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.cpp similarity index 83% rename from src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.cpp rename to src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.cpp index 89a9f5de..231f6243 100644 --- a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.cpp +++ b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.cpp @@ -7,15 +7,15 @@ // ============================================================================ #include "pch.h" -#include "MidiServiceSessionConnectionInformation.h" -#include "MidiServiceSessionConnectionInformation.g.cpp" +#include "MidiServiceSessionConnectionInfo.h" +#include "MidiServiceSessionConnectionInfo.g.cpp" namespace winrt::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - void MidiServiceSessionConnectionInformation::InternalInitialize( + void MidiServiceSessionConnectionInfo::InternalInitialize( winrt::hstring const endpointDeviceId, uint16_t const instanceCount, foundation::DateTime const earliestConnectionTime diff --git a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.h b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.h similarity index 81% rename from src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.h rename to src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.h index cea19387..53adcfa4 100644 --- a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.h +++ b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.h @@ -7,14 +7,14 @@ // ============================================================================ #pragma once -#include "MidiServiceSessionConnectionInformation.g.h" +#include "MidiServiceSessionConnectionInfo.g.h" namespace winrt::Windows::Devices::Midi2::implementation { - struct MidiServiceSessionConnectionInformation : MidiServiceSessionConnectionInformationT + struct MidiServiceSessionConnectionInfo : MidiServiceSessionConnectionInfoT { - MidiServiceSessionConnectionInformation() = default; + MidiServiceSessionConnectionInfo() = default; winrt::hstring EndpointDeviceId() { return m_endpointDeviceId; } uint16_t InstanceCount() { return m_instanceCount; } diff --git a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.idl b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.idl similarity index 92% rename from src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.idl rename to src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.idl index 38370c90..51ab3726 100644 --- a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.idl +++ b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInfo.idl @@ -13,7 +13,7 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiServiceSessionConnectionInformation + runtimeclass MidiServiceSessionConnectionInfo { String EndpointDeviceId{ get; }; diff --git a/src/api/Client/Midi2Client/MidiServiceSessionInformation.cpp b/src/api/Client/Midi2Client/MidiServiceSessionInfo.cpp similarity index 77% rename from src/api/Client/Midi2Client/MidiServiceSessionInformation.cpp rename to src/api/Client/Midi2Client/MidiServiceSessionInfo.cpp index 7577ee30..cddb2b09 100644 --- a/src/api/Client/Midi2Client/MidiServiceSessionInformation.cpp +++ b/src/api/Client/Midi2Client/MidiServiceSessionInfo.cpp @@ -7,13 +7,13 @@ // ============================================================================ #include "pch.h" -#include "MidiServiceSessionInformation.h" -#include "MidiServiceSessionInformation.g.cpp" +#include "MidiServiceSessionInfo.h" +#include "MidiServiceSessionInfo.g.cpp" namespace winrt::Windows::Devices::Midi2::implementation { _Use_decl_annotations_ - void MidiServiceSessionInformation::InternalInitialize( + void MidiServiceSessionInfo::InternalInitialize( winrt::guid sessionId, winrt::hstring sessionName, uint64_t processId, @@ -28,8 +28,8 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - void MidiServiceSessionInformation::InternalAddConnection( - midi2::MidiServiceSessionConnectionInformation const& info + void MidiServiceSessionInfo::InternalAddConnection( + midi2::MidiServiceSessionConnectionInfo const& info ) { m_connections.Append(info); diff --git a/src/api/Client/Midi2Client/MidiServiceSessionInformation.h b/src/api/Client/Midi2Client/MidiServiceSessionInfo.h similarity index 75% rename from src/api/Client/Midi2Client/MidiServiceSessionInformation.h rename to src/api/Client/Midi2Client/MidiServiceSessionInfo.h index f50c8601..569559e1 100644 --- a/src/api/Client/Midi2Client/MidiServiceSessionInformation.h +++ b/src/api/Client/Midi2Client/MidiServiceSessionInfo.h @@ -7,14 +7,14 @@ // ============================================================================ #pragma once -#include "MidiServiceSessionInformation.g.h" +#include "MidiServiceSessionInfo.g.h" namespace winrt::Windows::Devices::Midi2::implementation { - struct MidiServiceSessionInformation : MidiServiceSessionInformationT + struct MidiServiceSessionInfo : MidiServiceSessionInfoT { - MidiServiceSessionInformation() = default; + MidiServiceSessionInfo() = default; winrt::guid SessionId() { return m_sessionId; } uint64_t ProcessId() { return m_processId; } @@ -22,7 +22,7 @@ namespace winrt::Windows::Devices::Midi2::implementation winrt::hstring SessionName() { return m_sessionName; } foundation::DateTime StartTime() { return m_startTime; } - collections::IVectorView Connections() { return m_connections.GetView(); } + collections::IVector Connections() { return m_connections; } void InternalInitialize( _In_ winrt::guid sessionId, @@ -33,7 +33,7 @@ namespace winrt::Windows::Devices::Midi2::implementation ); void InternalAddConnection( - _In_ midi2::MidiServiceSessionConnectionInformation const& info + _In_ midi2::MidiServiceSessionConnectionInfo const& info ); private: @@ -43,8 +43,8 @@ namespace winrt::Windows::Devices::Midi2::implementation winrt::hstring m_sessionName{}; foundation::DateTime m_startTime{}; - foundation::Collections::IVector - m_connections{ winrt::single_threaded_vector() }; + foundation::Collections::IVector + m_connections{ winrt::single_threaded_vector() }; }; diff --git a/src/api/Client/Midi2Client/MidiServiceSessionInformation.idl b/src/api/Client/Midi2Client/MidiServiceSessionInfo.idl similarity index 80% rename from src/api/Client/Midi2Client/MidiServiceSessionInformation.idl rename to src/api/Client/Midi2Client/MidiServiceSessionInfo.idl index efee151c..c486a72c 100644 --- a/src/api/Client/Midi2Client/MidiServiceSessionInformation.idl +++ b/src/api/Client/Midi2Client/MidiServiceSessionInfo.idl @@ -9,13 +9,13 @@ #include "midl_defines.h" MIDI_IDL_IMPORT -import "MidiServiceSessionConnectionInformation.idl"; +import "MidiServiceSessionConnectionInfo.idl"; namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiServiceSessionInformation + runtimeclass MidiServiceSessionInfo { Guid SessionId{ get; }; @@ -26,6 +26,6 @@ namespace Windows.Devices.Midi2 Windows.Foundation.DateTime StartTime{ get; }; - IVectorView Connections{ get; }; + IVector Connections{ get; }; } } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.cpp b/src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.cpp similarity index 90% rename from src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.cpp rename to src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.cpp index aebcca72..8ffb206f 100644 --- a/src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.cpp +++ b/src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.cpp @@ -7,7 +7,7 @@ // ============================================================================ #include "pch.h" -#include "MidiServiceTransportPluginInformation.g.cpp" +#include "MidiServiceTransportPluginInfo.g.cpp" namespace winrt::Windows::Devices::Midi2::implementation { diff --git a/src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.h b/src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.h similarity index 89% rename from src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.h rename to src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.h index 0c946ec0..74ba534a 100644 --- a/src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.h +++ b/src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.h @@ -7,13 +7,13 @@ // ============================================================================ #pragma once -#include "MidiServiceTransportPluginInformation.g.h" +#include "MidiServiceTransportPluginInfo.g.h" namespace winrt::Windows::Devices::Midi2::implementation { - struct MidiServiceTransportPluginInformation : MidiServiceTransportPluginInformationT + struct MidiServiceTransportPluginInfo : MidiServiceTransportPluginInfoT { - MidiServiceTransportPluginInformation() = default; + MidiServiceTransportPluginInfo() = default; winrt::guid ClassId() const { return m_classId; } winrt::hstring RegistryKey() const { return m_registryKey; } diff --git a/src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.idl b/src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.idl similarity index 96% rename from src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.idl rename to src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.idl index 5f416ad7..e46bf688 100644 --- a/src/api/Client/Midi2Client/MidiServiceTransportPluginInformation.idl +++ b/src/api/Client/Midi2Client/MidiServiceTransportPluginInfo.idl @@ -14,7 +14,7 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiServiceTransportPluginInformation + runtimeclass MidiServiceTransportPluginInfo { Guid ClassId{ get; }; // from registry String RegistryKey{ get; }; // from registry diff --git a/src/api/Client/Midi2Client/MidiSession.cpp b/src/api/Client/Midi2Client/MidiSession.cpp index ab3603f8..c0ce2186 100644 --- a/src/api/Client/Midi2Client/MidiSession.cpp +++ b/src/api/Client/Midi2Client/MidiSession.cpp @@ -232,21 +232,19 @@ namespace winrt::Windows::Devices::Midi2::implementation MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_ASSOCIATION_ID_PROPERTY_KEY, associationGuid); - internal::JsonSetWStringProperty( - endpointDefinitionObject, + + endpointDefinitionObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, - deviceDefinition.EndpointProductInstanceId().c_str()); + json::JsonValue::CreateStringValue(deviceDefinition.EndpointProductInstanceId().c_str())); - internal::JsonSetWStringProperty( - endpointDefinitionObject, + endpointDefinitionObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, - deviceDefinition.EndpointName().c_str()); + json::JsonValue::CreateStringValue(deviceDefinition.EndpointName().c_str())); - internal::JsonSetWStringProperty( - endpointDefinitionObject, + endpointDefinitionObject.SetNamedValue( MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, - deviceDefinition.TransportSuppliedDescription().c_str()); - + json::JsonValue::CreateStringValue(deviceDefinition.TransportSuppliedDescription().c_str())); + // TODO: Other props that have to be set at the service level and not in-protocol @@ -357,15 +355,15 @@ namespace winrt::Windows::Devices::Midi2::implementation internal::LogInfo(__FUNCTION__, L"JsonObjectFromBSTR success"); // check for actual success - auto successResult = internal::JsonGetBoolProperty(responseObject, MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, false); + auto successResult = responseObject.GetNamedBoolean(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, false); if (successResult) { internal::LogInfo(__FUNCTION__, L"JSON payload indicates success"); - auto responseArray = internal::JsonGetArrayProperty(responseObject, MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_DEVICES_ARRAY_KEY); + auto responseArray = responseObject.GetNamedArray(MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_DEVICES_ARRAY_KEY, nullptr); - if (responseArray.Size() == 0) + if (responseArray != nullptr && responseArray.Size() == 0) { internal::LogGeneralError(__FUNCTION__, L"Unexpected empty response array"); @@ -376,8 +374,7 @@ namespace winrt::Windows::Devices::Midi2::implementation auto firstObject = responseArray.GetObjectAt(0); - endpointDeviceId = internal::JsonGetWStringProperty( - firstObject, + firstObject.GetNamedString( MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_ID_PROPERTY_KEY, L""); diff --git a/src/api/Client/Midi2Client/MidiStreamMessageBuilder.cpp b/src/api/Client/Midi2Client/MidiStreamMessageBuilder.cpp index bfba612b..dfb9ccbe 100644 --- a/src/api/Client/Midi2Client/MidiStreamMessageBuilder.cpp +++ b/src/api/Client/Midi2Client/MidiStreamMessageBuilder.cpp @@ -21,7 +21,7 @@ namespace winrt::Windows::Devices::Midi2::implementation internal::MidiTimestamp const timestamp, uint8_t const umpVersionMajor, uint8_t const umpVersionMinor, - midi2::MidiEndpointDiscoveryFilterFlags const requestFlags + midi2::MidiEndpointDiscoveryRequests const requestFlags ) noexcept { return MidiMessageBuilder::BuildStreamMessage( @@ -37,7 +37,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - midi2::IMidiUniversalPacket MidiStreamMessageBuilder::BuildEndpointInformationNotificationMessage( + midi2::IMidiUniversalPacket MidiStreamMessageBuilder::BuildEndpointInfoNotificationMessage( internal::MidiTimestamp const timestamp, uint8_t const umpVersionMajor, uint8_t const umpVersionMinor, @@ -362,7 +362,7 @@ namespace winrt::Windows::Devices::Midi2::implementation midi2::IMidiUniversalPacket MidiStreamMessageBuilder::BuildFunctionBlockDiscoveryMessage( internal::MidiTimestamp const timestamp, uint8_t const functionBlockNumber, - midi2::MidiFunctionBlockDiscoveryFilterFlags const requestFlags + midi2::MidiFunctionBlockDiscoveryRequests const requestFlags ) { uint16_t word0Remaining{ 0 }; @@ -454,7 +454,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ winrt::hstring MidiStreamMessageBuilder::ParseFunctionBlockNameNotificationMessages( - collections::IVector messages + collections::IIterable const& messages ) { std::string s{}; @@ -498,7 +498,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ winrt::hstring MidiStreamMessageBuilder::ParseEndpointNameNotificationMessages( - collections::IVector messages + collections::IIterable const& messages ) { std::string s{}; @@ -541,7 +541,7 @@ namespace winrt::Windows::Devices::Midi2::implementation _Use_decl_annotations_ winrt::hstring MidiStreamMessageBuilder::ParseProductInstanceIdNotificationMessages( - collections::IVector messages + collections::IIterable const& messages ) { std::string s{}; diff --git a/src/api/Client/Midi2Client/MidiStreamMessageBuilder.h b/src/api/Client/Midi2Client/MidiStreamMessageBuilder.h index c2263463..305614b3 100644 --- a/src/api/Client/Midi2Client/MidiStreamMessageBuilder.h +++ b/src/api/Client/Midi2Client/MidiStreamMessageBuilder.h @@ -20,10 +20,10 @@ namespace winrt::Windows::Devices::Midi2::implementation _In_ internal::MidiTimestamp const timestamp, _In_ uint8_t const umpVersionMajor, _In_ uint8_t const umpVersionMinor, - _In_ midi2::MidiEndpointDiscoveryFilterFlags const requestFlags + _In_ midi2::MidiEndpointDiscoveryRequests const requestFlags ) noexcept; - static midi2::IMidiUniversalPacket BuildEndpointInformationNotificationMessage( + static midi2::IMidiUniversalPacket BuildEndpointInfoNotificationMessage( _In_ internal::MidiTimestamp const timestamp, _In_ uint8_t const umpVersionMajor, _In_ uint8_t const umpVersionMinor, @@ -76,11 +76,11 @@ namespace winrt::Windows::Devices::Midi2::implementation static winrt::hstring ParseEndpointNameNotificationMessages( - _In_ collections::IVector messages + _In_ collections::IIterable const& messages ); static winrt::hstring ParseProductInstanceIdNotificationMessages( - _In_ collections::IVector messages + _In_ collections::IIterable const& messages ); @@ -89,7 +89,7 @@ namespace winrt::Windows::Devices::Midi2::implementation static midi2::IMidiUniversalPacket BuildFunctionBlockDiscoveryMessage( _In_ internal::MidiTimestamp const timestamp, _In_ uint8_t const functionBlockNumber, - _In_ midi2::MidiFunctionBlockDiscoveryFilterFlags requestFlags + _In_ midi2::MidiFunctionBlockDiscoveryRequests requestFlags ); static midi2::IMidiUniversalPacket BuildFunctionBlockInfoNotificationMessage( @@ -113,7 +113,7 @@ namespace winrt::Windows::Devices::Midi2::implementation static winrt::hstring ParseFunctionBlockNameNotificationMessages( - _In_ collections::IVector messages + _In_ collections::IIterable const& messages ); diff --git a/src/api/Client/Midi2Client/MidiStreamMessageBuilder.idl b/src/api/Client/Midi2Client/MidiStreamMessageBuilder.idl index eb71c293..82c31608 100644 --- a/src/api/Client/Midi2Client/MidiStreamMessageBuilder.idl +++ b/src/api/Client/Midi2Client/MidiStreamMessageBuilder.idl @@ -16,8 +16,8 @@ import "MidiMessage128.idl"; import "MidiFunctionBlockUIHintEnum.idl"; import "MidiFunctionBlockMidi10Enum.idl"; import "MidiFunctionBlockDirectionEnum.idl"; -import "MidiEndpointDiscoveryFilterFlagsEnum.idl"; -import "MidiFunctionBlockDiscoveryFilterFlagsEnum.idl"; +import "MidiEndpointDiscoveryRequestsEnum.idl"; +import "MidiFunctionBlockDiscoveryRequestsEnum.idl"; namespace Windows.Devices.Midi2 { @@ -28,10 +28,10 @@ namespace Windows.Devices.Midi2 MIDI_TIMESTAMP timestamp, UInt8 umpVersionMajor, UInt8 umpVersionMinor, - MidiEndpointDiscoveryFilterFlags requestFlags + MidiEndpointDiscoveryRequests requestFlags ); - static IMidiUniversalPacket BuildEndpointInformationNotificationMessage( + static IMidiUniversalPacket BuildEndpointInfoNotificationMessage( MIDI_TIMESTAMP timestamp, UInt8 umpVersionMajor, UInt8 umpVersionMinor, @@ -71,11 +71,11 @@ namespace Windows.Devices.Midi2 static String ParseEndpointNameNotificationMessages( - IVector messages + IIterable messages ); static String ParseProductInstanceIdNotificationMessages( - IVector messages + IIterable messages ); @@ -101,7 +101,7 @@ namespace Windows.Devices.Midi2 static IMidiUniversalPacket BuildFunctionBlockDiscoveryMessage( MIDI_TIMESTAMP timestamp, UInt8 functionBlockNumber, - MidiFunctionBlockDiscoveryFilterFlags requestFlags + MidiFunctionBlockDiscoveryRequests requestFlags ); static IMidiUniversalPacket BuildFunctionBlockInfoNotificationMessage( @@ -124,7 +124,7 @@ namespace Windows.Devices.Midi2 ); static String ParseFunctionBlockNameNotificationMessages( - IVector messages + IIterable messages ); }; diff --git a/src/api/Client/Midi2Client/MidiSystemExclusive8StatusEnum.idl b/src/api/Client/Midi2Client/MidiSystemExclusive8StatusEnum.idl index ed6208fc..371c0ff5 100644 --- a/src/api/Client/Midi2Client/MidiSystemExclusive8StatusEnum.idl +++ b/src/api/Client/Midi2Client/MidiSystemExclusive8StatusEnum.idl @@ -14,9 +14,9 @@ namespace Windows.Devices.Midi2 [MIDI_API_CONTRACT(1)] enum MidiSystemExclusive8Status { - CompleteMessageInSingleMessagePacket = 0x0, - StartMessagePacket = 0x1, - ContinueMessagePacket = 0x2, - EndMessagePacket = 0x3, + CompleteMessageInSingleMessagePacket = 0x0, + StartMessagePacket = 0x1, + ContinueMessagePacket = 0x2, + EndMessagePacket = 0x3, }; } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiUniqueId.cpp b/src/api/Client/Midi2Client/MidiUniqueId.cpp index 82706da6..44b3e6fb 100644 --- a/src/api/Client/Midi2Client/MidiUniqueId.cpp +++ b/src/api/Client/Midi2Client/MidiUniqueId.cpp @@ -29,7 +29,7 @@ namespace winrt::Windows::Devices::Midi2::implementation return MidiUniqueId(val); } - uint32_t MidiUniqueId::As28BitInteger() const noexcept + uint32_t MidiUniqueId::AsCombined28BitValue() const noexcept { // the MUID is 4 bytes but in LSB->MSB order with Byte1 being the LSB @@ -45,11 +45,11 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - MidiUniqueId::MidiUniqueId(uint32_t const integer28bit) noexcept + MidiUniqueId::MidiUniqueId(uint32_t const combined28BitValue) noexcept { // the MUID is 4 bytes but in LSB->MSB order with Byte1 being the LSB - uint32_t val = integer28bit & 0x0FFFFFFF; + uint32_t val = combined28BitValue & 0x0FFFFFFF; Byte1(val & 0x7F); diff --git a/src/api/Client/Midi2Client/MidiUniqueId.h b/src/api/Client/Midi2Client/MidiUniqueId.h index 73fde40a..a9446e23 100644 --- a/src/api/Client/Midi2Client/MidiUniqueId.h +++ b/src/api/Client/Midi2Client/MidiUniqueId.h @@ -37,7 +37,7 @@ namespace winrt::Windows::Devices::Midi2::implementation Byte4(sevenBitByte4); } - MidiUniqueId(_In_ uint32_t const integer28bit) noexcept; + MidiUniqueId(_In_ uint32_t const combined28BitValue) noexcept; static midi2::MidiUniqueId CreateBroadcast(); @@ -58,10 +58,10 @@ namespace winrt::Windows::Devices::Midi2::implementation static winrt::hstring LabelShort() { return internal::ResourceManager::GetHString(IDS_MIDI_COMMON_LABEL_MUID_SHORT); } static winrt::hstring LabelFull() { return internal::ResourceManager::GetHString(IDS_MIDI_COMMON_LABEL_MUID_FULL); } - uint32_t As28BitInteger() const noexcept; + uint32_t AsCombined28BitValue () const noexcept; - bool IsBroadcast() noexcept { return (As28BitInteger() == MIDI_MUID_BROADCAST); } - bool IsReserved() noexcept { return As28BitInteger() >= MIDI_MUID_RESERVED_START && As28BitInteger() <= MIDI_MUID_RESERVED_END; } + bool IsBroadcast() noexcept { return (AsCombined28BitValue() == MIDI_MUID_BROADCAST); } + bool IsReserved() noexcept { return AsCombined28BitValue() >= MIDI_MUID_RESERVED_START && AsCombined28BitValue() <= MIDI_MUID_RESERVED_END; } private: uint8_t m_byte1{}; // byte 1 is LSB diff --git a/src/api/Client/Midi2Client/MidiUniqueId.idl b/src/api/Client/Midi2Client/MidiUniqueId.idl index 0223f1d7..ffd4c843 100644 --- a/src/api/Client/Midi2Client/MidiUniqueId.idl +++ b/src/api/Client/Midi2Client/MidiUniqueId.idl @@ -24,7 +24,7 @@ namespace Windows.Devices.Midi2 { // byte 1 is LSB according to spec MidiUniqueId(); - MidiUniqueId(UInt32 integer28bit); + MidiUniqueId(UInt32 combined28BitValue); MidiUniqueId(UInt8 sevenBitByte1, UInt8 sevenBitByte2, UInt8 sevenBitByte3, UInt8 sevenBitByte4); static String LabelShort{ get; }; @@ -43,7 +43,7 @@ namespace Windows.Devices.Midi2 UInt8 Byte3{ get; set; }; UInt8 Byte4{ get; set; }; - UInt32 As28BitInteger{ get; }; + UInt32 AsCombined28BitValue{ get; }; Boolean IsBroadcast{ get; }; Boolean IsReserved{ get; }; diff --git a/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.cpp b/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.cpp index 104e6416..b046843f 100644 --- a/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.cpp +++ b/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.cpp @@ -78,7 +78,7 @@ namespace winrt::Windows::Devices::Midi2::implementation ); // TODO: Log if failed - if (midi2::MidiEndpointConnection::SendMessageFailed(m_endpointConnection.SendMessagePacket(functionBlockNotification))) + if (midi2::MidiEndpointConnection::SendMessageFailed(m_endpointConnection.SendSingleMessagePacket(functionBlockNotification))) { internal::LogGeneralError(__FUNCTION__, L"SendMessagePacket failed"); } @@ -130,7 +130,7 @@ namespace winrt::Windows::Devices::Midi2::implementation // send endpoint info notification - auto notification = midi2::MidiStreamMessageBuilder::BuildEndpointInformationNotificationMessage( + auto notification = midi2::MidiStreamMessageBuilder::BuildEndpointInfoNotificationMessage( MidiClock::TimestampConstantSendImmediately(), MIDI_PREFERRED_UMP_VERSION_MAJOR, MIDI_PREFERRED_UMP_VERSION_MINOR, @@ -142,7 +142,7 @@ namespace winrt::Windows::Devices::Midi2::implementation false // todo: pull from jr timestamp handling ); - if (midi2::MidiEndpointConnection::SendMessageFailed(m_endpointConnection.SendMessagePacket(notification))) + if (midi2::MidiEndpointConnection::SendMessageFailed(m_endpointConnection.SendSingleMessagePacket(notification))) { internal::LogGeneralError(__FUNCTION__, L"SendMessagePacket failed - sending endpoint info notification"); } diff --git a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj index 986dd8c9..d2a19a53 100644 --- a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj +++ b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj @@ -11,7 +11,7 @@ true C++/WinRT true - 10.0.20348.0 + 10.0 10.0.20348.0 true en-US @@ -165,7 +165,7 @@ _DEBUG;%(PreprocessorDefinitions);WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP - stdcpp17 + stdcpp20 false true true @@ -173,23 +173,23 @@ $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;%(AdditionalIncludeDirectories) $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;%(AdditionalIncludeDirectories) $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;%(AdditionalIncludeDirectories) - stdcpp17 - stdcpp17 + stdcpp20 + stdcpp20 false false - AbstractionUtilities.lib;%(AdditionalDependencies) + %(AdditionalDependencies) false false - AbstractionUtilities.lib;%(AdditionalDependencies) + %(AdditionalDependencies) false false - AbstractionUtilities.lib;%(AdditionalDependencies) + %(AdditionalDependencies) @@ -222,9 +222,9 @@ true true true - stdcpp17 - stdcpp17 - stdcpp17 + stdcpp20 + stdcpp20 + stdcpp20 true @@ -232,9 +232,9 @@ false false false - AbstractionUtilities.lib;%(AdditionalDependencies) - AbstractionUtilities.lib;%(AdditionalDependencies) - AbstractionUtilities.lib;%(AdditionalDependencies) + %(AdditionalDependencies) + %(AdditionalDependencies) + %(AdditionalDependencies) @@ -266,8 +266,14 @@ MidiEndpointDeviceInformation.idl - - MidiEndpointDeviceInformationUpdateEventArgs.idl + + MidiEndpointDeviceInformationAddedEventArgs.idl + + + MidiEndpointDeviceInformationUpdatedEventArgs.idl + + + MidiEndpointDeviceInformationRemovedEventArgs.idl MidiEndpointDeviceWatcher.idl @@ -290,8 +296,8 @@ MidiServiceLoopbackEndpointDefinition.idl - - MidiServiceMessageProcessingPluginInformation.idl + + MidiServiceMessageProcessingPluginInfo.idl MidiService.idl @@ -326,11 +332,11 @@ MidiMessageTypeEndpointListener.idl - - MidiServiceSessionConnectionInformation.idl + + MidiServiceSessionConnectionInfo.idl - - MidiServiceSessionInformation.idl + + MidiServiceSessionInfo.idl MidiSessionSettings.idl @@ -341,8 +347,8 @@ MidiStreamMessageBuilder.idl - - MidiServiceTransportPluginInformation.idl + + MidiServiceTransportPluginInfo.idl MidiMessage128.idl @@ -385,23 +391,29 @@ MidiEndpointConnection.idl - - MidiEndpointConnection.idl - - - MidiEndpointConnection.idl - - - MidiEndpointConnection.idl - - - MidiEndpointConnection.idl - + + MidiEndpointConnection.idl + + + MidiEndpointConnection.idl + + + MidiEndpointConnection.idl + + + MidiEndpointConnection.idl + MidiEndpointDeviceInformation.idl - - MidiEndpointDeviceInformationUpdateEventArgs.idl + + MidiEndpointDeviceInformationAddedEventArgs.idl + + + MidiEndpointDeviceInformationRemovedEventArgs.idl + + + MidiEndpointDeviceInformationUpdatedEventArgs.idl MidiEndpointDeviceWatcher.idl @@ -424,8 +436,8 @@ MidiServiceLoopbackEndpointDefinition.idl - - MidiServiceMessageProcessingPluginInformation.idl + + MidiServiceMessageProcessingPluginInfo.idl MidiService.idl @@ -460,11 +472,11 @@ MidiMessageTypeEndpointListener.idl - - MidiServiceSessionConnectionInformation.idl + + MidiServiceSessionConnectionInfo.idl - - MidiServiceSessionInformation.idl + + MidiServiceSessionInfo.idl MidiSessionSettings.idl @@ -478,8 +490,8 @@ MidiStreamMessageBuilder.idl - - MidiServiceTransportPluginInformation.idl + + MidiServiceTransportPluginInfo.idl MidiMessage128.idl @@ -517,24 +529,26 @@ + + - + - + - + - + @@ -547,7 +561,7 @@ - + @@ -559,15 +573,15 @@ - - + + - + diff --git a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters index dea376ef..90f79e82 100644 --- a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters +++ b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters @@ -94,6 +94,15 @@ {2a7feacb-d6cd-45d7-a7a1-754e28d34e2d} + + {545b29a1-8b94-401a-9614-8467c4e00f99} + + + {75e414e5-ade8-4844-916c-ca516268a935} + + + {d66b1849-1069-4d62-8b59-ab98a3199a90} + @@ -162,12 +171,6 @@ Internal\Resources - - API\Enumeration - - - API\Enumeration - API\Endpoints\Message Processing Plugins\Stock Plugins\Virtual Device @@ -192,6 +195,15 @@ API\Endpoints\Connections + + API\Enumeration + + + API\Enumeration + + + API\Enumeration\DeviceInformation + @@ -270,12 +282,6 @@ Internal\Resources - - API\Enumeration - - - API\Enumeration - API\Endpoints\Message Processing Plugins\Stock Plugins\Virtual Device @@ -288,6 +294,15 @@ API\Service\Configuration + + API\Enumeration + + + API\Enumeration + + + API\Enumeration\DeviceInformation + @@ -374,12 +389,6 @@ API\Messages\Enum - - API\Messages\Enum - - - API\Messages\Enum - API\Messages\Enum @@ -395,12 +404,6 @@ API\Transports - - API\Enumeration - - - API\Enumeration - API\Endpoints\Metadata\Blocks @@ -413,24 +416,12 @@ API\Endpoints\Metadata\Blocks - - API\Enumeration - - - API\Enumeration - API\Messages\Utility API\BasicTypes - - API\Enumeration - - - API\Enumeration - API\Endpoints\Message Processing Plugins\Stock Plugins\Virtual Device @@ -461,12 +452,6 @@ API\Service\Runtime Endpoints - - API\Service\Reporting - - - API\Service\Reporting - API\Service\Configuration @@ -479,8 +464,48 @@ API\Service\Configuration - - + + API\Service\Reporting + + + API\Service\Reporting + + + API\Service\Reporting + + + API\Service\Reporting + + + API\Messages\Enum + + + API\Messages\Enum + + + API\Enumeration\Watcher + + + API\Enumeration\Watcher + + + API\Enumeration\Watcher + + + API\Enumeration\Watcher + + + API\Enumeration\Enum + + + API\Enumeration\Enum + + + API\Enumeration\Enum + + + API\Enumeration\DeviceInformation + diff --git a/src/api/Client/Midi2Client/pch.h b/src/api/Client/Midi2Client/pch.h index e76ca30f..f51d555c 100644 --- a/src/api/Client/Midi2Client/pch.h +++ b/src/api/Client/Midi2Client/pch.h @@ -49,12 +49,8 @@ namespace json = ::winrt::Windows::Data::Json; #include "ump_helpers.h" #include "memory_buffer.h" #include "wstring_util.h" -#include "hstring_util.h" // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" // shared #include "midi_ump.h" // general shared @@ -66,8 +62,20 @@ namespace json = ::winrt::Windows::Data::Json; namespace foundation = ::winrt::Windows::Foundation; namespace collections = ::winrt::Windows::Foundation::Collections; +#include "hstring_util.h" +#include "wstring_util.h" namespace internal = ::Windows::Devices::Midi2::Internal; +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" + +//#include "MidiXProc.h" #include "resource.h" #include "ResourceManager.h" @@ -99,22 +107,28 @@ namespace midi2 = ::winrt::Windows::Devices::Midi2; #include "MidiEndpointConnection.h" #include "MidiMessageReceivedEventArgs.h" -#include "MidiEndpointDeviceInformationUpdateEventArgs.h" + +#include "MidiEndpointDeviceInformation.h" +#include "MidiEndpointDeviceInformationAddedEventArgs.h" +#include "MidiEndpointDeviceInformationUpdatedEventArgs.h" +#include "MidiEndpointDeviceInformationRemovedEventArgs.h" +#include "MidiEndpointDeviceWatcher.h" #include "MidiVirtualEndpointDevice.h" #include "MidiVirtualEndpointDeviceDefinition.h" + #include "MidiSession.h" #include "MidiServicePingResponse.h" #include "MidiServicePingResponseSummary.h" -#include "MidiServiceTransportPluginInformation.h" -#include "MidiServiceMessageProcessingPluginInformation.h" +#include "MidiServiceTransportPluginInfo.h" +#include "MidiServiceMessageProcessingPluginInfo.h" #include "MidiServiceConfigurationResponse.h" #include "MidiServiceLoopbackEndpointCreationResult.h" -#include "MidiServiceSessionConnectionInformation.h" -#include "MidiServiceSessionInformation.h" +#include "MidiServiceSessionConnectionInfo.h" +#include "MidiServiceSessionInfo.h" #include "MidiService.h" #include "MidiEndpointDeviceInformation.h" diff --git a/src/api/Drivers/MinMidi/Driver/Driver.vcxproj b/src/api/Drivers/MinMidi/Driver/Driver.vcxproj index 40609e54..f1da8c37 100644 --- a/src/api/Drivers/MinMidi/Driver/Driver.vcxproj +++ b/src/api/Drivers/MinMidi/Driver/Driver.vcxproj @@ -171,12 +171,12 @@ - + 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/Drivers/MinMidi/Driver/packages.config b/src/api/Drivers/MinMidi/Driver/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Drivers/MinMidi/Driver/packages.config +++ b/src/api/Drivers/MinMidi/Driver/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Drivers/MinMidi2/Driver/MinMidi2.vcxproj b/src/api/Drivers/MinMidi2/Driver/MinMidi2.vcxproj index 0a837971..844b6c82 100644 --- a/src/api/Drivers/MinMidi2/Driver/MinMidi2.vcxproj +++ b/src/api/Drivers/MinMidi2/Driver/MinMidi2.vcxproj @@ -189,12 +189,12 @@ - + 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/Drivers/MinMidi2/Driver/packages.config b/src/api/Drivers/MinMidi2/Driver/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Drivers/MinMidi2/Driver/packages.config +++ b/src/api/Drivers/MinMidi2/Driver/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Drivers/USBMIDI2/Driver/USBMidi2.vcxproj b/src/api/Drivers/USBMIDI2/Driver/USBMidi2.vcxproj index 31cb20c9..6923ae24 100644 --- a/src/api/Drivers/USBMIDI2/Driver/USBMidi2.vcxproj +++ b/src/api/Drivers/USBMIDI2/Driver/USBMidi2.vcxproj @@ -218,12 +218,12 @@ - + 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/Drivers/USBMIDI2/Driver/packages.config b/src/api/Drivers/USBMIDI2/Driver/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Drivers/USBMIDI2/Driver/packages.config +++ b/src/api/Drivers/USBMIDI2/Driver/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/InBoxApps/mididmp/main.cpp b/src/api/InBoxApps/mididmp/main.cpp index 6169f13c..20c59428 100644 --- a/src/api/InBoxApps/mididmp/main.cpp +++ b/src/api/InBoxApps/mididmp/main.cpp @@ -156,11 +156,11 @@ int __cdecl main() // list all devices devices = midi2::MidiEndpointDeviceInformation::FindAll( midi2::MidiEndpointDeviceInformationSortOrder::Name, - midi2::MidiEndpointDeviceInformationFilter::IncludeClientByteStreamNative | - midi2::MidiEndpointDeviceInformationFilter::IncludeClientUmpNative | - midi2::MidiEndpointDeviceInformationFilter::IncludeDiagnosticLoopback | - midi2::MidiEndpointDeviceInformationFilter::IncludeDiagnosticPing | - midi2::MidiEndpointDeviceInformationFilter::IncludeVirtualDeviceResponder + midi2::MidiEndpointDeviceInformationFilters::IncludeClientByteStreamNative | + midi2::MidiEndpointDeviceInformationFilters::IncludeClientUmpNative | + midi2::MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback | + midi2::MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing | + midi2::MidiEndpointDeviceInformationFilters::IncludeVirtualDeviceResponder ); } catch (...) diff --git a/src/api/InBoxApps/mididmp/mididmp.vcxproj b/src/api/InBoxApps/mididmp/mididmp.vcxproj index 8c907878..8295775e 100644 --- a/src/api/InBoxApps/mididmp/mididmp.vcxproj +++ b/src/api/InBoxApps/mididmp/mididmp.vcxproj @@ -1,6 +1,6 @@ - + true true @@ -10,7 +10,7 @@ {5ec6d5eb-53d4-4731-891e-f746f0201429} Win32Proj mididmp - 10.0.20348.0 + 10.0 10.0.17134.0 @@ -143,13 +143,13 @@ - + 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/InBoxApps/mididmp/packages.config b/src/api/InBoxApps/mididmp/packages.config index cbf6205e..09bfc449 100644 --- a/src/api/InBoxApps/mididmp/packages.config +++ b/src/api/InBoxApps/mididmp/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Inc/MidiDefs.h b/src/api/Inc/MidiDefs.h index 56e820d6..a29da1dd 100644 --- a/src/api/Inc/MidiDefs.h +++ b/src/api/Inc/MidiDefs.h @@ -551,7 +551,7 @@ DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_MidiOutLatencyTicksUserOverride, 802); // DE DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_VirtualMidiEndpointAssociator, 900); // DEVPROP_TYPE_GUID #define STRING_PKEY_MIDI_TransportSuppliedDescription MIDI_STRING_PKEY_GUID MIDI_STRING_PKEY_PID_SEPARATOR L"901" -DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_TransportSuppliedDescription, 910); // DEVPROP_TYPE_STRING +DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_TransportSuppliedDescription, 901); // DEVPROP_TYPE_STRING diff --git a/src/api/Inc/json_defs.h b/src/api/Inc/json_defs.h new file mode 100644 index 00000000..0895ba45 --- /dev/null +++ b/src/api/Inc/json_defs.h @@ -0,0 +1,101 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once + +#ifndef JSON_DEFS_H +#define JSON_DEFS_H + +#pragma once + +//#define MIDI_CONFIG_JSON_ENDPOINT_USER_SUPPLIED_NAME_PROPERTY_KEY L"userSuppliedName" +//#define MIDI_CONFIG_JSON_ENDPOINT_USER_SUPPLIED_DESCRIPTION_PROPERTY_KEY L"userSuppliedDescription" +//#define MIDI_CONFIG_JSON_ENDPOINT_FORCE_SINGLE_CLIENT_PROPERTY_KEY L"forceSingleClientOnly" + +//#define MIDI_CONFIG_JSON_ENDPOINT_IDENTIFIER_SWD L"SWD: " + + +// structural + +#define MIDI_CONFIG_JSON_HEADER_OBJECT L"header" +#define MIDI_CONFIG_JSON_HEADER_PRODUCT_KEY L"product" +#define MIDI_CONFIG_JSON_HEADER_FILE_VERSION_KEY L"fileVersion" + + + +#define MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT L"endpointTransportPluginSettings" +#define MIDI_CONFIG_JSON_ENDPOINT_PROCESSING_PLUGIN_SETTINGS_OBJECT L"endpointProcessingPluginSettings" + +// common properties + +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY L"name" +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY L"description" +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY L"uniqueIdentifier" +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_MANUFACTURER_PROPERTY L"manufacturer" + + +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_NAME_PROPERTY L"userSuppliedName" +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_DESCRIPTION_PROPERTY L"userSuppliedDescription" +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_SMALL_IMAGE_PROPERTY L"userSuppliedSmallImage" +#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_LARGE_IMAGE_PROPERTY L"userSuppliedLargeImage" + +#define MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY L"success" +#define MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_MESSAGE_PROPERTY_KEY L"message" + + + +// Virtual MIDI (here because also needed by the client API) + +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_CREATE_ARRAY_KEY L"createVirtualDevices" +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_UPDATE_ARRAY_KEY L"updateVirtualDevices" +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_REMOVE_ARRAY_KEY L"removeVirtualDevices" + +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_ASSOCIATION_ID_PROPERTY_KEY L"associationIdentifier" +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_UNIQUE_ID_MAX_LEN 32 + + +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_DEVICES_ARRAY_KEY L"createdDevices" +#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_ID_PROPERTY_KEY L"id" + + + +// loopback MIDI (here because these can also be created via the client API) + +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_CREATE_KEY L"create" +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_UPDATE_KEY L"update" +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_REMOVE_KEY L"remove" + +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_A_KEY L"endpointA" +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_B_KEY L"endpointB" + + +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_A_ID_KEY L"endpointA" +#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_B_ID_KEY L"endpointB" + + + + +// Session tracker. These are used in the service and in the client API + +#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ARRAY_PROPERTY_KEY L"sessions" + +#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ID_PROPERTY_KEY L"id" +#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_NAME_PROPERTY_KEY L"name" +#define MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_ID_PROPERTY_KEY L"clientProcessId" +#define MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_NAME_PROPERTY_KEY L"processName" +#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_TIME_PROPERTY_KEY L"startTime" + + +#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ARRAY_PROPERTY_KEY L"connections" + +#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_TIME_PROPERTY_KEY L"earliestStartTime" +#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_COUNT_PROPERTY_KEY L"instanceCount" +#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ENDPOINT_ID_PROPERTY_KEY L"endpointId" + + +#endif \ No newline at end of file diff --git a/src/api/Inc/json_helpers.h b/src/api/Inc/json_helpers.h new file mode 100644 index 00000000..5f8c18c4 --- /dev/null +++ b/src/api/Inc/json_helpers.h @@ -0,0 +1,222 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once + +#ifndef JSON_HELPERS_H +#define JSON_HELPERS_H + +// this def messes with json so we need to undef it here +#pragma push_macro("GetObject") +#undef GetObject +#include +#pragma pop_macro("GetObject") + +#include +#include + +#include "atlbase.h" // for CComBSTR + + +namespace json = ::winrt::Windows::Data::Json; + + +namespace Windows::Devices::Midi2::Internal +{ + inline json::JsonObject BuildConfigurationResponseObject(_In_ bool const success) + { + // the root object just has a wrapper with a success or fail property. Additional + // properties depend on the specific use case and so are added in those cases. + + json::JsonObject response; + + json::JsonValue successValue = json::JsonValue::CreateBooleanValue(success); + + response.SetNamedValue(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, successValue); + + return response; + } + + inline void SetConfigurationResponseObjectFail(_In_ json::JsonObject& object, _In_ std::wstring message) + { + auto messageVal = json::JsonValue::CreateStringValue(message.c_str()); + object.SetNamedValue(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_MESSAGE_PROPERTY_KEY, messageVal); + + auto successVal = json::JsonValue::CreateBooleanValue(false); + object.SetNamedValue(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, messageVal); + } + + _Success_(return == true) + inline bool JsonObjectFromBSTR(_In_ BSTR* const jsonBString, _Out_ json::JsonObject &obj) noexcept + { + if (jsonBString != nullptr) + { + try + { + ATL::CComBSTR ccbstr(*jsonBString); + if (ccbstr.Length() > 0) + { + winrt::hstring jsonHString(ccbstr); + + // SAL doesn't understand that TryParse returns true on success + // and so it complains with warning C6101 that obj is uninitialized + // on a success path in this function. + if (json::JsonObject::TryParse(jsonHString, obj)) + { + return true; + } + } + } + catch (...) + { + } + } + + return false; + } + + _Success_(return == true) + inline bool JsonStringifyObjectToOutParam(_In_ json::JsonObject const& obj, _Out_ BSTR** outParam) noexcept + { + try + { + ATL::CComBSTR responseString = obj.Stringify().c_str(); + + auto hr = responseString.CopyTo(*outParam); + + if (SUCCEEDED(hr)) + { + return true; + } + } + catch (...) + { + + } + + return false; + } + + inline json::JsonObject JsonCreateSingleWStringPropertyObject(_In_ std::wstring const& key, _In_ std::wstring const& value) noexcept + { + json::JsonObject obj; + + obj.SetNamedValue(key, json::JsonValue::CreateStringValue(value.c_str())); + + return obj; + } + + // this handles accuracy of seconds and no finer + inline std::chrono::time_point + JsonGetDateTimeProperty( + _In_ json::JsonObject const& parent, + _In_ std::wstring const& key, + _In_ std::chrono::time_point const defaultValue) noexcept + { + if (parent != nullptr) + { + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) + { + try + { + auto result = parent.GetNamedNumber(hkey); + auto seconds = std::chrono::seconds((long)result); + + std::chrono::time_point tp; + tp += seconds; + + return tp; + } + catch (...) + { + // we'll fall through and return the default + } + } + } + + // return default in case of error + return defaultValue; + } + + // this handles accuracy of seconds and no finer + inline bool JsonSetDateTimeProperty( + _In_ json::JsonObject const& parent, + _In_ std::wstring const& key, + _In_ std::chrono::time_point const value) noexcept + { + try + { + if (parent != nullptr) + { + auto number = std::chrono::duration_cast(value.time_since_epoch()).count(); + + parent.SetNamedValue(key, json::JsonValue::CreateNumberValue((double)number)); + + return true; + } + } + catch (...) + { + + } + + return false; + } + + inline GUID JsonGetGuidProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ GUID const& defaultValue) noexcept + { + if (parent != nullptr) + { + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) + { + try + { + auto result = parent.GetNamedString(hkey); + + return StringToGuid(result.c_str()); + } + catch (...) + { + // we'll fall through and return the default + } + } + } + + // return default in case of error + return defaultValue; + } + + inline bool JsonSetGuidProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ GUID const& value) noexcept + { + try + { + if (parent != nullptr) + { + winrt::hstring stringValue = winrt::to_hstring(GuidToString(value).c_str()); + + parent.SetNamedValue(key, json::JsonValue::CreateStringValue(stringValue)); + + return true; + } + } + catch (...) + { + + } + + return false; + } + + +} + +#endif \ No newline at end of file diff --git a/src/api/Inc/midi_config_json.h b/src/api/Inc/midi_config_json.h deleted file mode 100644 index 5a3e3586..00000000 --- a/src/api/Inc/midi_config_json.h +++ /dev/null @@ -1,15 +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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once - -#define MIDI_CONFIG_JSON_ENDPOINT_USER_SUPPLIED_NAME_PROPERTY_KEY L"userSuppliedName" -#define MIDI_CONFIG_JSON_ENDPOINT_USER_SUPPLIED_DESCRIPTION_PROPERTY_KEY L"userSuppliedDescription" -#define MIDI_CONFIG_JSON_ENDPOINT_FORCE_SINGLE_CLIENT_PROPERTY_KEY L"forceSingleClientOnly" - -#define MIDI_CONFIG_JSON_ENDPOINT_IDENTIFIER_SWD L"SWD: " diff --git a/src/api/Inc/swd_helpers.h b/src/api/Inc/swd_helpers.h new file mode 100644 index 00000000..7a9eb06b --- /dev/null +++ b/src/api/Inc/swd_helpers.h @@ -0,0 +1,125 @@ +// 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://github.com/microsoft/MIDI/ +// ============================================================================ + +#pragma once + +#ifndef SWD_HELPERS_H +#define SWD_HELPERS_H + + +#include + + + +namespace Windows::Devices::Midi2::Internal +{ + inline std::wstring CalculateEndpointDevicePrimaryName( + _In_ std::wstring const& transportSuppliedEndpointName, + _In_ std::wstring const& userSuppliedEndpointName, + _In_ std::wstring const& inProtocolDiscoveredEndpointName + ) + { + // top priority is any user-supplied name + if (!::Windows::Devices::Midi2::Internal::TrimmedWStringCopy(userSuppliedEndpointName).empty()) + { + return ::Windows::Devices::Midi2::Internal::TrimmedWStringCopy(userSuppliedEndpointName); + } + + // next priority is any in-protocol name + if (!internal::TrimmedWStringCopy(inProtocolDiscoveredEndpointName).empty()) + { + return ::Windows::Devices::Midi2::Internal::TrimmedWStringCopy(inProtocolDiscoveredEndpointName); + } + + // otherwise, we return the transport-supplied name. For example, this is the name from USB + + return ::Windows::Devices::Midi2::Internal::TrimmedWStringCopy(transportSuppliedEndpointName); + + } + + // This is for the device instance id. Not to be confused with the interface id + inline std::wstring NormalizeDeviceInstanceIdWStringCopy(_In_ std::wstring const& deviceInstanceId) + { + return ::Windows::Devices::Midi2::Internal::ToUpperTrimmedWStringCopy(deviceInstanceId); + } + + // This is for the endpoint device interface id (the long SWD id with the GUID) + inline std::wstring NormalizeEndpointInterfaceIdWStringCopy(_In_ std::wstring const& endpointInterfaceId) + { + return ::Windows::Devices::Midi2::Internal::ToLowerTrimmedWStringCopy(endpointInterfaceId); + } + + // used for searching for a substring in an endpoint interface id. Matches case with + // what NormalizeEndpointInterfaceIdCopy produces + inline bool EndpointInterfaceIdContainsString(_In_ std::wstring const& endpointInterfaceId, _In_ std::wstring const& searchFor) + { + auto id = NormalizeEndpointInterfaceIdWStringCopy(endpointInterfaceId); + auto sub = ::Windows::Devices::Midi2::Internal::ToLowerWStringCopy(searchFor); // match case with NormalizeEndpointInterfaceIdCopy + + if (id == L"" || sub == L"") + { + return false; + } + + return id.find(sub) != std::wstring::npos; + } + + + + inline DEVPROPERTY BuildEmptyDevProperty( + _In_ DEVPROPKEY const key) + { + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_EMPTY, 0, nullptr }; + } + + + inline std::wstring GetSwdStringProperty(_In_ std::wstring deviceInterfaceId, _In_ std::wstring propertyName, _In_ std::wstring defaultValue) + { + auto propertyKey = winrt::to_hstring(propertyName.c_str()); + + auto additionalProperties = winrt::single_threaded_vector(); + additionalProperties.Append(propertyKey); + + + auto deviceInfo = winrt::Windows::Devices::Enumeration::DeviceInformation::CreateFromIdAsync( + winrt::to_hstring(deviceInterfaceId.c_str()), + additionalProperties, + winrt::Windows::Devices::Enumeration::DeviceInformationKind::DeviceInterface).get(); + + auto prop = deviceInfo.Properties().Lookup(propertyKey); + + if (prop) + { + // this interface is pointing to a UMP interface, so use that instance id. + return (winrt::unbox_value(prop)).c_str(); + } + else + { + // default to any + return defaultValue; + } + } + + inline std::wstring GetSwdPropertyVirtualEndpointAssociationId(_In_ std::wstring deviceInterfaceId) + { + std::wstring cleanId = ::Windows::Devices::Midi2::Internal::NormalizeEndpointInterfaceIdWStringCopy(deviceInterfaceId); + + return internal::ToUpperTrimmedWStringCopy(GetSwdStringProperty(cleanId, STRING_PKEY_MIDI_VirtualMidiEndpointAssociator, L"")); + } + + inline std::wstring GetSwdPropertyInstanceId(_In_ std::wstring deviceInterfaceId) + { + std::wstring cleanId = ::Windows::Devices::Midi2::Internal::NormalizeEndpointInterfaceIdWStringCopy(deviceInterfaceId); + + return internal::NormalizeDeviceInstanceIdWStringCopy(GetSwdStringProperty(cleanId, L"System.Devices.DeviceInstanceId", L"")); + } + +} + +#endif diff --git a/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj b/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj index 085e714b..73dc65f7 100644 --- a/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj +++ b/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj @@ -50,7 +50,7 @@ 17.0 {3CC19466-95AA-43CD-B327-4C53C026B965} Win32Proj - 10.0.22621.0 + 10.0 @@ -154,7 +154,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -170,7 +170,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -185,7 +185,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -202,7 +202,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -217,7 +217,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -226,7 +226,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 diff --git a/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj index 1b3209bf..81fa5f83 100644 --- a/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj +++ b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj @@ -23,7 +23,7 @@ Win32Proj {60d2e061-fc7d-40ff-ad8c-4cb3d175a814} AbstractionUtilities - 10.0.20348.0 + 10.0 AbstractionUtilities @@ -95,7 +95,7 @@ true Use pch.h - stdcpp17 + stdcpp20 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc true @@ -115,7 +115,7 @@ true Use pch.h - stdcpp17 + stdcpp20 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc true @@ -135,7 +135,7 @@ true Use pch.h - stdcpp17 + stdcpp20 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc true @@ -155,7 +155,7 @@ true Use pch.h - stdcpp17 + stdcpp20 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc true @@ -168,15 +168,13 @@ - + - + - - - + Create @@ -184,10 +182,18 @@ Create Create - - + + + + + + + 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/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters index 912f99c2..491062a7 100644 --- a/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters +++ b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters @@ -15,7 +15,7 @@ - + Header Files @@ -24,18 +24,12 @@ Header Files - - Header Files - - + Header Files - - Source Files - - + Source Files @@ -44,11 +38,8 @@ Source Files - - Source Files - - - Source Files - + + + \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/inc/endpoint_data_helpers.h b/src/api/Libs/AbstractionUtilities/inc/endpoint_data_helpers.h deleted file mode 100644 index 9953ff5e..00000000 --- a/src/api/Libs/AbstractionUtilities/inc/endpoint_data_helpers.h +++ /dev/null @@ -1,35 +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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once - -#ifndef SWD_DATA_HELPERS_H -#define SWD_DATA_HELPERS_H - - -namespace Windows::Devices::Midi2::Internal -{ - std::wstring CalculateEndpointDevicePrimaryName( - _In_ std::wstring const& transportSuppliedEndpointName, - _In_ std::wstring const& userSuppliedEndpointName, - _In_ std::wstring const& inProtocolDiscoveredEndpointName - ); - - // This is for the device instance id. Not to be confused with the interface id - std::wstring NormalizeDeviceInstanceIdWStringCopy(_In_ std::wstring const& deviceInstanceId); - - // This is for the endpoint device interface id (the long SWD id with the GUID) - std::wstring NormalizeEndpointInterfaceIdWStringCopy(_In_ std::wstring const& endpointInterfaceId); - - // used for searching for a substring in an endpoint interface id. Matches case with - // what NormalizeEndpointInterfaceIdCopy produces - bool EndpointInterfaceIdContainsString(_In_ std::wstring const& endpointInterfaceId, _In_ std::wstring const& searchFor); - -} - -#endif diff --git a/src/api/Libs/AbstractionUtilities/inc/json_helpers.h b/src/api/Libs/AbstractionUtilities/inc/json_helpers.h deleted file mode 100644 index a4e8dd9b..00000000 --- a/src/api/Libs/AbstractionUtilities/inc/json_helpers.h +++ /dev/null @@ -1,154 +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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once - -#ifndef JSON_HELPERS_H -#define JSON_HELPERS_H - -// this def messes with json so we need to undef it here -#pragma push_macro("GetObject") -#undef GetObject -#include -#pragma pop_macro("GetObject") - -#include -#include - -#include "atlbase.h" // for CComBSTR - - -namespace json = ::winrt::Windows::Data::Json; - -// structural - -#define MIDI_CONFIG_JSON_HEADER_OBJECT L"header" -#define MIDI_CONFIG_JSON_HEADER_PRODUCT_KEY L"product" -#define MIDI_CONFIG_JSON_HEADER_FILE_VERSION_KEY L"fileVersion" - - - -#define MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT L"endpointTransportPluginSettings" -#define MIDI_CONFIG_JSON_ENDPOINT_PROCESSING_PLUGIN_SETTINGS_OBJECT L"endpointProcessingPluginSettings" - -// common properties - -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY L"name" -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY L"description" -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY L"uniqueIdentifier" -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_MANUFACTURER_PROPERTY L"manufacturer" - - -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_NAME_PROPERTY L"userSuppliedName" -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_DESCRIPTION_PROPERTY L"userSuppliedDescription" -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_SMALL_IMAGE_PROPERTY L"userSuppliedSmallImage" -#define MIDI_CONFIG_JSON_ENDPOINT_COMMON_USER_SUPPLIED_LARGE_IMAGE_PROPERTY L"userSuppliedLargeImage" - -#define MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY L"success" -#define MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_MESSAGE_PROPERTY_KEY L"message" - - -// Virtual MIDI (here because also needed by the client API) - -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_CREATE_ARRAY_KEY L"createVirtualDevices" -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_UPDATE_ARRAY_KEY L"updateVirtualDevices" -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_REMOVE_ARRAY_KEY L"removeVirtualDevices" - -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_ASSOCIATION_ID_PROPERTY_KEY L"associationIdentifier" -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_UNIQUE_ID_MAX_LEN 32 - - -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_DEVICES_ARRAY_KEY L"createdDevices" -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_ID_PROPERTY_KEY L"id" - -// loopback MIDI (here because these can also be created via the client API) - -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_CREATE_KEY L"create" -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_UPDATE_KEY L"update" -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_REMOVE_KEY L"remove" - -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_A_KEY L"endpointA" -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_B_KEY L"endpointB" - - -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_A_ID_KEY L"endpointA" -#define MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_B_ID_KEY L"endpointB" - - - -// Session tracker. These are used in the service and in the client API - -#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ARRAY_PROPERTY_KEY L"sessions" - -#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ID_PROPERTY_KEY L"id" -#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_NAME_PROPERTY_KEY L"name" -#define MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_ID_PROPERTY_KEY L"clientProcessId" -#define MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_NAME_PROPERTY_KEY L"processName" -#define MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_TIME_PROPERTY_KEY L"startTime" - - -#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ARRAY_PROPERTY_KEY L"connections" - -#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_TIME_PROPERTY_KEY L"earliestStartTime" -#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_COUNT_PROPERTY_KEY L"instanceCount" -#define MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ENDPOINT_ID_PROPERTY_KEY L"endpointId" - - - -namespace Windows::Devices::Midi2::Internal -{ - json::JsonObject BuildConfigurationResponseObject(_In_ bool const success); - - void SetConfigurationResponseObjectFail(_In_ json::JsonObject& object, _In_ std::wstring message); - - - bool JsonObjectFromBSTR(_In_ BSTR* const bstr, _Out_ json::JsonObject& obj) noexcept; - - bool JsonStringifyObjectToOutParam(_In_ json::JsonObject const& obj, _Out_ BSTR** outParam) noexcept; - - json::JsonObject JsonCreateSingleWStringPropertyObject(_In_ std::wstring const& key, _In_ std::wstring const& value) noexcept; - - - json::JsonArray JsonGetArrayProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key) noexcept; - bool JsonSetArrayProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ json::JsonArray const& value) noexcept; - - std::wstring JsonGetWStringProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, std::wstring const& defaultValue) noexcept; - bool JsonSetWStringProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ std::wstring const& value) noexcept; - - // this handles accuracy of seconds and no finer - std::chrono::time_point - JsonGetDateTimeProperty( - _In_ json::JsonObject const& parent, - _In_ std::wstring const& key, - _In_ std::chrono::time_point const defaultValue) noexcept; - - // this handles accuracy of seconds and no finer - bool JsonSetDateTimeProperty( - _In_ json::JsonObject const& parent, - _In_ std::wstring const& key, - _In_ std::chrono::time_point const value) noexcept; - - GUID JsonGetGuidProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ GUID const& defaultValue) noexcept; - bool JsonSetGuidProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ GUID const& value) noexcept; - - bool JsonGetBoolProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ bool const defaultValue) noexcept; - bool JsonSetBoolProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ bool const value) noexcept; - - double JsonGetDoubleProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ double const defaultValue) noexcept; - bool JsonSetDoubleProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ double const value) noexcept; - - long JsonGetLongProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ long const defaultValue) noexcept; - bool JsonSetLongProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ long const value) noexcept; - - json::JsonObject JsonGetObjectProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, json::JsonObject const& defaultValue) noexcept; - bool JsonSetObjectProperty(_In_ json::JsonObject const& parent, _In_ std::wstring const& key, _In_ json::JsonObject const& value) noexcept; - - -} - -#endif \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/inc/swd_property_builders.h b/src/api/Libs/AbstractionUtilities/inc/swd_property_builders.h deleted file mode 100644 index 6b3a456c..00000000 --- a/src/api/Libs/AbstractionUtilities/inc/swd_property_builders.h +++ /dev/null @@ -1,25 +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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once - -#ifndef SWD_PROPERTY_BUILDERS_H -#define SWD_PROPERTY_BUILDERS_H - -#include "Devpkey.h" -#include - - -namespace Windows::Devices::Midi2::Internal -{ - DEVPROPERTY BuildEmptyDevProperty( - _In_ DEVPROPKEY const key); - -} - -#endif \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/inc/swd_shared.h b/src/api/Libs/AbstractionUtilities/inc/swd_shared.h deleted file mode 100644 index 1a100b14..00000000 --- a/src/api/Libs/AbstractionUtilities/inc/swd_shared.h +++ /dev/null @@ -1,24 +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://github.com/microsoft/MIDI/ -// ============================================================================ - - -#include -#include - - -#pragma once - -namespace Windows::Devices::Midi2::Internal -{ - - std::wstring GetSwdStringProperty(_In_ std::wstring deviceInterfaceId, _In_ std::wstring propertyName, _In_ std::wstring defaultValue); - - std::wstring GetSwdPropertyVirtualEndpointAssociationId(_In_ std::wstring deviceInterfaceId); - - std::wstring GetSwdPropertyInstanceId(_In_ std::wstring deviceInterfaceId); -} \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/packages.config b/src/api/Libs/AbstractionUtilities/packages.config new file mode 100644 index 00000000..09be25d9 --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/src/endpoint_data_helpers.cpp b/src/api/Libs/AbstractionUtilities/src/endpoint_data_helpers.cpp deleted file mode 100644 index 93249230..00000000 --- a/src/api/Libs/AbstractionUtilities/src/endpoint_data_helpers.cpp +++ /dev/null @@ -1,69 +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://github.com/microsoft/MIDI/ -// ============================================================================ - -#include "pch.h" - -namespace Windows::Devices::Midi2::Internal -{ - _Use_decl_annotations_ - std::wstring CalculateEndpointDevicePrimaryName( - std::wstring const& transportSuppliedEndpointName, - std::wstring const& userSuppliedEndpointName, - std::wstring const& inProtocolDiscoveredEndpointName - ) - { - // top priority is any user-supplied name - if (!internal::TrimmedWStringCopy(userSuppliedEndpointName).empty()) - { - return internal::TrimmedWStringCopy(userSuppliedEndpointName); - } - - // next priority is any in-protocol name - if (!internal::TrimmedWStringCopy(inProtocolDiscoveredEndpointName).empty()) - { - return internal::TrimmedWStringCopy(inProtocolDiscoveredEndpointName); - } - - // otherwise, we return the transport-supplied name. For example, this is the name from USB - - return internal::TrimmedWStringCopy(transportSuppliedEndpointName); - - } - - // This is for the device instance id. Not to be confused with the interface id - _Use_decl_annotations_ - std::wstring NormalizeDeviceInstanceIdWStringCopy(std::wstring const& deviceInstanceId) - { - return ToUpperTrimmedWStringCopy(deviceInstanceId); - } - - - // This is for the endpoint device interface id (the long SWD id with the GUID) - _Use_decl_annotations_ - std::wstring NormalizeEndpointInterfaceIdWStringCopy(std::wstring const& endpointInterfaceId) - { - return ToLowerTrimmedWStringCopy(endpointInterfaceId); - } - - // used for searching for a substring in an endpoint interface id. Matches case with - // what NormalizeEndpointInterfaceIdCopy produces - _Use_decl_annotations_ - bool EndpointInterfaceIdContainsString(std::wstring const& endpointInterfaceId, std::wstring const& searchFor) - { - auto id = NormalizeEndpointInterfaceIdWStringCopy(endpointInterfaceId); - auto sub = ToLowerWStringCopy(searchFor); // match case with NormalizeEndpointInterfaceIdCopy - - if (id == L"" || sub == L"") - { - return false; - } - - return id.find(sub) != std::wstring::npos; - } -} - diff --git a/src/api/Libs/AbstractionUtilities/src/json_helpers.cpp b/src/api/Libs/AbstractionUtilities/src/json_helpers.cpp deleted file mode 100644 index 23ef34c7..00000000 --- a/src/api/Libs/AbstractionUtilities/src/json_helpers.cpp +++ /dev/null @@ -1,503 +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://github.com/microsoft/MIDI/ -// ============================================================================ - -#include "pch.h" - -namespace Windows::Devices::Midi2::Internal -{ - _Use_decl_annotations_ - void SetConfigurationResponseObjectFail( - json::JsonObject& object, - std::wstring message) - { - auto messageVal = json::JsonValue::CreateStringValue(message.c_str()); - object.SetNamedValue(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_MESSAGE_PROPERTY_KEY, messageVal); - - auto successVal = json::JsonValue::CreateBooleanValue(false); - object.SetNamedValue(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, messageVal); - } - - - - _Use_decl_annotations_ - json::JsonObject BuildConfigurationResponseObject(_In_ bool const success) - { - // the root object just has a wrapper with a success or fail property. Additional - // properties depend on the specific use case and so are added in those cases. - - json::JsonObject response; - - json::JsonValue successValue = json::JsonValue::CreateBooleanValue(success); - - response.SetNamedValue(MIDI_CONFIG_JSON_CONFIGURATION_RESPONSE_SUCCESS_PROPERTY_KEY, successValue); - - return response; - } - - - - _Use_decl_annotations_ - bool JsonObjectFromBSTR(BSTR* const bstr, json::JsonObject& obj) noexcept - { - if (bstr == nullptr) return false; - - try - { - ATL::CComBSTR ccbstr(*bstr); - if (ccbstr.Length() == 0) return false; - - winrt::hstring hstr(ccbstr); - - if (json::JsonObject::TryParse(hstr, obj)) - { - return true; - } - } - catch (...) - { - } - - obj = nullptr; - return false; - } - - - - _Use_decl_annotations_ - bool JsonStringifyObjectToOutParam(json::JsonObject const& obj, BSTR** outParam) noexcept - { - try - { - ATL::CComBSTR responseString = obj.Stringify().c_str(); - - auto hr = responseString.CopyTo(*outParam); - - if (SUCCEEDED(hr)) - { - return true; - } - } - catch (...) - { - - } - - return false; - } - - _Use_decl_annotations_ - json::JsonObject JsonCreateSingleWStringPropertyObject(std::wstring const& key, std::wstring const& value) noexcept - { - json::JsonObject obj; - - obj.SetNamedValue(key, json::JsonValue::CreateStringValue(value.c_str())); - - return obj; - } - - - _Use_decl_annotations_ - json::JsonArray JsonGetArrayProperty(json::JsonObject const& parent, std::wstring const& key) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedArray(hkey); - - return result; - } - catch (...) - { - // we'll fall through and return an empty array - } - - } - } - - // return an empty array in case of error - return json::JsonArray{}; - } - - _Use_decl_annotations_ - bool JsonSetArrayProperty(json::JsonObject const& parent, std::wstring const& key, json::JsonArray const& value) noexcept - { - try - { - if (parent != nullptr) - { - parent.SetNamedValue(key, value); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - _Use_decl_annotations_ - std::wstring JsonGetWStringProperty(json::JsonObject const& parent, std::wstring const& key, std::wstring const& defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedString(hkey); - - return result.c_str(); - } - catch (...) - { - // we'll fall through and return the default - } - - } - } - - // return default in case of error - return defaultValue; - } - - _Use_decl_annotations_ - bool JsonSetWStringProperty(json::JsonObject const& parent, std::wstring const& key, std::wstring const& value) noexcept - { - try - { - if (parent != nullptr) - { - winrt::hstring stringValue = winrt::to_hstring(value.c_str()); - - parent.SetNamedValue(key, json::JsonValue::CreateStringValue(stringValue)); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - // this handles accuracy of seconds and no finer - _Use_decl_annotations_ - std::chrono::time_point - JsonGetDateTimeProperty( - json::JsonObject const& parent, - std::wstring const& key, - std::chrono::time_point const defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedNumber(hkey); - auto seconds = std::chrono::seconds((long)result); - - std::chrono::time_point tp; - tp += seconds; - - return tp; - } - catch (...) - { - // we'll fall through and return the default - } - } - } - - // return default in case of error - return defaultValue; - } - - // this handles accuracy of seconds and no finer - _Use_decl_annotations_ - bool JsonSetDateTimeProperty( - json::JsonObject const& parent, - std::wstring const& key, - std::chrono::time_point const value) noexcept - { - try - { - if (parent != nullptr) - { - auto number = std::chrono::duration_cast(value.time_since_epoch()).count(); - - parent.SetNamedValue(key, json::JsonValue::CreateNumberValue((double)number)); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - _Use_decl_annotations_ - GUID JsonGetGuidProperty(json::JsonObject const& parent, std::wstring const& key, GUID const& defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedString(hkey); - - return StringToGuid(result.c_str()); - } - catch (...) - { - // we'll fall through and return the default - } - } - } - - // return default in case of error - return defaultValue; - } - - _Use_decl_annotations_ - bool JsonSetGuidProperty(json::JsonObject const& parent, std::wstring const& key, GUID const& value) noexcept - { - try - { - if (parent != nullptr) - { - winrt::hstring stringValue = winrt::to_hstring(GuidToString(value).c_str()); - - parent.SetNamedValue(key, json::JsonValue::CreateStringValue(stringValue)); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - _Use_decl_annotations_ - bool JsonGetBoolProperty(json::JsonObject const& parent, std::wstring const& key, bool const defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedBoolean(hkey); - - return result; - } - catch (...) - { - // we'll fall through and return the default - } - - } - } - - // return default in case of error - return defaultValue; - } - - _Use_decl_annotations_ - bool JsonSetBoolProperty(json::JsonObject const& parent, std::wstring const& key, bool const value) noexcept - { - try - { - if (parent != nullptr) - { - parent.SetNamedValue(key, json::JsonValue::CreateBooleanValue(value)); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - _Use_decl_annotations_ - double JsonGetDoubleProperty(json::JsonObject const& parent, std::wstring const& key, double const defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedNumber(hkey); - - return result; - } - catch (...) - { - // we'll fall through and return the default - } - - } - } - - // return default in case of error - return defaultValue; - } - - _Use_decl_annotations_ - bool JsonSetDoubleProperty(json::JsonObject const& parent, std::wstring const& key, double const value) noexcept - { - try - { - if (parent != nullptr) - { - parent.SetNamedValue(key, json::JsonValue::CreateNumberValue(value)); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - _Use_decl_annotations_ - long JsonGetLongProperty(json::JsonObject const& parent, std::wstring const& key, long const defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = (long)parent.GetNamedNumber(hkey); - - return result; - } - catch (...) - { - // we'll fall through and return the default - } - - } - } - - // return default in case of error - return defaultValue; - } - - _Use_decl_annotations_ - bool JsonSetLongProperty(json::JsonObject const& parent, std::wstring const& key, long const value) noexcept - { - try - { - if (parent != nullptr) - { - parent.SetNamedValue(key, json::JsonValue::CreateNumberValue((double)value)); - - return true; - } - } - catch (...) - { - - } - - return false; - } - - - - - - - _Use_decl_annotations_ - json::JsonObject JsonGetObjectProperty(json::JsonObject const& parent, std::wstring const& key, json::JsonObject const& defaultValue) noexcept - { - if (parent != nullptr) - { - auto hkey = winrt::to_hstring(key.c_str()); - - if (parent.HasKey(hkey)) - { - try - { - auto result = parent.GetNamedObject(hkey); - - return result; - } - catch (...) - { - // we'll fall through and return the default - } - - } - } - - // return default in case of error - return defaultValue; - } - - _Use_decl_annotations_ - bool JsonSetObjectProperty(json::JsonObject const& parent, std::wstring const& key, json::JsonObject const& value) noexcept - { - try - { - if (parent != nullptr) - { - parent.SetNamedValue(key, value); - - return true; - } - } - catch (...) - { - - } - - return false; - } - -} - diff --git a/src/api/Libs/AbstractionUtilities/src/pch.cpp b/src/api/Libs/AbstractionUtilities/src/pch.cpp deleted file mode 100644 index a128584f..00000000 --- a/src/api/Libs/AbstractionUtilities/src/pch.cpp +++ /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://github.com/microsoft/MIDI/ -// ============================================================================ - -#pragma once - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/src/api/Libs/AbstractionUtilities/src/pch.h b/src/api/Libs/AbstractionUtilities/src/pch.h index b8fd2bd2..ab8a97e5 100644 --- a/src/api/Libs/AbstractionUtilities/src/pch.h +++ b/src/api/Libs/AbstractionUtilities/src/pch.h @@ -50,10 +50,8 @@ namespace internal = ::Windows::Devices::Midi2::Internal; -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" +#include "swd_helpers.h" #include "json_helpers.h" -#include "swd_shared.h" #endif //PCH_H diff --git a/src/api/Libs/AbstractionUtilities/src/property_builders.cpp b/src/api/Libs/AbstractionUtilities/src/property_builders.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/api/Libs/AbstractionUtilities/src/swd_property_helpers.cpp b/src/api/Libs/AbstractionUtilities/src/swd_property_helpers.cpp deleted file mode 100644 index 86628b7a..00000000 --- a/src/api/Libs/AbstractionUtilities/src/swd_property_helpers.cpp +++ /dev/null @@ -1,68 +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://github.com/microsoft/MIDI/ -// ============================================================================ - - -#include "pch.h" - - -namespace Windows::Devices::Midi2::Internal -{ - // NOTE: The parameters in here are all passed to the API by ref, so the - // calling code needs to keep them around until the device creation returns. - bool AddStandardEndpointProperties( - ) - { - try - { - //interfaceDeviceProperties.push_back(BuildGuidDevProperty(PKEY_MIDI_AbstractionLayer, abstractionLayerGuid)); - //interfaceDeviceProperties.push_back(BuildUInt32DevProperty(PKEY_MIDI_EndpointDevicePurpose, endpointPurpose)); - - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(DEVPKEY_DeviceInterface_FriendlyName, friendlyName)); - - ////// transport information - - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_TransportMnemonic, transportMnemonic)); - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_TransportSuppliedEndpointName, transportSuppliedEndpointName)); - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_TransportSuppliedDescription, transportSuppliedEndpointDescription)); - - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_SerialNumber, uniqueIdentifier)); - - - //// user-supplied information, if available - - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_UserSuppliedEndpointName, userSuppliedEndpointName)); - //interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_UserSuppliedDescription, userSuppliedEndpointDescription)); - - - //// data format. These each have different uses. Native format is the device's format. Supported - //// format is how we talk to it from the service (the driver may translate to UMP, for example) - - //interfaceDeviceProperties.push_back(BuildByteDevProperty(PKEY_MIDI_NativeDataFormat, nativeDataFormat)); - //interfaceDeviceProperties.push_back(BuildUInt32DevProperty(PKEY_MIDI_SupportedDataFormats, supportedDataFormats)); - - //// behavior - - //interfaceDeviceProperties.push_back(BuildBooleanDevProperty(PKEY_MIDI_GenerateIncomingTimestamp, generateIncomingTimestamps)); - //interfaceDeviceProperties.push_back(BuildBooleanDevProperty(PKEY_MIDI_EndpointRequiresMetadataHandler, requiresMetadataHandler)); - - //interfaceDeviceProperties.push_back(BuildBooleanDevProperty(PKEY_MIDI_SupportsMulticlient, supportsMultiClient)); - - return true; - } - catch (...) - { - - } - - return false; - } - - - -} - diff --git a/src/api/Libs/AbstractionUtilities/src/swd_shared.cpp b/src/api/Libs/AbstractionUtilities/src/swd_shared.cpp deleted file mode 100644 index e9530428..00000000 --- a/src/api/Libs/AbstractionUtilities/src/swd_shared.cpp +++ /dev/null @@ -1,68 +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://github.com/microsoft/MIDI/ -// ============================================================================ - - -#include "pch.h" - -#include "swd_shared.h" - -namespace Windows::Devices::Midi2::Internal -{ - - std::wstring - GetStringSwdProperty(_In_ std::wstring deviceInterfaceId, _In_ std::wstring propertyName, _In_ std::wstring defaultValue) - { - auto propertyKey = winrt::to_hstring(propertyName.c_str()); - - auto additionalProperties = winrt::single_threaded_vector(); - additionalProperties.Append(propertyKey); - - - auto deviceInfo = winrt::Windows::Devices::Enumeration::DeviceInformation::CreateFromIdAsync( - winrt::to_hstring(deviceInterfaceId.c_str()), - additionalProperties, - winrt::Windows::Devices::Enumeration::DeviceInformationKind::DeviceInterface).get(); - - auto prop = deviceInfo.Properties().Lookup(propertyKey); - - if (prop) - { - OutputDebugString(__FUNCTION__ L" found property"); - - // this interface is pointing to a UMP interface, so use that instance id. - return (winrt::unbox_value(prop)).c_str(); - } - else - { - OutputDebugString(__FUNCTION__ L" didn't find property"); - // default to any - return defaultValue; - } - - } - - - _Use_decl_annotations_ - std::wstring - GetSwdPropertyVirtualEndpointAssociationId(std::wstring deviceInterfaceId) - { - std::wstring cleanId = internal::NormalizeEndpointInterfaceIdWStringCopy(deviceInterfaceId); - - return internal::ToUpperTrimmedWStringCopy(GetStringSwdProperty(cleanId, STRING_PKEY_MIDI_VirtualMidiEndpointAssociator, L"")); - } - - - _Use_decl_annotations_ - std::wstring - GetSwdPropertyInstanceId(std::wstring deviceInterfaceId) - { - std::wstring cleanId = internal::NormalizeEndpointInterfaceIdWStringCopy(deviceInterfaceId); - - return internal::NormalizeDeviceInstanceIdWStringCopy(GetStringSwdProperty(cleanId, L"System.Devices.DeviceInstanceId", L"")); - } -} \ No newline at end of file diff --git a/src/api/Libs/MidiKs/MidiKS.vcxproj b/src/api/Libs/MidiKs/MidiKS.vcxproj index 367ce392..c163bef2 100644 --- a/src/api/Libs/MidiKs/MidiKS.vcxproj +++ b/src/api/Libs/MidiKs/MidiKS.vcxproj @@ -30,7 +30,7 @@ 17.0 {00B066CB-3F9F-4B31-B30A-48631B07D157} Win32Proj - 10.0.20348.0 + 10.0 @@ -134,7 +134,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -150,7 +150,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -165,7 +165,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -182,7 +182,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -197,7 +197,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -206,7 +206,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -227,12 +227,12 @@ - + 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/Libs/MidiKs/packages.config b/src/api/Libs/MidiKs/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Libs/MidiKs/packages.config +++ b/src/api/Libs/MidiKs/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Libs/MidiKsCommon/MidiKSCommon.vcxproj b/src/api/Libs/MidiKsCommon/MidiKSCommon.vcxproj index 0ddf0ef9..63400a00 100644 --- a/src/api/Libs/MidiKsCommon/MidiKSCommon.vcxproj +++ b/src/api/Libs/MidiKsCommon/MidiKSCommon.vcxproj @@ -30,7 +30,7 @@ 17.0 {0FB85768-237C-4A60-A824-E09884C3EB34} Win32Proj - 10.0.20348.0 + 10.0 @@ -123,7 +123,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc true - stdcpp17 + stdcpp20 @@ -132,7 +132,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc true - stdcpp17 + stdcpp20 @@ -141,7 +141,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc true - stdcpp17 + stdcpp20 @@ -150,7 +150,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc true - stdcpp17 + stdcpp20 @@ -159,7 +159,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc true - stdcpp17 + stdcpp20 @@ -168,7 +168,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc true - stdcpp17 + stdcpp20 @@ -182,12 +182,12 @@ - + 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/Libs/MidiKsCommon/packages.config b/src/api/Libs/MidiKsCommon/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Libs/MidiKsCommon/packages.config +++ b/src/api/Libs/MidiKsCommon/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Libs/MidiXProc/MidiXProc.vcxproj b/src/api/Libs/MidiXProc/MidiXProc.vcxproj index aac1796a..3feaa4c2 100644 --- a/src/api/Libs/MidiXProc/MidiXProc.vcxproj +++ b/src/api/Libs/MidiXProc/MidiXProc.vcxproj @@ -30,7 +30,7 @@ 17.0 {2480B077-46E5-42AE-9BDB-685AFF258529} Win32Proj - 10.0.22621.0 + 10.0 @@ -134,7 +134,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -150,7 +150,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -165,7 +165,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -182,7 +182,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 true @@ -197,7 +197,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -206,7 +206,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -227,12 +227,12 @@ - + 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/Libs/MidiXProc/packages.config b/src/api/Libs/MidiXProc/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Libs/MidiXProc/packages.config +++ b/src/api/Libs/MidiXProc/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Midi2.sln b/src/api/Midi2.sln index fed02a0d..02935998 100644 --- a/src/api/Midi2.sln +++ b/src/api/Midi2.sln @@ -8,7 +8,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.KSAbstraction", "Abst {0FB85768-237C-4A60-A824-E09884C3EB34} = {0FB85768-237C-4A60-A824-E09884C3EB34} {2480B077-46E5-42AE-9BDB-685AFF258529} = {2480B077-46E5-42AE-9BDB-685AFF258529} {3BD492AD-A08C-4923-9486-138189CA4A0A} = {3BD492AD-A08C-4923-9486-138189CA4A0A} - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject @@ -76,7 +75,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MidiSrv", "Service\Exe\Midi {366FA284-D8C0-4CC5-B9A3-917EAB967173} = {366FA284-D8C0-4CC5-B9A3-917EAB967173} {36E99993-ABE3-44CC-A776-B4E835B5EEC6} = {36E99993-ABE3-44CC-A776-B4E835B5EEC6} {3BD492AD-A08C-4923-9486-138189CA4A0A} = {3BD492AD-A08C-4923-9486-138189CA4A0A} - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {6D151BF5-40A2-4BD7-BB67-07D2741DA01E} = {6D151BF5-40A2-4BD7-BB67-07D2741DA01E} {7427BC7A-4247-42B0-AC9B-7DA10418AA9D} = {7427BC7A-4247-42B0-AC9B-7DA10418AA9D} {7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C} = {7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C} @@ -92,7 +90,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.MidiSrvAbstraction", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.SampleAbstraction", "Abstraction\SampleAbstraction\Midi2.SampleAbstraction.vcxproj", "{3D391727-2A65-4BA6-A730-EC10406AF543}" ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject @@ -120,13 +117,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MidiSWEnum", "Test\Libs\Mid EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.NetworkMidiAbstraction", "Abstraction\NetworkMidiAbstraction\Midi2.NetworkMidiAbstraction.vcxproj", "{7E618284-6AA0-4FCE-9E4A-D895A5EE8E3C}" ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.VirtualMidiAbstraction", "Abstraction\VirtualMidiAbstraction\Midi2.VirtualMidiAbstraction.vcxproj", "{03009B2B-E3E8-49DC-A0D6-0FA90AE3B15B}" ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject @@ -154,7 +149,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libraries", "libraries", "{ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.DiagnosticsAbstraction", "Abstraction\DiagnosticsAbstraction\Midi2.DiagnosticsAbstraction.vcxproj", "{093852BE-32B8-4EB8-814E-91410FFDB4F6}" ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject @@ -166,13 +160,11 @@ Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Midi2", "Midi2Setup\Midi2Se EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.VirtualPatchBayAbstraction", "Abstraction\VirtualPatchBayAbstraction\Midi2.VirtualPatchBayAbstraction.vcxproj", "{7427BC7A-4247-42B0-AC9B-7DA10418AA9D}" ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.BluetoothMidiAbstraction", "Abstraction\BleMidiAbstraction\Midi2.BluetoothMidiAbstraction.vcxproj", "{8795821B-541D-4B9B-BF7F-50CA976FC54E}" ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection EndProject @@ -245,12 +237,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "In-Box Apps", "In-Box Apps", "{67A42126-8502-4681-9ACC-B1417C527620}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.LoopbackMidiAbstraction", "Abstraction\LoopbackMidiAbstraction\Midi2.LoopbackMidiAbstraction.vcxproj", "{0F94A751-9159-4A88-8A71-347151124548}" - ProjectSection(ProjectDependencies) = postProject - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} - {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AbstractionUtilities", "Libs\AbstractionUtilities\AbstractionUtilities.vcxproj", "{60D2E061-FC7D-40FF-AD8C-4CB3D175A814}" ProjectSection(ProjectDependencies) = postProject {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} EndProjectSection @@ -1051,26 +1037,6 @@ Global {0F94A751-9159-4A88-8A71-347151124548}.Release|x64.Build.0 = Release|x64 {0F94A751-9159-4A88-8A71-347151124548}.Release|x86.ActiveCfg = Release|x64 {0F94A751-9159-4A88-8A71-347151124548}.Release|x86.Build.0 = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|Any CPU.ActiveCfg = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|Any CPU.Build.0 = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|ARM64.ActiveCfg = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|ARM64.Build.0 = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|ARM64EC.ActiveCfg = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|ARM64EC.Build.0 = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|x64.ActiveCfg = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|x64.Build.0 = Debug|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|x86.ActiveCfg = Debug|Win32 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Debug|x86.Build.0 = Debug|Win32 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|Any CPU.ActiveCfg = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|Any CPU.Build.0 = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|ARM64.ActiveCfg = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|ARM64.Build.0 = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|ARM64EC.ActiveCfg = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|ARM64EC.Build.0 = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|x64.ActiveCfg = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|x64.Build.0 = Release|x64 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|x86.ActiveCfg = Release|Win32 - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1118,7 +1084,6 @@ Global {16F34756-0269-4CEB-8F1C-32D9C6441990} = {6DB1D424-53D4-488F-8053-EBBD7D1F2E49} {5EC6D5EB-53D4-4731-891E-F746F0201429} = {67A42126-8502-4681-9ACC-B1417C527620} {0F94A751-9159-4A88-8A71-347151124548} = {69CC5CD9-47DC-4118-A3C7-E0D071407185} - {60D2E061-FC7D-40FF-AD8C-4CB3D175A814} = {A4512DDC-CB43-4774-80AA-3B5D13B50D75} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7F5A157F-9894-451D-B091-848921952166} diff --git a/src/api/Service/Exe/MidiConfigurationManager.cpp b/src/api/Service/Exe/MidiConfigurationManager.cpp index ed4f344e..52c79697 100644 --- a/src/api/Service/Exe/MidiConfigurationManager.cpp +++ b/src/api/Service/Exe/MidiConfigurationManager.cpp @@ -413,7 +413,7 @@ std::map CMidiConfigurationManager::GetTranspor // we treat this as an object where each abstraction id is a property - auto plugins = internal::JsonGetObjectProperty(jsonObject, MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT, nullptr); + auto plugins = jsonObject.GetNamedObject(MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT, nullptr); if (plugins == nullptr) { diff --git a/src/api/Service/Exe/MidiSessionTracker.cpp b/src/api/Service/Exe/MidiSessionTracker.cpp index 77ba6624..0d5633d6 100644 --- a/src/api/Service/Exe/MidiSessionTracker.cpp +++ b/src/api/Service/Exe/MidiSessionTracker.cpp @@ -163,20 +163,18 @@ CMidiSessionTracker::GetSessionListJson( BSTR* SessionList ) { - json::JsonObject rootObject; json::JsonArray sessionsArray{}; - for (auto sessionIter = m_sessions.begin(); sessionIter != m_sessions.end(); sessionIter++) { json::JsonObject sessionObject; internal::JsonSetGuidProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_ID_PROPERTY_KEY, sessionIter->second.SessionId); - internal::JsonSetWStringProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_NAME_PROPERTY_KEY, sessionIter->second.SessionName); - internal::JsonSetWStringProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_NAME_PROPERTY_KEY, sessionIter->second.ProcessName); - internal::JsonSetWStringProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_ID_PROPERTY_KEY, std::to_wstring(sessionIter->second.ClientProcessId)); + sessionObject.SetNamedValue(MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_NAME_PROPERTY_KEY, json::JsonValue::CreateStringValue(sessionIter->second.SessionName)); + sessionObject.SetNamedValue(MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_NAME_PROPERTY_KEY, json::JsonValue::CreateStringValue(sessionIter->second.ProcessName)); + sessionObject.SetNamedValue(MIDI_SESSION_TRACKER_JSON_RESULT_PROCESS_ID_PROPERTY_KEY, json::JsonValue::CreateStringValue(std::to_wstring(sessionIter->second.ClientProcessId))); internal::JsonSetDateTimeProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_TIME_PROPERTY_KEY, sessionIter->second.StartTime); // now add all the client connections @@ -188,8 +186,8 @@ CMidiSessionTracker::GetSessionListJson( json::JsonObject connectionObject; internal::JsonSetDateTimeProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_TIME_PROPERTY_KEY, connectionIter->second.EarliestStartTime); - internal::JsonSetDoubleProperty(connectionObject, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_COUNT_PROPERTY_KEY, connectionIter->second.InstanceCount); - internal::JsonSetWStringProperty(connectionObject, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ENDPOINT_ID_PROPERTY_KEY, connectionIter->second.ConnectedEndpointInterfaceId); + connectionObject.SetNamedValue(MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_COUNT_PROPERTY_KEY, json::JsonValue::CreateNumberValue(connectionIter->second.InstanceCount)); + connectionObject.SetNamedValue(MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ENDPOINT_ID_PROPERTY_KEY, json::JsonValue::CreateStringValue(connectionIter->second.ConnectedEndpointInterfaceId)); connectionsArray.Append(connectionObject); } @@ -197,7 +195,7 @@ CMidiSessionTracker::GetSessionListJson( // append the connections array only if we have some if (connectionsArray.Size() > 0) { - internal::JsonSetArrayProperty(sessionObject, MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ARRAY_PROPERTY_KEY, connectionsArray); + sessionObject.SetNamedValue(MIDI_SESSION_TRACKER_JSON_RESULT_CONNECTION_ARRAY_PROPERTY_KEY, connectionsArray); } sessionsArray.Append(sessionObject); diff --git a/src/api/Service/Exe/MidiSrv.cpp b/src/api/Service/Exe/MidiSrv.cpp index e71047b6..f7c133c1 100644 --- a/src/api/Service/Exe/MidiSrv.cpp +++ b/src/api/Service/Exe/MidiSrv.cpp @@ -91,12 +91,23 @@ CMidiSrv::Initialize() &rpcSecurityDescriptor, NULL)); + + // this is an ugly set of casts, but the reinterpret_cast error only + // comes up with C++/20. Risk of a straight c-style cast here going + // poorly is low. Error comes from the function taking non-const params + // but our arguments here are const. RETURN_IF_FAILED(HRESULT_FROM_RPCSTATUS(RpcServerUseProtseqEp( (RPC_WSTR)MIDISRV_LRPC_PROTOCOL, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, (RPC_WSTR)MIDISRV_ENDPOINT, rpcSecurityDescriptor.get()))); + //RETURN_IF_FAILED(HRESULT_FROM_RPCSTATUS(RpcServerUseProtseqEp( + // reinterpret_cast(MIDISRV_LRPC_PROTOCOL), + // RPC_C_PROTSEQ_MAX_REQS_DEFAULT, + // reinterpret_cast(MIDISRV_ENDPOINT), + // rpcSecurityDescriptor.get()))); + RETURN_IF_FAILED(HRESULT_FROM_RPCSTATUS(RpcServerRegisterIf3( MidiSrvRPC_v1_0_s_ifspec, NULL, NULL, diff --git a/src/api/Service/Exe/MidiSrv.vcxproj b/src/api/Service/Exe/MidiSrv.vcxproj index 7ee2743d..15039a27 100644 --- a/src/api/Service/Exe/MidiSrv.vcxproj +++ b/src/api/Service/Exe/MidiSrv.vcxproj @@ -137,7 +137,7 @@ Level4 true - stdcpp17 + stdcpp20 $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ @@ -146,7 +146,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -154,7 +154,7 @@ Level4 true - stdcpp17 + stdcpp20 $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ @@ -163,7 +163,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -181,7 +181,7 @@ Level4 true - stdcpp17 + stdcpp20 $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ @@ -190,7 +190,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -198,7 +198,7 @@ Level4 true - stdcpp17 + stdcpp20 $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ @@ -207,7 +207,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -220,7 +220,7 @@ Level4 true - stdcpp17 + stdcpp20 Stub @@ -231,7 +231,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -244,7 +244,7 @@ Level4 true - stdcpp17 + stdcpp20 $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ @@ -253,7 +253,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -309,12 +309,12 @@ - + 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/Service/Exe/packages.config b/src/api/Service/Exe/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Service/Exe/packages.config +++ b/src/api/Service/Exe/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Service/Exe/stdafx.h b/src/api/Service/Exe/stdafx.h index 9e089d9c..8c3f681d 100644 --- a/src/api/Service/Exe/stdafx.h +++ b/src/api/Service/Exe/stdafx.h @@ -42,21 +42,25 @@ #include "SWDevice.h" #include #include +#include "devpkey.h" // Shared helpers #include "midi_ump.h" #include "midi_timestamp.h" -#include "wstring_util.h" // AbstractionUtilities -#include "endpoint_data_helpers.h" -#include "swd_property_builders.h" -#include "json_helpers.h" +#include "wstring_util.h" +namespace internal = ::Windows::Devices::Midi2::Internal; -// Main definitions #include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "json_defs.h" +#include "json_helpers.h" +#include "swd_helpers.h" -namespace internal = ::Windows::Devices::Midi2::Internal; namespace shared = ::Windows::Devices::Midi2::Internal::Shared; #include "resource.h" diff --git a/src/api/Test/Libs/MidiKSEnum/MidiKSEnum.vcxproj b/src/api/Test/Libs/MidiKSEnum/MidiKSEnum.vcxproj index dbee8601..654e5155 100644 --- a/src/api/Test/Libs/MidiKSEnum/MidiKSEnum.vcxproj +++ b/src/api/Test/Libs/MidiKSEnum/MidiKSEnum.vcxproj @@ -30,7 +30,7 @@ 17.0 {3BD492AD-A08C-4923-9486-138189CA4A0A} Win32Proj - 10.0.20348.0 + 10.0 @@ -123,7 +123,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc true - stdcpp17 + stdcpp20 @@ -132,7 +132,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc true - stdcpp17 + stdcpp20 @@ -141,7 +141,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc true - stdcpp17 + stdcpp20 @@ -150,7 +150,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc true - stdcpp17 + stdcpp20 @@ -159,7 +159,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc true - stdcpp17 + stdcpp20 @@ -168,7 +168,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc true - stdcpp17 + stdcpp20 @@ -182,12 +182,12 @@ - + 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/Test/Libs/MidiKSEnum/packages.config b/src/api/Test/Libs/MidiKSEnum/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Test/Libs/MidiKSEnum/packages.config +++ b/src/api/Test/Libs/MidiKSEnum/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/Libs/MidiSWEnum/MidiSWEnum.vcxproj b/src/api/Test/Libs/MidiSWEnum/MidiSWEnum.vcxproj index ee3ddd44..070f35f4 100644 --- a/src/api/Test/Libs/MidiSWEnum/MidiSWEnum.vcxproj +++ b/src/api/Test/Libs/MidiSWEnum/MidiSWEnum.vcxproj @@ -123,7 +123,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 Disabled @@ -133,7 +133,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -142,7 +142,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -151,7 +151,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -160,7 +160,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -169,7 +169,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)\inc;$(SolutionDir)\test\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -183,12 +183,12 @@ - + 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/Test/Libs/MidiSWEnum/packages.config b/src/api/Test/Libs/MidiSWEnum/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Test/Libs/MidiSWEnum/packages.config +++ b/src/api/Test/Libs/MidiSWEnum/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/Libs/MidiTestCommon/MidiTestCommon.vcxproj b/src/api/Test/Libs/MidiTestCommon/MidiTestCommon.vcxproj index 7cb1dc0a..b0d5fef3 100644 --- a/src/api/Test/Libs/MidiTestCommon/MidiTestCommon.vcxproj +++ b/src/api/Test/Libs/MidiTestCommon/MidiTestCommon.vcxproj @@ -100,7 +100,7 @@ Disabled %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)test\inc; true - stdcpp17 + stdcpp20 true @@ -115,7 +115,7 @@ ProgramDatabase %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)test\inc; true - stdcpp17 + stdcpp20 true @@ -130,7 +130,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)test\inc; true - stdcpp17 + stdcpp20 Disabled @@ -140,7 +140,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)test\inc; true - stdcpp17 + stdcpp20 @@ -159,12 +159,12 @@ - + 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/Test/Libs/MidiTestCommon/packages.config b/src/api/Test/Libs/MidiTestCommon/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Test/Libs/MidiTestCommon/packages.config +++ b/src/api/Test/Libs/MidiTestCommon/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/Midi2.Abstraction.unittests/Midi2.Abstraction.unittests.vcxproj b/src/api/Test/Midi2.Abstraction.unittests/Midi2.Abstraction.unittests.vcxproj index 68b7e4d5..314fb1e9 100644 --- a/src/api/Test/Midi2.Abstraction.unittests/Midi2.Abstraction.unittests.vcxproj +++ b/src/api/Test/Midi2.Abstraction.unittests/Midi2.Abstraction.unittests.vcxproj @@ -92,7 +92,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) Level4 true - stdcpp17 + stdcpp20 %(AdditionalDependencies);midixproc.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midikscommon.lib;midiswenum.lib;miditestcommon.lib;$(CoreLibraryDependencies) @@ -103,7 +103,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) Level4 true - stdcpp17 + stdcpp20 %(AdditionalDependencies);midixproc.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midikscommon.lib;midiswenum.lib;miditestcommon.lib;$(CoreLibraryDependencies) @@ -118,7 +118,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 @@ -149,12 +149,12 @@ - + 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/Test/Midi2.Abstraction.unittests/packages.config b/src/api/Test/Midi2.Abstraction.unittests/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Test/Midi2.Abstraction.unittests/packages.config +++ b/src/api/Test/Midi2.Abstraction.unittests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/Midi2.Abstraction.unittests/stdafx.h b/src/api/Test/Midi2.Abstraction.unittests/stdafx.h index fe629f7d..1613ce82 100644 --- a/src/api/Test/Midi2.Abstraction.unittests/stdafx.h +++ b/src/api/Test/Midi2.Abstraction.unittests/stdafx.h @@ -1,6 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. #pragma once + +// this is a hack, but because this is a test project, and know we're not +// using coroutines in our tests, we'll risk it. +#define _ALLOW_COROUTINE_ABI_MISMATCH + + #include #include #include diff --git a/src/api/Test/Midi2.Client.benchmarks/Midi2.Client.benchmarks.vcxproj b/src/api/Test/Midi2.Client.benchmarks/Midi2.Client.benchmarks.vcxproj index 4c224806..4c267b1b 100644 --- a/src/api/Test/Midi2.Client.benchmarks/Midi2.Client.benchmarks.vcxproj +++ b/src/api/Test/Midi2.Client.benchmarks/Midi2.Client.benchmarks.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -23,7 +23,7 @@ 17.0 {4DABE157-7DD5-422A-8C77-B83EAC9987D0} Win32Proj - 10.0.20348.0 + 10.0 true true true @@ -171,15 +171,15 @@ - - + + 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/Test/Midi2.Client.benchmarks/MidiBenchmarks.cpp b/src/api/Test/Midi2.Client.benchmarks/MidiBenchmarks.cpp index 712d0d55..832a84dd 100644 --- a/src/api/Test/Midi2.Client.benchmarks/MidiBenchmarks.cpp +++ b/src/api/Test/Midi2.Client.benchmarks/MidiBenchmarks.cpp @@ -132,7 +132,7 @@ void MidiBenchmarks::BenchmarkSendReceiveWordArray() } numBytes += sizeof(uint32_t) * wordCount + sizeof(uint64_t); - connSend.SendMessageWordArray(MidiClock::Now(), words, 0, (uint8_t)wordCount); + connSend.SendSingleMessageWordArray(MidiClock::Now(), 0, (uint8_t)wordCount, words); } uint64_t sendingFinishTimestamp = MidiClock::Now(); @@ -389,7 +389,7 @@ void MidiBenchmarks::BenchmarkSendReceiveUmpRuntimeClass() } ump.Timestamp(MidiClock::Now()); - connSend.SendMessagePacket(ump); + connSend.SendSingleMessagePacket(ump); } diff --git a/src/api/Test/Midi2.Client.benchmarks/MidiSchedulerBenchmarks.cpp b/src/api/Test/Midi2.Client.benchmarks/MidiSchedulerBenchmarks.cpp index ebf0fd2d..f9106b8d 100644 --- a/src/api/Test/Midi2.Client.benchmarks/MidiSchedulerBenchmarks.cpp +++ b/src/api/Test/Midi2.Client.benchmarks/MidiSchedulerBenchmarks.cpp @@ -135,7 +135,7 @@ void MidiSchedulerBenchmarks::BenchmarkSendReceiveScheduledMessages(_In_ uint32_ auto timeStamp = MidiClock::OffsetTimestampByMilliseconds(MidiClock::Now(), offsetMilliseconds); - connSend.SendMessageWordArray(timeStamp, words, 0, (uint8_t)wordCount); + connSend.SendSingleMessageWordArray(timeStamp, 0, (uint8_t)wordCount, words); } // Wait for incoming message diff --git a/src/api/Test/Midi2.Client.benchmarks/packages.config b/src/api/Test/Midi2.Client.benchmarks/packages.config index 2884a839..1b706ca9 100644 --- a/src/api/Test/Midi2.Client.benchmarks/packages.config +++ b/src/api/Test/Midi2.Client.benchmarks/packages.config @@ -1,4 +1,5 @@  - + + \ No newline at end of file diff --git a/src/api/Test/Midi2.Client.benchmarks/stdafx.h b/src/api/Test/Midi2.Client.benchmarks/stdafx.h index 2552d5b3..a72e720d 100644 --- a/src/api/Test/Midi2.Client.benchmarks/stdafx.h +++ b/src/api/Test/Midi2.Client.benchmarks/stdafx.h @@ -1,6 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. #pragma once + +#ifndef STDAFX_H +#define STDAFX_H + + #include #include @@ -37,3 +42,4 @@ using namespace winrt::Windows::Devices::Midi2; +#endif \ No newline at end of file diff --git a/src/api/Test/Midi2.Client.unittests/Midi2.Client.unittests.vcxproj b/src/api/Test/Midi2.Client.unittests/Midi2.Client.unittests.vcxproj index 67238690..9485bf94 100644 --- a/src/api/Test/Midi2.Client.unittests/Midi2.Client.unittests.vcxproj +++ b/src/api/Test/Midi2.Client.unittests/Midi2.Client.unittests.vcxproj @@ -1,6 +1,6 @@ - + Debug @@ -23,7 +23,7 @@ 17.0 {14F12F86-9BDE-4DA3-B295-7FD990080E57} Win32Proj - 10.0.20348.0 + 10.0 true true true @@ -191,15 +191,15 @@ - - + + 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/Test/Midi2.Client.unittests/MidiClockTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiClockTests.cpp index 7068fd4c..83b129fa 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiClockTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiClockTests.cpp @@ -9,9 +9,6 @@ #include "stdafx.h" -#include "MidiClockTests.h" - - using namespace winrt::Windows::Devices::Midi2; diff --git a/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionBufferTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionBufferTests.cpp index 2d20aa6b..1c1f0fae 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionBufferTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionBufferTests.cpp @@ -10,11 +10,6 @@ #include "stdafx.h" -#include "MidiEndpointConnectionBufferTests.h" - - -#include - using namespace winrt::Windows::Devices::Midi2; @@ -64,7 +59,7 @@ void MidiEndpointConnectionBufferTests::TestSendBuffer() *sendBufferWordPointer = 0x41234567; *(sendBufferWordPointer + 1) = 0xDEADBEEF; - auto result = connSend.SendMessageBuffer(0, sendBuffer, byteOffset, numBytes); + auto result = connSend.SendSingleMessageBuffer(MidiClock::TimestampConstantSendImmediately(), byteOffset, numBytes, sendBuffer); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(result)); //VERIFY_IS_TRUE((result & MidiSendMessageResult::DataIndexOutOfRange) == MidiSendMessageResult::DataIndexOutOfRange); @@ -151,7 +146,7 @@ void MidiEndpointConnectionBufferTests::TestSendAndReceiveBuffer() VERIFY_IS_NOT_NULL(sender); VERIFY_IS_NOT_NULL(args); - auto receivedByteCount = args.FillBuffer(receiveBuffer, receiveByteOffset); + auto receivedByteCount = args.FillBuffer(receiveByteOffset, receiveBuffer); VERIFY_ARE_EQUAL(sentByteCount, receivedByteCount); @@ -172,7 +167,7 @@ void MidiEndpointConnectionBufferTests::TestSendAndReceiveBuffer() VERIFY_IS_TRUE(connReceive.Open()); - auto result = connSend.SendMessageBuffer(0, sendBuffer, sentByteOffset, numBytes); + auto result = connSend.SendSingleMessageBuffer(MidiClock::TimestampConstantSendImmediately(), sentByteOffset, numBytes, sendBuffer); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(result)); @@ -236,7 +231,7 @@ void MidiEndpointConnectionBufferTests::TestSendBufferBoundsError() *sendBufferWordPointer = 0x41234567; //*(sendBufferWordPointer + 1) = 0xDEADBEEF; - auto result = connSend.SendMessageBuffer(0, sendBuffer, byteOffset, numBytes); + auto result = connSend.SendSingleMessageBuffer(MidiClock::TimestampConstantSendImmediately(), byteOffset, numBytes, sendBuffer); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageFailed(result)); VERIFY_IS_TRUE((result & MidiSendMessageResult::DataIndexOutOfRange) == MidiSendMessageResult::DataIndexOutOfRange); @@ -384,7 +379,7 @@ void MidiEndpointConnectionBufferTests::TestSendAndReceiveMultipleMessagesBuffer VERIFY_IS_TRUE(connReceive.Open()); - auto result = connSend.SendMultipleMessagesBuffer(MidiClock::TimestampConstantSendImmediately(), sendBuffer, sentByteOffset, numBytesSent); + auto result = connSend.SendMultipleMessagesBuffer(MidiClock::TimestampConstantSendImmediately(), sentByteOffset, numBytesSent, sendBuffer); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(result)); diff --git a/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionTests.cpp index 1e8a3ac9..5c78c2f4 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiEndpointConnectionTests.cpp @@ -10,11 +10,6 @@ #include "stdafx.h" -#include "MidiEndpointConnectionTests.h" - - -#include - using namespace winrt::Windows::Devices::Midi2; @@ -33,7 +28,7 @@ void MidiEndpointConnectionTests::TestSendMessageInvalidConnectionFailureReturnC // wrong message type for word count - auto connectionClosedResult = connSend.SendMessageWords(0, 0x21111111); + auto connectionClosedResult = connSend.SendSingleMessageWords(0, 0x21111111); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageFailed(connectionClosedResult)); VERIFY_IS_TRUE((connectionClosedResult & MidiSendMessageResult::EndpointConnectionClosedOrInvalid) == MidiSendMessageResult::EndpointConnectionClosedOrInvalid); @@ -61,7 +56,7 @@ void MidiEndpointConnectionTests::TestSendMessageValidationFailureReturnCode() // wrong message type for word count - auto badMessageTypeResult = connSend.SendMessageWords(0, 0x41111111); + auto badMessageTypeResult = connSend.SendSingleMessageWords(0, 0x41111111); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageFailed(badMessageTypeResult)); VERIFY_IS_TRUE((badMessageTypeResult & MidiSendMessageResult::InvalidMessageTypeForWordCount) == MidiSendMessageResult::InvalidMessageTypeForWordCount); @@ -236,7 +231,7 @@ void MidiEndpointConnectionTests::TestSendAndReceiveUmpStruct() std::cout << " - Timestamp: 0x" << std::hex << (uint64_t)(sentTimestamp) << std::endl; std::cout << " - First Word: 0x" << std::hex << (sentUmp.Word0) << std::endl << std::endl; - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageStruct(sentTimestamp, sentUmp, 2))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageStruct(sentTimestamp, 2, sentUmp))); // Wait for incoming message @@ -331,7 +326,7 @@ void MidiEndpointConnectionTests::TestSendAndReceiveUmp32() std::cout << " - MessageType: 0x" << std::hex << (uint8_t)(sentUmp.MessageType()) << std::endl; std::cout << " - First Word: 0x" << std::hex << (sentUmp.Word0()) << std::endl << std::endl; - connSend.SendMessagePacket(sentUmp); + connSend.SendSingleMessagePacket(sentUmp); // Wait for incoming message @@ -449,7 +444,7 @@ void MidiEndpointConnectionTests::TestSendAndReceiveWords() std::cout << "Sending UMP Word Array" << std::endl; - auto result = connSend.SendMessageWordArray(timestamp, words, 0, wordCount); + auto result = connSend.SendSingleMessageWordArray(timestamp, 0, wordCount, words); std::cout << "Send result: 0x" << std::hex << (uint32_t)result << std::endl; VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(result)); @@ -739,7 +734,7 @@ void MidiEndpointConnectionTests::TestSendWordArrayBoundsError() VERIFY_IS_TRUE(connSend.Open()); // out of bounds - auto result = connSend.SendMessageWordArray(0, sendBuffer, 3, 2); + auto result = connSend.SendSingleMessageWordArray(MidiClock::TimestampConstantSendImmediately(), 3, 2, sendBuffer); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageFailed(result)); VERIFY_IS_TRUE((result & MidiSendMessageResult::DataIndexOutOfRange) == MidiSendMessageResult::DataIndexOutOfRange); @@ -785,7 +780,7 @@ void MidiEndpointConnectionTests::TestSendAndReceiveWordArray() VERIFY_IS_NOT_NULL(args); // testing that we fill at the correct offset - auto wordCount = args.FillWordArray(receiveBuffer, receiveIndex); + auto wordCount = args.FillWordArray(receiveIndex, receiveBuffer); VERIFY_ARE_EQUAL(sentWordCount, wordCount); @@ -805,7 +800,7 @@ void MidiEndpointConnectionTests::TestSendAndReceiveWordArray() VERIFY_IS_TRUE(connSend.Open()); VERIFY_IS_TRUE(connReceive.Open()); - auto result = connSend.SendMessageWordArray(0, sendBuffer, sentIndex, sentWordCount); + auto result = connSend.SendSingleMessageWordArray(MidiClock::TimestampConstantSendImmediately(), sentIndex, sentWordCount, sendBuffer); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(result)); diff --git a/src/api/Test/Midi2.Client.unittests/MidiEndpointCreationThreadTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiEndpointCreationThreadTests.cpp index 0343011a..3b84a2cc 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiEndpointCreationThreadTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiEndpointCreationThreadTests.cpp @@ -1,11 +1,8 @@ #include "stdafx.h" -#include "MidiEndpointCreationThreadTests.h" -#include - #define NUM_MESSAGES_TO_TRANSMIT 10 @@ -79,7 +76,7 @@ void MidiEndpointCreationThreadTests::SendThreadWorker(MidiSession session, winr for (uint32_t i = 0; i < NUM_MESSAGES_TO_TRANSMIT; i++) { - connection.SendMessageWords(MidiClock::TimestampConstantSendImmediately(), 0x21234567); + connection.SendSingleMessageWords(MidiClock::TimestampConstantSendImmediately(), 0x21234567); } diff --git a/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.cpp index 105a5fa8..198bef26 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.cpp @@ -9,15 +9,13 @@ #include "stdafx.h" -#include "MidiEndpointDeviceWatcherTests.h" - using namespace winrt::Windows::Devices::Midi2; _Use_decl_annotations_ -void MidiEndpointDeviceWatcherTests::TestWatcherEnumeration(MidiEndpointDeviceInformationFilter filter, uint32_t numEndpointsExpected) +void MidiEndpointDeviceWatcherTests::TestWatcherEnumeration(MidiEndpointDeviceInformationFilters filter, uint32_t numEndpointsExpected) { wil::unique_event_nothrow enumerationCompleted; enumerationCompleted.create(); @@ -41,13 +39,13 @@ void MidiEndpointDeviceWatcherTests::TestWatcherEnumeration(MidiEndpointDeviceIn auto enumerationCompletedEventRevokeToken = watcher.EnumerationCompleted(EnumerationCompletedHandler); - auto EndpointDeviceAddedHandler = [&](MidiEndpointDeviceWatcher const& /*sender*/, MidiEndpointDeviceInformation const& addedDevice) + auto EndpointDeviceAddedHandler = [&](MidiEndpointDeviceWatcher const& /*sender*/, MidiEndpointDeviceInformationAddedEventArgs const& args) { std::cout << "Device Added event raised." << std::endl; - std::cout << "Id: " << winrt::to_string(addedDevice.Id()) << std::endl; - std::cout << "Name: " << winrt::to_string(addedDevice.Name()) << std::endl; - std::cout << "Transport Desc: " << winrt::to_string(addedDevice.TransportSuppliedDescription()) << std::endl; - std::cout << "User Desc: " << winrt::to_string(addedDevice.UserSuppliedDescription()) << std::endl; + std::cout << "Id: " << winrt::to_string(args.AddedDevice().Id()) << std::endl; + std::cout << "Name: " << winrt::to_string(args.AddedDevice().Name()) << std::endl; + std::cout << "Transport Desc: " << winrt::to_string(args.AddedDevice().TransportSuppliedDescription()) << std::endl; + std::cout << "User Desc: " << winrt::to_string(args.AddedDevice().UserSuppliedDescription()) << std::endl; std::cout << std::endl; numEndpointsActual++; @@ -83,14 +81,14 @@ void MidiEndpointDeviceWatcherTests::TestWatcherEnumeration(MidiEndpointDeviceIn void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationAllDiagnosticsEndpoints() { TestWatcherEnumeration( - MidiEndpointDeviceInformationFilter::IncludeDiagnosticLoopback | MidiEndpointDeviceInformationFilter::IncludeDiagnosticPing, + MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback | MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing, 3); } void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationPingEndpoint() { TestWatcherEnumeration( - MidiEndpointDeviceInformationFilter::IncludeDiagnosticPing, + MidiEndpointDeviceInformationFilters::IncludeDiagnosticPing, 1); } @@ -98,9 +96,9 @@ void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationPingEndpoint() void MidiEndpointDeviceWatcherTests::TestWatcherEnumerationLoopbackEndpoints() { TestWatcherEnumeration( - MidiEndpointDeviceInformationFilter::IncludeDiagnosticLoopback, + MidiEndpointDeviceInformationFilters::IncludeDiagnosticLoopback, 2); } -// can't really test device plug/unplug here because it's interactive and this test is run automated \ No newline at end of file +// can't really test device plug/unplug or update here because it's interactive and this test is run automated \ No newline at end of file diff --git a/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.h b/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.h index f1f6b413..e0515746 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.h +++ b/src/api/Test/Midi2.Client.unittests/MidiEndpointDeviceWatcherTests.h @@ -32,7 +32,7 @@ class MidiEndpointDeviceWatcherTests TEST_METHOD(TestWatcherEnumerationAllDiagnosticsEndpoints); - void TestWatcherEnumeration(_In_ MidiEndpointDeviceInformationFilter filter, _In_ uint32_t numEndpointsExpected); + void TestWatcherEnumeration(_In_ MidiEndpointDeviceInformationFilters filter, _In_ uint32_t numEndpointsExpected); private: diff --git a/src/api/Test/Midi2.Client.unittests/MidiEndpointListenerTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiEndpointListenerTests.cpp index 86ee7e92..77aea2d0 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiEndpointListenerTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiEndpointListenerTests.cpp @@ -9,8 +9,6 @@ #include "stdafx.h" -#include "MidiEndpointListenerTests.h" - void MidiEndpointListenerTests::TestMessageTypeListener() { @@ -88,13 +86,13 @@ void MidiEndpointListenerTests::TestMessageTypeListener() std::cout << "Sending messages" << std::endl; - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x1DEDBEEF))); // no match - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x41234567, 0x12345678))); - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x23263827))); - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0xF1234567, 0x00000000, 0x11111111, 0x12345678))); // no match - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x48675309, 0x12345678))); - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x28675309))); - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x0BEEFDED))); // no match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x1DEDBEEF))); // no match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x41234567, 0x12345678))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x23263827))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0xF1234567, 0x00000000, 0x11111111, 0x12345678))); // no match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x48675309, 0x12345678))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x28675309))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x0BEEFDED))); // no match expectedMatchingMessageCount = 4; @@ -206,13 +204,13 @@ void MidiEndpointListenerTests::TestGroupListener() std::cout << "Sending messages" << std::endl; - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x1DEDBEEF))); // no match - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x4B234567, 0x12345678))); // match, CV message - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x23263827))); // match, CV message - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0xF1234567, 0x00000000, 0x11111111, 0x12345678))); // no match - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x43675309, 0x12345678))); // match, CV message - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x23675309))); // match, CV message - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x03EEFDED))); // no match because of message type + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x1DEDBEEF))); // no match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x4B234567, 0x12345678))); // match, CV message + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x23263827))); // match, CV message + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0xF1234567, 0x00000000, 0x11111111, 0x12345678))); // no match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x43675309, 0x12345678))); // match, CV message + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x23675309))); // match, CV message + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x03EEFDED))); // no match because of message type expectedMatchingMessageCount = 4; @@ -330,13 +328,13 @@ void MidiEndpointListenerTests::TestGroupAndChannelListener() std::cout << "Sending messages" << std::endl; - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x15EDBEEF))); - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x45234567, 0x12345678))); // match - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x252B3827))); // match - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0xF5234567, 0x00000000, 0x11111111, 0x12345678))); // not a match, type F - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x44635309, 0x12345678))); // not a match, wrong group - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x24635309))); // not a match, wrong group - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(MidiClock::Now(), 0x04EBFDED))); // not a match, due to message type + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x15EDBEEF))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x45234567, 0x12345678))); // match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x252B3827))); // match + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0xF5234567, 0x00000000, 0x11111111, 0x12345678))); // not a match, type F + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x44635309, 0x12345678))); // not a match, wrong group + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x24635309))); // not a match, wrong group + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(MidiClock::Now(), 0x04EBFDED))); // not a match, due to message type expectedMatchingMessageCount = 2; diff --git a/src/api/Test/Midi2.Client.unittests/MidiFunctionBlockMessageBuilderTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiFunctionBlockMessageBuilderTests.cpp index ba05568a..6769efc7 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiFunctionBlockMessageBuilderTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiFunctionBlockMessageBuilderTests.cpp @@ -10,8 +10,6 @@ #include "stdafx.h" -#include "MidiFunctionBlockMessageBuilderTests.h" - using namespace winrt::Windows::Devices::Midi2; diff --git a/src/api/Test/Midi2.Client.unittests/MidiMessageBuilderTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiMessageBuilderTests.cpp index e594ad08..d5cd44f6 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiMessageBuilderTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiMessageBuilderTests.cpp @@ -9,10 +9,6 @@ #include "stdafx.h" - -#include "MidiMessageBuilderTests.h" - - void MidiMessageBuilderTests::TestBuildType0UtilityMessages() { uint8_t status = 0x0D; @@ -42,7 +38,7 @@ void MidiMessageBuilderTests::TestBuildType1SystemMessages() auto message = MidiMessageBuilder::BuildSystemMessage( MidiClock::Now(), - group, + MidiGroup(group), status, midiByte2, midiByte3 @@ -67,9 +63,9 @@ void MidiMessageBuilderTests::TestBuildType2Midi1ChannelVoiceMessages() auto ump = MidiMessageBuilder::BuildMidi1ChannelVoiceMessage( MidiClock::Now(), - grp.Index(), + grp, status, - ch.Index(), + ch, note, velocity); @@ -98,9 +94,9 @@ void MidiMessageBuilderTests::TestBuildType4Midi2ChannelVoiceMessages() auto ump = MidiMessageBuilder::BuildMidi2ChannelVoiceMessage( MidiClock::Now(), - grp.Index(), + grp, status, - ch.Index(), + ch, index, data ); @@ -194,7 +190,7 @@ void MidiMessageBuilderTests::TestBuildMixedDatasetHeaderMessage() auto ump = MidiMessageBuilder::BuildMixedDataSetChunkHeaderMessage( MidiClock::Now(), - group, + MidiGroup(group), mdsId, numberOfValidBytesInChunk, numberOfChunksInDatSet, @@ -227,7 +223,7 @@ void MidiMessageBuilderTests::TestBuildMixedDatasetPayloadMessage() auto ump = MidiMessageBuilder::BuildMixedDataSetChunkDataMessage( MidiClock::Now(), - group, + MidiGroup(group), mdsId, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E ); diff --git a/src/api/Test/Midi2.Client.unittests/MidiMessagePacketTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiMessagePacketTests.cpp index 4cba3c46..a18b7b2e 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiMessagePacketTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiMessagePacketTests.cpp @@ -10,9 +10,6 @@ #include "stdafx.h" -#include "MidiMessagePacketTests.h" - - using namespace winrt::Windows::Devices::Midi2; void MidiMessagePacketTests::TestUmp32() diff --git a/src/api/Test/Midi2.Client.unittests/MidiMessageSchedulerTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiMessageSchedulerTests.cpp index b4d6376a..071dd5f9 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiMessageSchedulerTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiMessageSchedulerTests.cpp @@ -9,8 +9,6 @@ #include "stdafx.h" -#include "MidiMessageSchedulerTests.h" - void MidiMessageSchedulerTests::TestScheduledMessagesTimingSmall() { LOG_OUTPUT(L"Test timing small **********************************************************************"); @@ -109,7 +107,7 @@ void MidiMessageSchedulerTests::TestScheduledMessagesTiming(uint16_t const messa // we increment the message value each time so we can keep track of order as well - auto sendResult = connSend.SendMessageWords(MidiClock::OffsetTimestampByMilliseconds(MidiClock::Now(), scheduledTimeStampOffsetMS), word); + auto sendResult = connSend.SendSingleMessageWords(MidiClock::OffsetTimestampByMilliseconds(MidiClock::Now(), scheduledTimeStampOffsetMS), word); VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(sendResult)); @@ -225,7 +223,7 @@ void MidiMessageSchedulerTests::TestScheduledMessagesOrder() std::cout << "Sending: 0x" << std::hex << word << std::endl; // we increment the message value each time so we can keep track of order - VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendMessageWords(scheduledTimeStamp, word))); + VERIFY_IS_TRUE(MidiEndpointConnection::SendMessageSucceeded(connSend.SendSingleMessageWords(scheduledTimeStamp, word))); } std::cout << "Waiting for response" << std::endl; diff --git a/src/api/Test/Midi2.Client.unittests/MidiSessionTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiSessionTests.cpp index 470180d8..39276ca8 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiSessionTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiSessionTests.cpp @@ -9,8 +9,6 @@ #include "stdafx.h" -#include "MidiSessionTests.h" - using namespace winrt::Windows::Devices::Midi2; void MidiSessionTests::TestCreateNewSessionWithoutSettings() diff --git a/src/api/Test/Midi2.Client.unittests/MidiStreamMessageBuilderTests.cpp b/src/api/Test/Midi2.Client.unittests/MidiStreamMessageBuilderTests.cpp index b41374f9..ca9b07e1 100644 --- a/src/api/Test/Midi2.Client.unittests/MidiStreamMessageBuilderTests.cpp +++ b/src/api/Test/Midi2.Client.unittests/MidiStreamMessageBuilderTests.cpp @@ -9,9 +9,6 @@ #include "stdafx.h" - -#include "MidiStreamMessageBuilderTests.h" - using namespace winrt::Windows::Devices::Midi2; void MidiStreamMessageBuilderTests::TestBuildEndpointNameNotificationLong() diff --git a/src/api/Test/Midi2.Client.unittests/packages.config b/src/api/Test/Midi2.Client.unittests/packages.config index 14c63219..e9c036c6 100644 --- a/src/api/Test/Midi2.Client.unittests/packages.config +++ b/src/api/Test/Midi2.Client.unittests/packages.config @@ -1,4 +1,5 @@  - + + \ No newline at end of file diff --git a/src/api/Test/Midi2.Client.unittests/stdafx.h b/src/api/Test/Midi2.Client.unittests/stdafx.h index 315da31e..de520a9f 100644 --- a/src/api/Test/Midi2.Client.unittests/stdafx.h +++ b/src/api/Test/Midi2.Client.unittests/stdafx.h @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. #pragma once +#ifndef STDAFX_H +#define STDAFX_H + #include #include @@ -20,7 +23,22 @@ #include "loopback_ids.h" #include "MidiDefs.h" + +#include "MidiClockTests.h" +#include "MidiEndpointConnectionBufferTests.h" +#include "MidiEndpointConnectionTests.h" +#include "MidiEndpointCreationThreadTests.h" +#include "MidiEndpointDeviceWatcherTests.h" +#include "MidiEndpointListenerTests.h" +#include "MidiFunctionBlockMessageBuilderTests.h" +#include "MidiMessageBuilderTests.h" +#include "MidiMessagePacketTests.h" +#include "MidiMessageSchedulerTests.h" +#include "MidiSessionTests.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/api/Test/Midi2.Driver.unittests/Midi2.Driver.unittests.vcxproj b/src/api/Test/Midi2.Driver.unittests/Midi2.Driver.unittests.vcxproj index 88dd5afb..343afceb 100644 --- a/src/api/Test/Midi2.Driver.unittests/Midi2.Driver.unittests.vcxproj +++ b/src/api/Test/Midi2.Driver.unittests/Midi2.Driver.unittests.vcxproj @@ -39,7 +39,7 @@ 12.0 Debug Win32 - 10.0.22621.0 + 10.0 @@ -177,12 +177,12 @@ - + 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/Test/Midi2.Driver.unittests/packages.config b/src/api/Test/Midi2.Driver.unittests/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Test/Midi2.Driver.unittests/packages.config +++ b/src/api/Test/Midi2.Driver.unittests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/Midi2.Driver.unittests/stdafx.h b/src/api/Test/Midi2.Driver.unittests/stdafx.h index 36ccb1fc..4d596bad 100644 --- a/src/api/Test/Midi2.Driver.unittests/stdafx.h +++ b/src/api/Test/Midi2.Driver.unittests/stdafx.h @@ -1,6 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. #pragma once +// this is a hack, but because this is a test project, and know we're not +// using coroutines in our tests, we'll risk it. +#define _ALLOW_COROUTINE_ABI_MISMATCH + + #include #include diff --git a/src/api/Test/Midi2.Service.unittests/Midi2.Service.unittests.vcxproj b/src/api/Test/Midi2.Service.unittests/Midi2.Service.unittests.vcxproj index 45b65cde..bc8c45e2 100644 --- a/src/api/Test/Midi2.Service.unittests/Midi2.Service.unittests.vcxproj +++ b/src/api/Test/Midi2.Service.unittests/Midi2.Service.unittests.vcxproj @@ -22,7 +22,7 @@ 17.0 {4C09E660-79C6-4BA1-B823-21A867A3A4A9} Win32Proj - 10.0.22621.0 + 10.0 @@ -92,7 +92,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midikscommon.lib;midiswenum.lib;miditestcommon.lib;$(CoreLibraryDependencies) @@ -103,7 +103,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midikscommon.lib;midiswenum.lib;miditestcommon.lib;$(CoreLibraryDependencies) @@ -114,7 +114,7 @@ Level4 %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)test\inc;$(WindowsSdkDir)\Testing\Development\inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midisrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) true - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midikscommon.lib;midiswenum.lib;miditestcommon.lib;$(CoreLibraryDependencies) @@ -149,12 +149,12 @@ - + 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/Test/Midi2.Service.unittests/Midi2ServiceTests.cpp b/src/api/Test/Midi2.Service.unittests/Midi2ServiceTests.cpp index 2810fbb0..f7cd4eda 100644 --- a/src/api/Test/Midi2.Service.unittests/Midi2ServiceTests.cpp +++ b/src/api/Test/Midi2.Service.unittests/Midi2ServiceTests.cpp @@ -106,7 +106,7 @@ void Midi2ServiceTests::TestMidiServiceClientRPC() { WEX::TestExecution::SetVerifyOutput verifySettings(WEX::TestExecution::VerifyOutputSettings::LogOnlyFailures); - MIDISRV_CLIENTCREATION_PARAMS creationParams {0}; + MIDISRV_CLIENTCREATION_PARAMS creationParams { }; PMIDISRV_CLIENT client {nullptr}; wil::unique_rpc_binding bindingHandle; MidiClientHandle clientHandle{ 0 }; diff --git a/src/api/Test/Midi2.Service.unittests/packages.config b/src/api/Test/Midi2.Service.unittests/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Test/Midi2.Service.unittests/packages.config +++ b/src/api/Test/Midi2.Service.unittests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/Midi2.Service.unittests/stdafx.h b/src/api/Test/Midi2.Service.unittests/stdafx.h index 5ad42934..1b9944c5 100644 --- a/src/api/Test/Midi2.Service.unittests/stdafx.h +++ b/src/api/Test/Midi2.Service.unittests/stdafx.h @@ -1,6 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. #pragma once +// this is a hack, but because this is a test project, and know we're not +// using coroutines in our tests, we'll risk it. +#define _ALLOW_COROUTINE_ABI_MISMATCH + #include #include diff --git a/src/api/Test/Midi2.Transform.unittests/Midi2.Transform.unittests.vcxproj b/src/api/Test/Midi2.Transform.unittests/Midi2.Transform.unittests.vcxproj index e7098bc6..050aad06 100644 --- a/src/api/Test/Midi2.Transform.unittests/Midi2.Transform.unittests.vcxproj +++ b/src/api/Test/Midi2.Transform.unittests/Midi2.Transform.unittests.vcxproj @@ -149,12 +149,12 @@ - + 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/Test/Midi2.Transform.unittests/packages.config b/src/api/Test/Midi2.Transform.unittests/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Test/Midi2.Transform.unittests/packages.config +++ b/src/api/Test/Midi2.Transform.unittests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Test/inc/MidiTestCommon.h b/src/api/Test/inc/MidiTestCommon.h index a8ae9a57..776841ef 100644 --- a/src/api/Test/inc/MidiTestCommon.h +++ b/src/api/Test/inc/MidiTestCommon.h @@ -1,6 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. #pragma once +#ifndef MIDITESTCOMMON_H +#define MIDITESTCOMMON_H + typedef struct { BYTE status; @@ -48,3 +51,6 @@ void PrintMidiMessage(_In_ PVOID, _In_ UINT32, _In_ UINT32, _In_ LONGLONG); #define LOG_OUTPUT(fmt, ...) WEX::Logging::Log::Comment(WEX::Common::String().Format(fmt, __VA_ARGS__)) #endif + +#endif + diff --git a/src/api/Transform/ByteStreamToUMP/Midi2.BS2UMPTransform.vcxproj b/src/api/Transform/ByteStreamToUMP/Midi2.BS2UMPTransform.vcxproj index ebdb15cf..763a5531 100644 --- a/src/api/Transform/ByteStreamToUMP/Midi2.BS2UMPTransform.vcxproj +++ b/src/api/Transform/ByteStreamToUMP/Midi2.BS2UMPTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {206CEDBF-6343-4171-87A8-1DDDE6E2ED60} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,7 +144,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AM_MIDI2\Include Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -162,7 +162,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AM_MIDI2\Include Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -180,7 +180,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AM_MIDI2\Include Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -217,7 +217,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -234,7 +234,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -261,7 +261,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -299,12 +299,12 @@ - + 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/ByteStreamToUMP/packages.config b/src/api/Transform/ByteStreamToUMP/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Transform/ByteStreamToUMP/packages.config +++ b/src/api/Transform/ByteStreamToUMP/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj index 35514a94..153b5544 100644 --- a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj +++ b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {0DDD9961-7959-46B1-A11D-05BA8AF65297} Win32Proj - 10.0.20348.0 + 10.0 Midi2.EndpointMetadataListenerTransform @@ -151,7 +151,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -169,7 +169,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -187,7 +187,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -224,7 +224,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -241,7 +241,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -268,7 +268,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -308,12 +308,12 @@ - + 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/packages.config b/src/api/Transform/EndpointMetadataListenerTransform/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Transform/EndpointMetadataListenerTransform/packages.config +++ b/src/api/Transform/EndpointMetadataListenerTransform/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Transform/JitterReductionGeneratorTransform/Midi2.JitterReductionGeneratorTransform.vcxproj b/src/api/Transform/JitterReductionGeneratorTransform/Midi2.JitterReductionGeneratorTransform.vcxproj index 128853fc..823c53ab 100644 --- a/src/api/Transform/JitterReductionGeneratorTransform/Midi2.JitterReductionGeneratorTransform.vcxproj +++ b/src/api/Transform/JitterReductionGeneratorTransform/Midi2.JitterReductionGeneratorTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {6D151BF5-40A2-4BD7-BB67-07D2741DA01E} Win32Proj - 10.0.20348.0 + 10.0 Midi2.JitterReductionGeneratorTransform @@ -151,7 +151,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -169,7 +169,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -187,7 +187,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -224,7 +224,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -241,7 +241,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -268,7 +268,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -307,12 +307,12 @@ - + 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/JitterReductionGeneratorTransform/packages.config b/src/api/Transform/JitterReductionGeneratorTransform/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Transform/JitterReductionGeneratorTransform/packages.config +++ b/src/api/Transform/JitterReductionGeneratorTransform/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Transform/JitterReductionListenerTransform/Midi2.JitterReductionListenerTransform.vcxproj b/src/api/Transform/JitterReductionListenerTransform/Midi2.JitterReductionListenerTransform.vcxproj index eaace7a3..9698cc66 100644 --- a/src/api/Transform/JitterReductionListenerTransform/Midi2.JitterReductionListenerTransform.vcxproj +++ b/src/api/Transform/JitterReductionListenerTransform/Midi2.JitterReductionListenerTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {36E99993-ABE3-44CC-A776-B4E835B5EEC6} Win32Proj - 10.0.20348.0 + 10.0 Midi2.JitterReductionListenerTransform @@ -151,7 +151,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -169,7 +169,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -187,7 +187,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -224,7 +224,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -241,7 +241,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -268,7 +268,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -307,12 +307,12 @@ - + 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/JitterReductionListenerTransform/packages.config b/src/api/Transform/JitterReductionListenerTransform/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Transform/JitterReductionListenerTransform/packages.config +++ b/src/api/Transform/JitterReductionListenerTransform/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Transform/SampleTransform/Midi2.SampleTransform.vcxproj b/src/api/Transform/SampleTransform/Midi2.SampleTransform.vcxproj index b6287a98..9948eccf 100644 --- a/src/api/Transform/SampleTransform/Midi2.SampleTransform.vcxproj +++ b/src/api/Transform/SampleTransform/Midi2.SampleTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {35B356BF-276B-4D4E-83AA-CB3B98A92F42} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,7 +144,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -162,7 +162,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -180,7 +180,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -217,7 +217,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -234,7 +234,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -261,7 +261,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -299,12 +299,12 @@ - + 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/SampleTransform/packages.config b/src/api/Transform/SampleTransform/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Transform/SampleTransform/packages.config +++ b/src/api/Transform/SampleTransform/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Transform/SchedulerTransform/Midi2.SchedulerTransform.vcxproj b/src/api/Transform/SchedulerTransform/Midi2.SchedulerTransform.vcxproj index 93e07633..760b5be7 100644 --- a/src/api/Transform/SchedulerTransform/Midi2.SchedulerTransform.vcxproj +++ b/src/api/Transform/SchedulerTransform/Midi2.SchedulerTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {366FA284-D8C0-4CC5-B9A3-917EAB967173} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,7 +144,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -162,7 +162,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -180,7 +180,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -217,7 +217,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -234,7 +234,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -261,7 +261,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) @@ -301,12 +301,12 @@ - + 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/SchedulerTransform/packages.config b/src/api/Transform/SchedulerTransform/packages.config index 2884a839..09be25d9 100644 --- a/src/api/Transform/SchedulerTransform/packages.config +++ b/src/api/Transform/SchedulerTransform/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/Transform/UMPToByteStream/Midi2.UMP2BSTransform.vcxproj b/src/api/Transform/UMPToByteStream/Midi2.UMP2BSTransform.vcxproj index 058a48b7..1035c451 100644 --- a/src/api/Transform/UMPToByteStream/Midi2.UMP2BSTransform.vcxproj +++ b/src/api/Transform/UMPToByteStream/Midi2.UMP2BSTransform.vcxproj @@ -30,7 +30,7 @@ 17.0 {0E739771-0C0B-42EE-AADB-95E7E1E5A5ED} Win32Proj - 10.0.20348.0 + 10.0 @@ -144,7 +144,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AM_MIDI2\Include Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -154,6 +154,7 @@ $(SolutionDir)\idl;%(AdditionalIncludeDirectories) $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ %(Filename).h + false @@ -162,7 +163,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AM_MIDI2\Include Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -172,6 +173,7 @@ $(SolutionDir)\idl;%(AdditionalIncludeDirectories) $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ %(Filename).h + false @@ -180,7 +182,7 @@ %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AM_MIDI2\Include Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -190,6 +192,7 @@ $(SolutionDir)\idl;%(AdditionalIncludeDirectories) $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ %(Filename).h + false @@ -217,7 +220,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -227,6 +230,7 @@ $(SolutionDir)\idl;%(AdditionalIncludeDirectories) $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ %(Filename).h + false @@ -234,7 +238,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -244,6 +248,7 @@ $(SolutionDir)\idl;%(AdditionalIncludeDirectories) $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ %(Filename).h + false @@ -261,7 +266,7 @@ true Create pch.h - stdcpp17 + stdcpp20 %(AdditionalDependencies);onecoreuap.lib;avrt.lib;am_midi2.lib;$(CoreLibraryDependencies) @@ -271,6 +276,7 @@ $(SolutionDir)\idl;%(AdditionalIncludeDirectories) $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ %(Filename).h + false @@ -299,12 +305,12 @@ - + 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/UMPToByteStream/packages.config b/src/api/Transform/UMPToByteStream/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/Transform/UMPToByteStream/packages.config +++ b/src/api/Transform/UMPToByteStream/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/api/idl/IDL.vcxproj b/src/api/idl/IDL.vcxproj index af6a0999..f0c21827 100644 --- a/src/api/idl/IDL.vcxproj +++ b/src/api/idl/IDL.vcxproj @@ -30,7 +30,7 @@ 17.0 {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} Win32Proj - 10.0.22621.0 + 10.0 @@ -131,7 +131,7 @@ %(Filename).h - stdcpp17 + stdcpp20 @@ -140,7 +140,7 @@ %(Filename).h - stdcpp17 + stdcpp20 @@ -149,7 +149,7 @@ %(Filename).h - stdcpp17 + stdcpp20 @@ -158,7 +158,7 @@ %(Filename).h - stdcpp17 + stdcpp20 @@ -167,7 +167,7 @@ %(Filename).h - stdcpp17 + stdcpp20 @@ -176,7 +176,7 @@ %(Filename).h - stdcpp17 + stdcpp20 @@ -193,12 +193,12 @@ - + 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/idl/packages.config b/src/api/idl/packages.config index 14c63219..a6e30b6e 100644 --- a/src/api/idl/packages.config +++ b/src/api/idl/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs index 43cc250d..ca0a74ce 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/App.xaml.cs @@ -90,6 +90,10 @@ public App() services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + services.AddTransient(); services.AddTransient(); diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiEndpointDevicePurposeConverter.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiEndpointDevicePurposeConverter.cs new file mode 100644 index 00000000..57d06a2c --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiEndpointDevicePurposeConverter.cs @@ -0,0 +1,59 @@ +using Microsoft.UI.Xaml.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Midi.Settings.Helpers +{ + public class MidiEndpointDevicePurposeConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is null) + { + return string.Empty; + } + + if (value is MidiEndpointDevicePurpose) + { + var val = (MidiEndpointDevicePurpose)value; + + // TODO: Localize + + switch (val) + { + case MidiEndpointDevicePurpose.DiagnosticPing: + return "Internal endpoint for the service ping feature"; + + case MidiEndpointDevicePurpose.DiagnosticLoopback: + return "Loopback endpoint for testing and development"; + + case MidiEndpointDevicePurpose.InBoxGeneralMidiSynth: + return "In-box General MIDI 1.0 Synth"; + + case MidiEndpointDevicePurpose.VirtualDeviceResponder: + return "The private device-side connection of an app-to-app MIDI setup"; + + case MidiEndpointDevicePurpose.NormalMessageEndpoint: + return "Normal message endpoint"; + + default: + return "Unknown"; + } + } + else + { + return string.Empty; + } + + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } + +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiEndpointNativeDataFormatConverter.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiEndpointNativeDataFormatConverter.cs new file mode 100644 index 00000000..f366dd21 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiEndpointNativeDataFormatConverter.cs @@ -0,0 +1,51 @@ +using Microsoft.UI.Xaml.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Midi.Settings.Helpers +{ + public class MidiEndpointNativeDataFormatConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is null) + { + return string.Empty; + } + + if (value is MidiEndpointNativeDataFormat) + { + var val = (MidiEndpointNativeDataFormat)value; + + // TODO: Localize + + switch (val) + { + case MidiEndpointNativeDataFormat.UniversalMidiPacket: + return "MIDI 2.0 Universal MIDI Packet (UMP) format"; + + case MidiEndpointNativeDataFormat.ByteStream: + return "MIDI 1.0 byte stream format"; + + + default: + return "Unknown"; + } + } + else + { + return string.Empty; + } + + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } + +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiFunctionBlockMidi10Converter.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiFunctionBlockMidi10Converter.cs new file mode 100644 index 00000000..7840bd56 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiFunctionBlockMidi10Converter.cs @@ -0,0 +1,53 @@ +using Microsoft.UI.Xaml.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Midi.Settings.Helpers +{ + public class MidiFunctionBlockMidi10Converter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is null) + { + return string.Empty; + } + + if (value is MidiFunctionBlockMidi10) + { + var val = (MidiFunctionBlockMidi10)value; + + // TODO: Localize + + switch (val) + { + case MidiFunctionBlockMidi10.Not10: + return "Not MIDI 1.0"; + + case MidiFunctionBlockMidi10.YesBandwidthUnrestricted: + return "MIDI 1.0 unrestricted bandwidth"; + + case MidiFunctionBlockMidi10.YesBandwidthRestricted: + return "MIDI 1.0 restricted bandwidth"; + + default: + return "Unknown"; + } + } + else + { + return string.Empty; + } + + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } + +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiFunctionBlockSysEx8FormatConverter.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiFunctionBlockSysEx8FormatConverter.cs new file mode 100644 index 00000000..c59c3b36 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiFunctionBlockSysEx8FormatConverter.cs @@ -0,0 +1,46 @@ +using Microsoft.UI.Xaml.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Midi.Settings.Helpers +{ + public class MidiFunctionBlockSysEx8FormatConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is null) + { + return string.Empty; + } + + if (value is byte) + { + var val = (byte)value; + + // todo: localize + + if (val==0) + { + return "8-bit SysEx not supported"; + } + else + { + return val.ToString() ; + } + } + else + { + return string.Empty; + } + + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiGroupIndexConverter.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiGroupIndexConverter.cs new file mode 100644 index 00000000..9a15c9a8 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Helpers/MidiGroupIndexConverter.cs @@ -0,0 +1,38 @@ +using Microsoft.UI.Xaml.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Midi.Settings.Helpers +{ + public class MidiGroupIndexConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is null) + { + return string.Empty; + } + + if (value is byte) + { + var val = (byte)value; + + // todo: localize + return $"{MidiGroup.LabelFull} {(val + 1)} (Index {val})"; + } + else + { + return string.Empty; + } + + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + } +} 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 1c33c4e5..e47b7884 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 @@ -4,7 +4,7 @@ net8.0-windows10.0.20348.0 10.0.20348.0 enable - Microsoft.Devices.Midi2.Settings + Microsoft.Midi.Settings Assets/WindowIcon.ico app.manifest @@ -53,6 +53,7 @@ + @@ -70,25 +71,26 @@ - - - - + + + + + - - + + - + - + - + - + @@ -99,6 +101,9 @@ Always + + MSBuild:Compile + MSBuild:Compile @@ -180,5 +185,10 @@ + + + ResXFileCodeGenerator + + 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 3be9d86e..701b8eea 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 @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Resources; using System.Text; using System.Threading.Tasks; -//using Microsoft.Midi.Settings.SdkMock; + namespace Microsoft.Midi.Settings.Models; @@ -11,10 +12,11 @@ namespace Microsoft.Midi.Settings.Models; public class AppState { private static AppState? _current; - //private MidiSession? _midiSession; + private MidiSession? _midiSession; private AppState() { + _midiSession = MidiSession.CreateSession("AppSessionName".GetLocalized()); } public static AppState Current @@ -30,28 +32,14 @@ public static AppState Current // static because the settings app is only opening one session, but an // app can have more than one MidiSession - //public MidiSession? MidiSession - //{ - // get - // { - // return _midiSession; - // } - //} - - //public bool HasActiveMidiSession - //{ - // get - // { - // return _midiSession != null; - // } - //} - - //public void CreateMidiSession() - //{ - // // todo: set session name etc. - - // _midiSession = new MidiSession(); - //} + public MidiSession? MidiSession + { + get + { + + return _midiSession; + } + } } diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Services/PageService.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Services/PageService.cs index 8ada2c17..f97188b3 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Services/PageService.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Services/PageService.cs @@ -17,6 +17,9 @@ public PageService() Configure(); Configure(); + Configure(); + + Configure(); Configure(); Configure(); diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Strings/en-us/Resources.resw b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Strings/en-us/Resources.resw index 6ad31f5c..4cff11fd 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Strings/en-us/Resources.resw +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Strings/en-us/Resources.resw @@ -285,4 +285,7 @@ Below is a list of all MIDI devices as seen by the legacy MIDI 1.0 APIs, and the apps which use them. + + Settings + \ No newline at end of file diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/FontSizes.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/FontSizes.xaml index 44904b1c..f8ec9ee7 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/FontSizes.xaml +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/FontSizes.xaml @@ -4,6 +4,13 @@ 24 + 20 + 16 + 14 + + 12 + + diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/TextBlock.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/TextBlock.xaml index 7a81d165..14add3a3 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/TextBlock.xaml +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Styles/TextBlock.xaml @@ -11,6 +11,40 @@ + + + + + + + + \ No newline at end of file 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 4cc487e9..c5a49ff0 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Usings.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Usings.cs @@ -1 +1,3 @@ global using WinUIEx; +global using Microsoft.Midi.Settings.Helpers; +global using Windows.Devices.Midi2; \ No newline at end of file diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DeviceDetailViewModel.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DeviceDetailViewModel.cs new file mode 100644 index 00000000..4278ca9b --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/DeviceDetailViewModel.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CommunityToolkit.Mvvm.ComponentModel; +using Microsoft.Midi.Settings.Contracts.ViewModels; +using Microsoft.Midi.Settings.Models; +using Microsoft.UI.Dispatching; + +namespace Microsoft.Midi.Settings.ViewModels +{ + public class DeviceDetailViewModel : ObservableRecipient, INavigationAware + { + + public MidiEndpointDeviceInformation? DeviceInformation + { + get; private set; + } + + + + public void OnNavigatedFrom() + { + // throw new NotImplementedException(); + } + + public void OnNavigatedTo(object parameter) + { + DeviceInformation = (MidiEndpointDeviceInformation)parameter; + } + } +} 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 4e0d3c6b..d1c73d7c 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 @@ -4,47 +4,173 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Input; using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Microsoft.Midi.Settings.Contracts.Services; using Microsoft.Midi.Settings.Contracts.ViewModels; using Microsoft.Midi.Settings.Models; +using Microsoft.UI.Dispatching; +using Microsoft.UI.Xaml; + + //using Microsoft.Midi.Settings.SdkMock; +using Windows.Devices.Midi2; + namespace Microsoft.Midi.Settings.ViewModels { public class DevicesViewModel : ObservableRecipient, INavigationAware { - public DevicesViewModel() + private MidiEndpointDeviceWatcher? _watcher = null; + private DispatcherQueue _dispatcherQueue; + + private INavigationService _navigationService; + + public ICommand ViewDeviceDetailsCommand + { + get; private set; + } + + public DevicesViewModel(INavigationService navigationService) { + _navigationService = navigationService; + + _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); + + ViewDeviceDetailsCommand = new RelayCommand( + async (param) => + { + System.Diagnostics.Debug.WriteLine("View Device Details Command exec"); + + _navigationService.NavigateTo(typeof(DeviceDetailViewModel).FullName!, param); + + }); + } + + public ObservableCollection MidiEndpointDevices { get; private set; } = + new ObservableCollection(); + + public event EventHandler? EndpointDeviceUpdated; + + + + // CollectionViewSource grouped by transport + + + + + + + + + + + + + + + + + private void StartDeviceWatcher(bool includeAll) + { + if (_watcher != null) + { + ShutDownDeviceWatcher(); + } + + var filter = MidiEndpointDeviceInformationFilter.AllTypicalEndpoints; + + if (includeAll) + { + filter |= MidiEndpointDeviceInformationFilter.IncludeDiagnosticLoopback; + filter |= MidiEndpointDeviceInformationFilter.IncludeDiagnosticPing; + filter |= MidiEndpointDeviceInformationFilter.IncludeVirtualDeviceResponder; + } + + _watcher = MidiEndpointDeviceWatcher.CreateWatcher(filter); + + _watcher.Stopped += OnDeviceWatcherStopped; + _watcher.Updated += OnDeviceWatcherEndpointUpdated; + _watcher.Removed += OnDeviceWatcherEndpointRemoved; + _watcher.Added += OnDeviceWatcherEndpointAdded; + _watcher.EnumerationCompleted += OnDeviceWatcherEnumerationCompleted; + + _watcher.Start(); } + private void OnDeviceWatcherEnumerationCompleted(MidiEndpointDeviceWatcher sender, object args) + { + // todo + } - //public ObservableCollection Devices - //{ - // get - // { - // if (!AppState.Current.HasActiveMidiSession || AppState.Current.MidiSession is null) - // { - // AppState.Current.CreateMidiSession(); - // } + private void OnDeviceWatcherEndpointAdded(MidiEndpointDeviceWatcher sender, MidiEndpointDeviceInformation args) + { + _dispatcherQueue.TryEnqueue(() => + { + MidiEndpointDevices.Add(args); + }); + } - // return AppState.Current.MidiSession.Devices; + private void OnDeviceWatcherEndpointRemoved(MidiEndpointDeviceWatcher sender, global::Windows.Devices.Enumeration.DeviceInformationUpdate args) + { + _dispatcherQueue.TryEnqueue(() => + { + foreach (MidiEndpointDeviceInformation info in MidiEndpointDevices) + { + if (info.Id == args.Id) + { + MidiEndpointDevices.Remove(info); + break; + } + } + }); + } - // } - //} + private void OnDeviceWatcherEndpointUpdated(MidiEndpointDeviceWatcher sender, MidiEndpointDeviceInformationUpdateEventArgs args) + { + _dispatcherQueue.TryEnqueue(() => + { + if (EndpointDeviceUpdated != null) + { + EndpointDeviceUpdated(sender, args); + } + }); + } + private void OnDeviceWatcherStopped(MidiEndpointDeviceWatcher sender, object args) + { + // nothing to do. + } + private void ShutDownDeviceWatcher() + { + if (_watcher != null) + { + _watcher.Stop(); + _watcher.Stopped -= OnDeviceWatcherStopped; + _watcher.Updated -= OnDeviceWatcherEndpointUpdated; + _watcher.Removed -= OnDeviceWatcherEndpointRemoved; + _watcher.Added -= OnDeviceWatcherEndpointAdded; + _watcher = null; + } + } public void OnNavigatedFrom() { + ShutDownDeviceWatcher(); } + + public void OnNavigatedTo(object parameter) { + StartDeviceWatcher(true); } } } diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/SettingsViewModel.cs b/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/SettingsViewModel.cs index 1f42e7a4..4d53dd3b 100644 --- a/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/SettingsViewModel.cs +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/ViewModels/SettingsViewModel.cs @@ -48,7 +48,10 @@ public ICommand SwitchThemeCommand } - public SettingsViewModel(IThemeSelectorService themeSelectorService, ILocalSettingsService localSettingsService, IGeneralSettingsService generalSettingsService) + public SettingsViewModel( + IThemeSelectorService themeSelectorService, + ILocalSettingsService localSettingsService, + IGeneralSettingsService generalSettingsService) { _themeSelectorService = themeSelectorService; _elementTheme = _themeSelectorService.Theme; diff --git a/src/user-tools/midi-settings/Microsoft.Midi.Settings/Views/DeviceDetailPage.xaml b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Views/DeviceDetailPage.xaml new file mode 100644 index 00000000..d7c3e927 --- /dev/null +++ b/src/user-tools/midi-settings/Microsoft.Midi.Settings/Views/DeviceDetailPage.xaml @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +