diff --git a/build/staging/reg/WinRTActivationEntries.cs b/build/staging/reg/WinRTActivationEntries.cs index 2a7b2d9f..d39c8bbb 100644 --- a/build/staging/reg/WinRTActivationEntries.cs +++ b/build/staging/reg/WinRTActivationEntries.cs @@ -38,6 +38,7 @@ class RegistryEntries new RegEntry{ ClassName="Windows.Devices.Midi2.IMidiEndpointConnectionStatics", ActivationType=0, Threading=0, TrustLevel=0 }, new RegEntry{ ClassName="Windows.Devices.Midi2.MidiService", ActivationType=0, Threading=0, TrustLevel=0 }, new RegEntry{ ClassName="Windows.Devices.Midi2.IMidiServiceStatics", ActivationType=0, Threading=0, TrustLevel=0 }, + new RegEntry{ ClassName="Windows.Devices.Midi2.MidiServiceLoopbackEndpointDefinition", ActivationType=0, Threading=0, TrustLevel=0 }, new RegEntry{ ClassName="Windows.Devices.Midi2.MidiClock", ActivationType=0, Threading=0, TrustLevel=0 }, new RegEntry{ ClassName="Windows.Devices.Midi2.IMidiClockStatics", ActivationType=0, Threading=0, TrustLevel=0 }, new RegEntry{ ClassName="Windows.Devices.Midi2.MidiChannel", ActivationType=0, Threading=0, TrustLevel=0 }, diff --git a/build/staging/reg/WinRTActivationEntries.xml b/build/staging/reg/WinRTActivationEntries.xml index 62882cb0..0d8ca6d4 100644 --- a/build/staging/reg/WinRTActivationEntries.xml +++ b/build/staging/reg/WinRTActivationEntries.xml @@ -163,6 +163,11 @@ threading="Both" trustLevel="Base" /> + - + diff --git a/diagnostics/trace-logging/MidiServices.wprp b/diagnostics/trace-logging/MidiServices.wprp index 68ed85ed..1246cd8b 100644 --- a/diagnostics/trace-logging/MidiServices.wprp +++ b/diagnostics/trace-logging/MidiServices.wprp @@ -20,6 +20,7 @@ + @@ -45,6 +46,7 @@ + diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiService.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiService.md index 8e1f8c5a..e2f08846 100644 --- a/docs/developer-docs/Windows.Devices.Midi2/service/MidiService.md +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiService.md @@ -10,18 +10,44 @@ has_children: false The MidiService class contains a number of static functions which enable working with the service outside of a specific session. -## Static Functions +## Static Functions : Reporting | Static Function | Description | |---|---| -| `PingService(pingCount)` | Send one or more ping messages to the ping endpoint and report on the status and time. Return if the responses are not received in a calculated timeout period. | -| `PingService(pingCount, timeoutMilliseconds)` | Send one or more ping messages to the ping endpoint and report on the status and time. Return if responses are not received in the specified timeout period. | | `GetInstalledTransportPlugins()` | Returns a list of `MidiServiceTransportPluginInformation` representing all service transport plugins (also called Abstractions) | | `GetInstalledMessageProcessingPlugins()` | Returns a list of `MidiServiceMessageProcessingPluginInformation` objects representing all service message processing plugins (also called Transforms) | | `GetActiveSessions()` | Returns a list of `MidiSessionInformation` detailing all active Windows MIDI Services sessions on this PC. | -| `UpdateRuntimeConfiguration(configurationUpdate)` | Used by client-side SDK components for some transports and other plugins, and by the MIDI Settings app. The format of the data is dependent upon the target specified in the data. Use with caution. For more information, see the [config JSON documentation](../../../config-json.md) | -## A note on the ping process +## Static Functions : Loopback Endpoints + +| Static Function | Description | +|---|---| +| `CreateTemporaryLoopbackEndpoints(associationId, endpointA, endpointB)` | Create a pair of loopback endpoints which will live until removed through the API or the service is restarted. | +| `RemoveTemporaryLoopbackEndpoints(associationId)` | Remove a pair of temporary loopback endpoints. | + +Applications creating endpoints for app-to-app MIDI should generally use the Virtual Device support built into the API. However, applications may need to create lightweight loopback endpoints without the protocol negotiation, MIDI 2.0 discovery process, and lifetime management provided by the Virtual Device support. For those scenarios, we have a simple loopback endpoint type. + +Loopback endpoints created by the user and stored in the configuration file will persist after the service is restarted or the PC rebooted. Loopback endpoints created through this API call are temporary, and will disappear if the service is restarted. In both cases, this feature requires that the loopback endpoint transport is installed and enabled. + +## Static Functions : Runtime Configuration + +| Static Function | Description | +|---|---| +| `UpdateTransportPluginConfiguration(configurationUpdate)` | Sends an update to the service to be used by a transport plugin ("Abstraction") | +| `UpdateProcessingPluginConfiguration(configurationUpdate)` | Sends an update to the service to be used by a message processing plugin ("Transform") | + +For plugins which support updates at runtime, developers of those plugins should create configuration WinRT types which implement the required configuration interfaces, and create the JSON that is used in the service. In this way, third-party service transport and message processing plugins can be created and configured without changes to the API. + +> Note: In version 1 of the API, only transports can be configured at runtime. We're working on enabling configuration of message processing plugins. + +## Static Functions : Service Health + +| Static Function | Description | +|---|---| +| `PingService(pingCount)` | Send one or more ping messages to the ping endpoint and report on the status and time. Return if the responses are not received in a calculated timeout period. | +| `PingService(pingCount, timeoutMilliseconds)` | Send one or more ping messages to the ping endpoint and report on the status and time. Return if responses are not received in the specified timeout period. | + +### The ping process Pinging the Windows service uses the same mechanism as sending any UMP message. The actual message sent is a prioprietary message. (At the time this was created, there was no standard MIDI 2.0 UMP ping message). The message itself is sent to the diagnostics endpoint in the service, which is implemented like any other transport. Therefore, the speed of the pings here and the success of the ping process is a reasonable indicator of service, cross-process queue, and client API health. @@ -33,12 +59,6 @@ Here's an example of ping responses through the MIDI console app ![MIDI Console Ping](./console-ping.png) -## A note on updating runtime configuration - -In order to foster an open plugin ecosystem, we need a way to get settings and configuration for those plugins up to them in the Windows service. The way we've chosen to do that is JSON, because that same JSON, when not transient in nature, can also be saved into the permanent configuration file for the active MIDI setup. - -The runtime configuration update should only be used by code which understands exactly what will be done with the data, and can handle the response which is returned. It is not a general API endpoint, but is designed for components which will extend Windows MIDI Services. - ## IDL [MidiService IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiService.idl) diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceConfigurationResponseStatusEnum.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceConfigurationResponseStatusEnum.md new file mode 100644 index 00000000..17ca1bd3 --- /dev/null +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceConfigurationResponseStatusEnum.md @@ -0,0 +1,26 @@ +--- +layout: api_page +title: MidiServiceConfigurationResponseStatus +parent: Service +grand_parent: Windows.Devices.Midi2 API +has_children: false +--- + +# MidiServiceConfigurationResponseStatus Enumeration + +Indicates success or failure mode for configuring an endpoint or message processing plugin in the service. + +## Properties + +| Property | Value | Description | +| -------- | ------- | ------ | +| `Success` | `0` | The entire operation succeeded | +| `ErrorTargetNotFound` | `404` | The target of the change was not found. This could be the plugin itself, or if the configuration requires an endpoint, the endpoint instance. | +| `ErrorJsonNullOrEmpty` | `600` | The supplied JSON was null or empty. | +| `ErrorProcessingJson` | `601` | The supplied JSON was invalid in some way. It could be malformed or have missing required data or keys. | +| `ErrorNotImplemented` | `2600` | One or more of the requests are not implemented by the service or by the plugin. | +| `ErrorOther` | `9999` | All other errors | + +## IDL + +[MidiServiceConfigurationResponseStatus IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiServiceConfigurationResponseStatusEnum.idl) diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceEndpointDefinition.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceEndpointDefinition.md new file mode 100644 index 00000000..cac311b2 --- /dev/null +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceEndpointDefinition.md @@ -0,0 +1,24 @@ +--- +layout: api_page +title: MidiServiceLoopbackEndpointDefinition +parent: Service +grand_parent: Windows.Devices.Midi2 API +has_children: false +--- + +# MidiServiceLoopbackEndpointDefinition + +This class defines the properties of an endpoint which can be created at runtime. For example, a loopback endpoint. + +## Properties + +| Property | Description | +|---|---| +| `Name` | The name of the endpoint. | +| `UniqueId` | A short unique identifier for this endpoint. This is used in creating the id. Keep to 32 characters or fewer (32 characters is the length of a no-symbols GUID). If, when combined with the generated loopback A/B differentiator prefix, this id is not unique among all loopback endpoints, endpoint creation will fail. | +| `Description` | Optional description for the endpoint | + +## IDL + +[MidiServiceLoopbackEndpointDefinition IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.idl) + diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceLoopbackEndpointCreationResult.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceLoopbackEndpointCreationResult.md new file mode 100644 index 00000000..f3e89c33 --- /dev/null +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServiceLoopbackEndpointCreationResult.md @@ -0,0 +1,25 @@ +--- +layout: api_page +title: MidiServiceLoopbackEndpointCreationResult +parent: Service +grand_parent: Windows.Devices.Midi2 API +has_children: false +--- + +# MidiServiceLoopbackEndpointCreationResult + +This class represents the results of an attempt to create runtime loopback endpoints + +## Properties + +| Property | Description | +|---|---| +| `Success` | True if the creation of both endpoints was a success | +| `AssociatioNId` | The GUID which associatiates the two endpoints. Provided during creation time. | +| `EndpointDeviceIdA` | The full endpoint device id `\\SWD\...` for the endpoint identified as the "A" side of the loopback | +| `EndpointDeviceIdB` | The full endpoint device id `\\SWD\...` for the endpoint identified as the "B" side of the loopback | + +## IDL + +[MidiServiceLoopbackEndpointCreationResult IDL](https://github.com/microsoft/MIDI/blob/main/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.idl) + diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponse.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponse.md index ef5afaea..a0b29083 100644 --- a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponse.md +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponse.md @@ -9,7 +9,7 @@ has_children: false This class represents a single ping message response. This is used to assess health and performance of the Windows service. -## Static Functions +## Properties | Property | Description | |---|---| diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponseSummary.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponseSummary.md index 87f3f881..c44ede20 100644 --- a/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponseSummary.md +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiServicePingResponseSummary.md @@ -10,7 +10,7 @@ has_children: false This class represents a summary of the ping attempts against the Windows service. -## Static Functions +## Properties | Property | Description | |---|---| diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionConnectionInformation.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionConnectionInformation.md index 53836917..3995ab5d 100644 --- a/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionConnectionInformation.md +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionConnectionInformation.md @@ -10,7 +10,7 @@ has_children: false This class represents an open connection in a Windows MIDI Services session. This is an informational class only for reporting system-wide connection usage. -## Static Functions +## Properties | Property | Description | |---|---| diff --git a/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionInformation.md b/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionInformation.md index a63fbe3a..149352f9 100644 --- a/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionInformation.md +++ b/docs/developer-docs/Windows.Devices.Midi2/service/MidiSessionInformation.md @@ -10,7 +10,7 @@ has_children: false This class represents an open Windows MIDI Services session. -## Static Functions +## Properties | Property | Description | |---|---| diff --git a/docs/developer-docs/endpoint-ids.md b/docs/endpoints/endpoint-ids.md similarity index 97% rename from docs/developer-docs/endpoint-ids.md rename to docs/endpoints/endpoint-ids.md index fc0723dd..7cdc1b86 100644 --- a/docs/developer-docs/endpoint-ids.md +++ b/docs/endpoints/endpoint-ids.md @@ -1,7 +1,8 @@ --- layout: page title: Endpoint Device Ids -parent: Windows Midi Services +parent: Transport Types +grandparent: Windows Midi Services has_children: false --- diff --git a/docs/endpoints/kernel-streaming.md b/docs/endpoints/kernel-streaming.md index 3166e8e6..0b3c087e 100644 --- a/docs/endpoints/kernel-streaming.md +++ b/docs/endpoints/kernel-streaming.md @@ -3,7 +3,7 @@ layout: page title: Kernel Streaming parent: Transport Types grandparent: Windows MIDI Services -has_children: true +has_children: false --- # Kernel Streaming diff --git a/docs/endpoints/virtual-device-app.md b/docs/endpoints/virtual-device-app.md index 2e424e61..b1217a94 100644 --- a/docs/endpoints/virtual-device-app.md +++ b/docs/endpoints/virtual-device-app.md @@ -3,7 +3,7 @@ layout: page title: Virtual Device App parent: Transport Types grandparent: Windows MIDI Services -has_children: true +has_children: false --- # Virtual Device App diff --git a/docs/endpoints/virtual-loopback.md b/docs/endpoints/virtual-loopback.md index aca60029..6ebf1303 100644 --- a/docs/endpoints/virtual-loopback.md +++ b/docs/endpoints/virtual-loopback.md @@ -3,7 +3,7 @@ layout: page title: Virtual Loopback parent: Transport Types grandparent: Windows MIDI Services -has_children: true +has_children: false --- # Virtual Loopback @@ -25,14 +25,67 @@ If you want to have loopback endpoints which are always available for routing be As with all configuration file changes, we recommend using the Windows MIDI Services Settings application, once we make that available. For now, you may edit the JSON directly. But please note that JSON is quite unforgiving: the format is specific, and all keys (including the GUIDs and property names) are case-sensitive. In addition, there's no usable provision for comments in a JSON file, so we can't include examples in the file itself. -That out of the way, here's the configuration section for the Virtual Loopback MIDI endpoints. +That out of the way, here's an example configuration section for the Virtual Loopback MIDI endpoints. ```json -todo +"endpointTransportPluginSettings": +{ + "{942BF02D-93C0-4EA8-B03E-D51156CA75E1}": + { + "_comment": "Loopback MIDI", + "create": + { + "{0C1B3439-593F-4B7A-8950-4698D97B0897}": + { + "_comment" : "the above GUID is the unique association Id for this pair", + "endpointA": + { + "name": "Perm Loopback 1A", + "description": "This is a loopback I created in the configuration file", + "uniqueId": "3263827" + }, + "endpointB": + { + "name": "Perm Loopback 1B", + "description": "This is the b-side of the loopback I created in the configuration file", + "uniqueId": "3263827" + } + }, + "{B21B4973-3F85-48A0-8BA3-B35F44683D36}": + { + "_comment" : "the above GUID is the unique association Id for this pair", + "endpointA": + { + "name": "Perm Loopback 2A", + "description": "This is a loopback I created in the configuration file", + "uniqueId": "5150-1984" + }, + "endpointB": + { + "name": "Perm Loopback 2B", + "description": "This is the b-side of the loopback I created in the configuration file", + "uniqueId": "OU812" + } + } + } + } +} ``` +Each loopback endpoint pair is identified by a GUID for the association id. The association GUID must be a valid unique GUID and shall not be an empty (all zeroes) GUID. + +| Key | Description | +| -------- | ----- | +| (Association Id) | Unique GUID for this pair of endpoints. The GUID itself is the property key under the "create" node. | +| endpointA | Data for the first endpoint | +| endpointB | Data for the second endpoint | +| (endpoint) name | Required. This becomes the transport-supplied name for the loopback endpoint. | +| (endpoint) description | Optional. This becomes the transport-supplied description for the loopback endpoint. | +| (endpoint) uniqueId | Required. This is a short (32 characters or fewer) case-insensitive unique Id for the endpoint. When combined with the loopback A/B prefixes in the service, it must be unique across all loopback endpoints in Windows. You can use the same unique id for each endpoint in the same pair, but not the same as other pairs. | + + # Implementation Internally, the Virtual Loopback is implemented as two endpoints which are cross-wired, so anything sent to Loopback A arrives on the input of Loopback B, and vice versa. Each declared pair has an exclusive relationship, and there's no practical limit to the number of loopback pairs you can define. diff --git a/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiAbstraction.vcxproj b/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiAbstraction.vcxproj index dd283784..9676a808 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.22621.0 + 10.0.20348.0 @@ -96,32 +96,32 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.BluetoothMidiAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.BluetoothMidiAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.BluetoothMidiAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.BluetoothMidiAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.BluetoothMidiAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.BluetoothMidiAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ @@ -141,13 +141,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.BluetoothMidiAbstraction.def @@ -159,13 +159,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.BluetoothMidiAbstraction.def @@ -177,13 +177,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.BluetoothMidiAbstraction.def @@ -194,12 +194,12 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -220,7 +220,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.BluetoothMidiAbstraction.def @@ -237,7 +237,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.BluetoothMidiAbstraction.def @@ -248,7 +248,7 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -264,7 +264,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.BluetoothMidiAbstraction.def diff --git a/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiEndpointManager.cpp b/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiEndpointManager.cpp index 516ff045..e7e5381c 100644 --- a/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiEndpointManager.cpp +++ b/src/api/Abstraction/BleMidiAbstraction/Midi2.BluetoothMidiEndpointManager.cpp @@ -497,7 +497,7 @@ namespace bt = ::winrt::Windows::Devices::Bluetooth; HRESULT CMidi2BluetoothMidiEndpointManager::EnumCompatibleBluetoothDevices() { - winrt::guid midiServiceGuid(MIDI_BLE_GATT_SERVICE); +// winrt::guid midiServiceGuid(MIDI_BLE_GATT_SERVICE); // bt::BluetoothLEDevice::GetGattServicesForUuidAsync(midiServiceGuid); diff --git a/src/api/Abstraction/BleMidiAbstraction/pch.h b/src/api/Abstraction/BleMidiAbstraction/pch.h index 9d755cdb..ba8f194c 100644 --- a/src/api/Abstraction/BleMidiAbstraction/pch.h +++ b/src/api/Abstraction/BleMidiAbstraction/pch.h @@ -64,7 +64,23 @@ namespace json = ::winrt::Windows::Data::Json; #include "SWDevice.h" #include #include "setupapi.h" -#include "Devpkey.h" +//#include "Devpkey.h" + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" +#include "json_helpers.h" + +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + +namespace internal = ::Windows::Devices::Midi2::Internal; + #include "strsafe.h" @@ -78,10 +94,6 @@ namespace json = ::winrt::Windows::Data::Json; #include "dllmain.h" -#include "MidiDefs.h" -#include "MidiXProc.h" - - #include "MidiEndpointTable.h" #include "Midi2.BluetoothMidiAbstraction.h" diff --git a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsAbstraction.vcxproj b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsAbstraction.vcxproj index 1df7e02a..3277b24a 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.22621.0 + 10.0.20348.0 Midi2.DiagnosticsAbstraction @@ -97,37 +97,37 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.DiagnosticsAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(IncludePath) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.DiagnosticsAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(IncludePath) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.DiagnosticsAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(IncludePath) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.DiagnosticsAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(IncludePath) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.DiagnosticsAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(IncludePath) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\midi2.DiagnosticsAbstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(IncludePath) @@ -148,13 +148,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.DiagnosticsAbstraction.def @@ -166,13 +166,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.DiagnosticsAbstraction.def @@ -184,13 +184,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.DiagnosticsAbstraction.def @@ -201,12 +201,12 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -227,7 +227,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.DiagnosticsAbstraction.def @@ -244,7 +244,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.DiagnosticsAbstractionn.def @@ -255,7 +255,7 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -271,7 +271,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.DiagnosticsAbstraction.def diff --git a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp index 85ed8c2e..2b453225 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp +++ b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.cpp @@ -17,7 +17,6 @@ using namespace Microsoft::WRL::Wrappers; #define MAX_DEVICE_ID_LEN 200 // size in chars -GUID AbstractionLayerGUID = __uuidof(Midi2DiagnosticsAbstraction); _Use_decl_annotations_ HRESULT @@ -40,15 +39,14 @@ CMidi2DiagnosticsEndpointManager::Initialize( RETURN_IF_FAILED(MidiDeviceManager->QueryInterface(__uuidof(IMidiDeviceManagerInterface), (void**)&m_MidiDeviceManager)); - m_TransportAbstractionId = AbstractionLayerGUID; // this is needed so MidiSrv can instantiate the correct transport m_ContainerId = m_TransportAbstractionId; // we use the transport ID as the container ID for convenience RETURN_IF_FAILED(CreateParentDevice()); - RETURN_IF_FAILED(CreateLoopbackEndpoint(DEFAULT_LOOPBACK_BIDI_A_ID, DEFAULT_LOOPBACK_BIDI_A_NAME, MidiFlow::MidiFlowBidirectional)); - RETURN_IF_FAILED(CreateLoopbackEndpoint(DEFAULT_LOOPBACK_BIDI_B_ID, DEFAULT_LOOPBACK_BIDI_B_NAME, MidiFlow::MidiFlowBidirectional)); + RETURN_IF_FAILED(CreateLoopbackEndpoint(DEFAULT_LOOPBACK_BIDI_A_ID, LOOPBACK_BIDI_A_UNIQUE_ID, DEFAULT_LOOPBACK_BIDI_A_NAME, MidiFlow::MidiFlowBidirectional)); + RETURN_IF_FAILED(CreateLoopbackEndpoint(DEFAULT_LOOPBACK_BIDI_B_ID, LOOPBACK_BIDI_B_UNIQUE_ID, DEFAULT_LOOPBACK_BIDI_B_NAME, MidiFlow::MidiFlowBidirectional)); - RETURN_IF_FAILED(CreatePingEndpoint(DEFAULT_PING_BIDI_ID, DEFAULT_PING_BIDI_NAME, MidiFlow::MidiFlowBidirectional)); + RETURN_IF_FAILED(CreatePingEndpoint(DEFAULT_PING_BIDI_ID, PING_BIDI_UNIQUE_ID, DEFAULT_PING_BIDI_NAME, MidiFlow::MidiFlowBidirectional)); return S_OK; @@ -104,63 +102,77 @@ _Use_decl_annotations_ HRESULT CMidi2DiagnosticsEndpointManager::CreateLoopbackEndpoint( std::wstring const InstanceId, + std::wstring const UniqueId, std::wstring const Name, MidiFlow const Flow ) { - OutputDebugString(__FUNCTION__ L": Enter\n"); - - //put all of the devproperties we want into arrays and pass into ActivateEndpoint: + TraceLoggingWrite( + MidiDiagnosticsAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this") + ); std::wstring mnemonic(TRANSPORT_MNEMONIC); DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; - DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; - BYTE nativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP; - UINT32 supportedDataFormat = (UINT32)MidiDataFormat::MidiDataFormat_UMP; - - std::wstring description = L"Diagnostics loopback endpoint. For testing and development purposes."; - - auto endpointPurpose = (uint32_t)MidiEndpointDevicePurposePropertyValue::DiagnosticLoopback; - - OutputDebugString(__FUNCTION__ L": Building DEVPROPERTY interfaceDevProperties[]\n"); - - DEVPROPERTY interfaceDevProperties[] = { - {{PKEY_MIDI_AssociatedUMP, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_EMPTY, 0, nullptr}, - - {{PKEY_MIDI_SupportedDataFormats, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(UINT32)), &supportedDataFormat}, - - - {{DEVPKEY_DeviceInterface_FriendlyName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((Name.length() + 1) * sizeof(WCHAR)), (PVOID)Name.c_str()}, - {{PKEY_MIDI_TransportSuppliedEndpointName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((Name.length() + 1) * sizeof(WCHAR)), (PVOID)Name.c_str()}, - - - {{PKEY_MIDI_EndpointRequiresMetadataHandler, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)), &devPropTrue}, - - - {{PKEY_MIDI_EndpointDevicePurpose, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(endpointPurpose)),(PVOID)&endpointPurpose}, - {{PKEY_MIDI_TransportSuppliedDescription, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((description.length() + 1) * sizeof(WCHAR)), (PVOID)description.c_str() }, - {{PKEY_MIDI_NativeDataFormat, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BYTE, static_cast(sizeof(BYTE)), (PVOID)&nativeDataFormat}, - - // do not generate incoming (from device) timestamps automatically. - // for the loopback endpoints, we expect a zero timestamp to come back through as zero - {{PKEY_MIDI_GenerateIncomingTimestamp, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropFalse)), (PVOID)&devPropFalse}, - - - {{PKEY_MIDI_AbstractionLayer, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_GUID, static_cast(sizeof(GUID)), (PVOID)&AbstractionLayerGUID }, // essential to instantiate the right endpoint types - {{PKEY_MIDI_TransportMnemonic, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((mnemonic.length() + 1) * sizeof(WCHAR)), (PVOID)mnemonic.c_str()}, - }; + //DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; + + std::wstring endpointName = Name; + std::wstring endpointDescription = L"Diagnostics loopback endpoint. For testing and development purposes."; + + std::vector interfaceDeviceProperties{}; + + bool requiresMetadataHandler = true; + bool multiClient = true; + + // do not generate incoming (from device) timestamps automatically. + // for the loopback endpoints, we expect a zero timestamp to come back through as zero + bool generateIncomingTimestamps = false; + + // no user or in-protocol data in this case + std::wstring friendlyName = internal::CalculateEndpointDevicePrimaryName(endpointName, L"", L""); + + // all the standard properties we define for endpoints + if (internal::AddStandardEndpointProperties( + interfaceDeviceProperties, + m_TransportAbstractionId, + MidiEndpointDevicePurposePropertyValue::DiagnosticLoopback, + friendlyName, + mnemonic, + endpointName, + endpointDescription, + L"", + L"", + UniqueId, + MidiDataFormat::MidiDataFormat_UMP, + MIDI_PROP_NATIVEDATAFORMAT_UMP, + multiClient, + requiresMetadataHandler, + generateIncomingTimestamps + )) + { + // all good. Add additional properties + // additional properties for this abstraction + + // we clear this because it's not used for this abstraction. + interfaceDeviceProperties.push_back(internal::BuildEmptyDevProperty(PKEY_MIDI_AssociatedUMP)); + } + else + { + // unable to build properties + + TraceLoggingWrite( + MidiDiagnosticsAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Unable to build standard endpoint properties list", "message") + ); + + return E_FAIL; + } DEVPROPERTY deviceDevProperties[] = { {{DEVPKEY_Device_PresenceNotForDevice, DEVPROP_STORE_SYSTEM, nullptr}, @@ -169,8 +181,6 @@ CMidi2DiagnosticsEndpointManager::CreateLoopbackEndpoint( DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)),&devPropTrue} }; - OutputDebugString(__FUNCTION__ L": Building SW_DEVICE_CREATE_INFO\n"); - SW_DEVICE_CREATE_INFO createInfo = {}; createInfo.cbSize = sizeof(createInfo); @@ -183,15 +193,13 @@ CMidi2DiagnosticsEndpointManager::CreateLoopbackEndpoint( wchar_t newDeviceInterfaceId[deviceInterfaceIdMaxSize]{ 0 }; - OutputDebugString(__FUNCTION__ L": About to ActivateEndpoint\n"); - RETURN_IF_FAILED(m_MidiDeviceManager->ActivateEndpoint( (PCWSTR)m_parentDeviceId.c_str(), // parent instance Id true, // UMP-only Flow, // MIDI Flow - ARRAYSIZE(interfaceDevProperties), + (ULONG)interfaceDeviceProperties.size(), ARRAYSIZE(deviceDevProperties), - (PVOID)interfaceDevProperties, + (PVOID)interfaceDeviceProperties.data(), (PVOID)deviceDevProperties, (PVOID)&createInfo, (LPWSTR)&newDeviceInterfaceId, @@ -208,13 +216,8 @@ CMidi2DiagnosticsEndpointManager::CreateLoopbackEndpoint( // TODO: Invoke the protocol negotiator to now capture updated endpoint info. - - - // todo: store the interface id and use it for matches later instead of the current partial string match - OutputDebugString(__FUNCTION__ L": Complete\n"); - return S_OK; } @@ -222,53 +225,77 @@ _Use_decl_annotations_ HRESULT CMidi2DiagnosticsEndpointManager::CreatePingEndpoint( std::wstring const InstanceId, + std::wstring const UniqueId, std::wstring const Name, MidiFlow const Flow ) { - OutputDebugString(L"" __FUNCTION__); + TraceLoggingWrite( + MidiDiagnosticsAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this") + ); //put all of the devproperties we want into arrays and pass into ActivateEndpoint: std::wstring mnemonic(TRANSPORT_MNEMONIC); DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; - DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; - BYTE nativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP; - UINT32 supportedDataFormat = (UINT32)MidiDataFormat::MidiDataFormat_UMP; - - auto endpointPurpose = (uint32_t)MidiEndpointDevicePurposePropertyValue::DiagnosticPing; - - std::wstring description = L"Internal UMP Ping endpoint. Do not send messages to this endpoint."; - - DEVPROPERTY interfaceDevProperties[] = { - {{DEVPKEY_DeviceInterface_FriendlyName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((Name.length() + 1) * sizeof(WCHAR)), (PVOID)Name.c_str()}, - {{PKEY_MIDI_TransportSuppliedEndpointName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((Name.length() + 1) * sizeof(WCHAR)), (PVOID)Name.c_str()}, - - {{PKEY_MIDI_EndpointRequiresMetadataHandler, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropFalse)), &devPropFalse}, - - {{PKEY_MIDI_SupportedDataFormats, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(UINT32)), &supportedDataFormat}, - - - - {{PKEY_MIDI_AbstractionLayer, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_GUID, static_cast(sizeof(GUID)), (PVOID)&AbstractionLayerGUID }, // essential to instantiate the right endpoint types - {{PKEY_MIDI_EndpointDevicePurpose, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(endpointPurpose)),(PVOID)&endpointPurpose}, - {{PKEY_MIDI_TransportSuppliedDescription, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((description.length() + 1) * sizeof(WCHAR)), (PVOID)description.c_str() }, - {{PKEY_MIDI_NativeDataFormat, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BYTE, static_cast(sizeof(BYTE)), (PVOID)&nativeDataFormat}, - {{PKEY_MIDI_TransportMnemonic, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((mnemonic.length() + 1) * sizeof(WCHAR)), (PVOID)mnemonic.c_str()} - - - }; - + //DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; + + std::wstring endpointName = Name; + std::wstring endpointDescription = L"Internal UMP Ping endpoint. Do not send messages to this endpoint."; + + std::vector interfaceDeviceProperties{}; + + bool requiresMetadataHandler = false; + bool multiClient = true; + bool generateIncomingTimestamps = true; + + // no user or in-protocol data in this case + std::wstring friendlyName = internal::CalculateEndpointDevicePrimaryName(endpointName, L"", L""); + + // all the standard properties we define for endpoints + if (internal::AddStandardEndpointProperties( + interfaceDeviceProperties, + m_TransportAbstractionId, + MidiEndpointDevicePurposePropertyValue::DiagnosticPing, + friendlyName, + mnemonic, + endpointName, + endpointDescription, + L"", + L"", + UniqueId, + MidiDataFormat::MidiDataFormat_UMP, + MIDI_PROP_NATIVEDATAFORMAT_UMP, + multiClient, + requiresMetadataHandler, + generateIncomingTimestamps + )) + { + // all good. Add additional properties + // additional properties for this abstraction + + // we clear this because it's not used for this abstraction. + interfaceDeviceProperties.push_back(internal::BuildEmptyDevProperty(PKEY_MIDI_AssociatedUMP)); + + } + else + { + // unable to build properties + + TraceLoggingWrite( + MidiDiagnosticsAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Unable to build standard endpoint properties list", "message") + ); + + return E_FAIL; + } DEVPROPERTY deviceDevProperties[] = { {{DEVPKEY_Device_PresenceNotForDevice, DEVPROP_STORE_SYSTEM, nullptr}, @@ -292,9 +319,9 @@ CMidi2DiagnosticsEndpointManager::CreatePingEndpoint( m_parentDeviceId.c_str(), // parent instance Id true, // UMP-only Flow, // MIDI Flow - ARRAYSIZE(interfaceDevProperties), + (ULONG)interfaceDeviceProperties.size(), ARRAYSIZE(deviceDevProperties), - (PVOID)interfaceDevProperties, + (PVOID)interfaceDeviceProperties.data(), (PVOID)deviceDevProperties, (PVOID)&createInfo, (LPWSTR)&newDeviceInterfaceId, @@ -302,8 +329,6 @@ CMidi2DiagnosticsEndpointManager::CreatePingEndpoint( // TODO: Get the device interface id and store it for comparison later. - OutputDebugString(__FUNCTION__ L": Complete\n"); - return S_OK; } @@ -311,8 +336,6 @@ CMidi2DiagnosticsEndpointManager::CreatePingEndpoint( HRESULT CMidi2DiagnosticsEndpointManager::Cleanup() { - OutputDebugString(L"" __FUNCTION__ " Enter"); - TraceLoggingWrite( MidiDiagnosticsAbstractionTelemetryProvider::Provider(), __FUNCTION__, diff --git a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.h b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.h index a2d93de6..7d2794e9 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.h +++ b/src/api/Abstraction/DiagnosticsAbstraction/Midi2.DiagnosticsEndpointManager.h @@ -23,15 +23,17 @@ class CMidi2DiagnosticsEndpointManager : private: GUID m_ContainerId{}; - GUID m_TransportAbstractionId{}; + GUID m_TransportAbstractionId{ __uuidof(Midi2DiagnosticsAbstraction) }; HRESULT CreateLoopbackEndpoint( _In_ std::wstring const InstanceId, + _In_ std::wstring const UniqueId, _In_ std::wstring const Name, _In_ MidiFlow const Flow); HRESULT CreatePingEndpoint( _In_ std::wstring const InstanceId, + _In_ std::wstring const UniqueId, _In_ std::wstring const Name, _In_ MidiFlow const Flow); diff --git a/src/api/Abstraction/DiagnosticsAbstraction/abstraction_defs.h b/src/api/Abstraction/DiagnosticsAbstraction/abstraction_defs.h index e4c10a0a..32c6876e 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/abstraction_defs.h +++ b/src/api/Abstraction/DiagnosticsAbstraction/abstraction_defs.h @@ -19,12 +19,15 @@ #define TRANSPORT_PARENT_DEVICE_NAME L"MIDI 2.0 Diagnostics Devices" #define DEFAULT_LOOPBACK_BIDI_A_ID L"MIDIU_DIAG_LOOPBACK_A" +#define LOOPBACK_BIDI_A_UNIQUE_ID L"LOOPBACK_A" #define DEFAULT_LOOPBACK_BIDI_A_NAME L"Diagnostics Loopback A" #define DEFAULT_LOOPBACK_BIDI_B_ID L"MIDIU_DIAG_LOOPBACK_B" +#define LOOPBACK_BIDI_B_UNIQUE_ID L"LOOPBACK_B" #define DEFAULT_LOOPBACK_BIDI_B_NAME L"Diagnostics Loopback B" #define DEFAULT_PING_BIDI_ID L"MIDIU_DIAG_PING" +#define PING_BIDI_UNIQUE_ID L"PING" #define DEFAULT_PING_BIDI_NAME L"Diagnostics Ping (Internal)" diff --git a/src/api/Abstraction/DiagnosticsAbstraction/pch.h b/src/api/Abstraction/DiagnosticsAbstraction/pch.h index 992c12d8..78cf4beb 100644 --- a/src/api/Abstraction/DiagnosticsAbstraction/pch.h +++ b/src/api/Abstraction/DiagnosticsAbstraction/pch.h @@ -47,11 +47,27 @@ #include "SWDevice.h" #include #include "setupapi.h" -#include "Devpkey.h" +//#include "Devpkey.h" #include "strsafe.h" -#include "string_util.h" +#include "wstring_util.h" + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" +#include "json_helpers.h" + +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + +namespace internal = ::Windows::Devices::Midi2::Internal; + #include "abstraction_defs.h" #include "Midi2DiagnosticsAbstraction_i.c" diff --git a/src/api/Abstraction/KSAbstraction/Midi2.KSAbstraction.vcxproj b/src/api/Abstraction/KSAbstraction/Midi2.KSAbstraction.vcxproj index f12150f7..a0fa44b3 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.22621.0 + 10.0.20348.0 @@ -95,34 +95,34 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration); + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration); + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration); + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_IncludePath);$(WindowsSDK_IncludePath) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration); + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration); + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration); + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_IncludePath);$(WindowsSDK_IncludePath) @@ -133,7 +133,7 @@ $(IntDir)$(ProjectName).tlb - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Level4 Create pch.h @@ -141,7 +141,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -153,7 +153,7 @@ $(IntDir)$(ProjectName).tlb - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Level4 Create pch.h @@ -161,7 +161,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -173,7 +173,7 @@ $(IntDir)$(ProjectName).tlb - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Level4 Create pch.h @@ -181,7 +181,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -193,7 +193,7 @@ $(IntDir)$(ProjectName).tlb - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Level4 Create pch.h @@ -201,7 +201,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def @@ -213,12 +213,12 @@ $(IntDir)$(ProjectName).tlb - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h true @@ -227,12 +227,12 @@ - %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;midiks.lib;midikscommon.lib;midiksenum.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies) Midi2.KSAbstraction.def Level4 - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h true diff --git a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.cpp b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.cpp index 7381b30d..50a984cd 100644 --- a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.cpp +++ b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.cpp @@ -32,11 +32,12 @@ CMidi2KSMidiConfigurationManager::Initialize( _Use_decl_annotations_ HRESULT -CMidi2KSMidiConfigurationManager::UpdateConfiguration(LPCWSTR configurationJson, BSTR* response) +CMidi2KSMidiConfigurationManager::UpdateConfiguration(LPCWSTR configurationJson, BOOL IsFromConfigurationFile, BSTR* response) { OutputDebugString(L"\n" __FUNCTION__); UNREFERENCED_PARAMETER(configurationJson); + UNREFERENCED_PARAMETER(IsFromConfigurationFile); // temp. Also, client needs to free this. diff --git a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.h b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.h index 9fc53dfd..f3541e6f 100644 --- a/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.h +++ b/src/api/Abstraction/KSAbstraction/Midi2.KSMidiConfigurationManager.h @@ -17,7 +17,7 @@ class CMidi2KSMidiConfigurationManager : public: STDMETHOD(Initialize(_In_ GUID abstractionGuid, _In_ IUnknown* deviceManagerInterface)); - STDMETHOD(UpdateConfiguration(_In_ LPCWSTR configurationJson, _Out_ BSTR* response)); + STDMETHOD(UpdateConfiguration(_In_ LPCWSTR configurationJson, _In_ BOOL IsFromConfigurationFile, _Out_ BSTR* response)); STDMETHOD(Cleanup)(); private: diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.cpp b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.cpp index dea6b079..cae2463f 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.cpp +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.cpp @@ -16,7 +16,12 @@ CMidi2LoopbackMidiAbstraction::Activate( void **Interface ) { - OutputDebugString(L"" __FUNCTION__ " Enter"); + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this") + ); RETURN_HR_IF(E_INVALIDARG, nullptr == Interface); diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.h b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.h index c463498d..3de84271 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.h @@ -15,7 +15,7 @@ class MidiLoopbackMidiAbstractionTelemetryProvider : public wil::TraceLoggingPro "Microsoft.Windows.Midi2.LoopbackMidiAbstraction", // 5a36c0b3-5d4c-545b-b9e7-461470957699 from hash of name using: // PS> [System.Diagnostics.Tracing.EventSource]::new("Microsoft.Windows.Midi2.LoopbackMidiAbstraction").Guid - (0x5a36c0b3,0x5d4,0x545b,0xb9,0xe7,0x46,0x14,0x70,0x95,0x76,0x99)) + (0x5a36c0b3,0x5d4c,0x545b,0xb9,0xe7,0x46,0x14,0x70,0x95,0x76,0x99)) }; using namespace ATL; diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.vcxproj b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiAbstraction.vcxproj index 272cd0d3..7d1e693c 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.22621.0 + 10.0.20348.0 @@ -96,32 +96,32 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\;$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ @@ -141,65 +141,65 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.LoopbackMidiAbstraction.def $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\midi2.LoopbackMidiabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ %(Filename).h true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.LoopbackMidiAbstraction.def $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\midi2.LoopbackMidiabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ %(Filename).h true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.LoopbackMidiAbstraction.def $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\midi2.LoopbackMidiabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ %(Filename).h - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -220,12 +220,12 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.LoopbackMidiAbstraction.def $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\midi2.LoopbackMidiabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ %(Filename).h @@ -237,18 +237,18 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.LoopbackMidiAbstraction.def $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\midi2.LoopbackMidiabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ %(Filename).h - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -264,12 +264,12 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.LoopbackMidiAbstraction.def $(SolutionDir)\idl;%(AdditionalIncludeDirectories) - $(SolutionDir)VSFiles\intermediate\midi2.LoopbackMidiabstraction\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ %(Filename).h diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiBidi.cpp b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiBidi.cpp index b344db39..1e46e486 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiBidi.cpp +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiBidi.cpp @@ -35,7 +35,8 @@ CMidi2LoopbackMidiBiDi::Initialize( // TODO: This should use SWD properties and not a string search - if (internal::EndpointInterfaceIdContainsString(m_endpointId, MIDI_LOOP_INSTANCE_ID_A_PREFIX)) + if (internal::EndpointInterfaceIdContainsString(m_endpointId, MIDI_PERM_LOOP_INSTANCE_ID_A_PREFIX) || + internal::EndpointInterfaceIdContainsString(m_endpointId, MIDI_TEMP_LOOP_INSTANCE_ID_A_PREFIX)) { TraceLoggingWrite( MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), @@ -50,7 +51,8 @@ CMidi2LoopbackMidiBiDi::Initialize( m_isEndpointA = true; } - else if (internal::EndpointInterfaceIdContainsString(m_endpointId, MIDI_LOOP_INSTANCE_ID_B_PREFIX)) + else if (internal::EndpointInterfaceIdContainsString(m_endpointId, MIDI_PERM_LOOP_INSTANCE_ID_B_PREFIX) || + internal::EndpointInterfaceIdContainsString(m_endpointId, MIDI_TEMP_LOOP_INSTANCE_ID_B_PREFIX)) { TraceLoggingWrite( MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp index 47d6e06c..843cee60 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.cpp @@ -34,7 +34,8 @@ CMidi2LoopbackMidiConfigurationManager::Initialize( _Use_decl_annotations_ HRESULT CMidi2LoopbackMidiConfigurationManager::UpdateConfiguration( - LPCWSTR ConfigurationJsonSection, + LPCWSTR ConfigurationJsonSection, + BOOL IsFromConfigurationFile, BSTR* Response ) { @@ -52,100 +53,179 @@ CMidi2LoopbackMidiConfigurationManager::UpdateConfiguration( json::JsonObject jsonObject; json::JsonObject responseObject; - json::JsonArray createdDevicesResponseArray; + // default to failure + internal::JsonSetBoolProperty(responseObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_SUCCESS_PROPERTY_KEY, false); - if (!json::JsonObject::TryParse(winrt::to_hstring(ConfigurationJsonSection), jsonObject)) - { - TraceLoggingWrite( - MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), - __FUNCTION__, - TraceLoggingLevel(WINEVENT_LEVEL_ERROR), - TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Failed to parse Configuration JSON", "message"), - TraceLoggingWideString(ConfigurationJsonSection, "json") - ); - return E_FAIL; - } + try + { - auto createArray = internal::JsonGetArrayProperty(jsonObject, MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICES_CREATE_ARRAY_KEY); + if (!json::JsonObject::TryParse(winrt::to_hstring(ConfigurationJsonSection), jsonObject)) + { + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Failed to parse Configuration JSON", "message"), + TraceLoggingWideString(ConfigurationJsonSection, "json") + ); + + internal::JsonStringifyObjectToOutParam(responseObject, &Response); + + return E_FAIL; + } - if (createArray == nullptr || createArray.Size() == 0) - { - // nothing in the array. Maybe we're looking at update or delete - return S_OK; - } + // I was tempted to call this the Prefix Code. KHAN!! + std::wstring instanceIdPrefixA = IsFromConfigurationFile ? MIDI_PERM_LOOP_INSTANCE_ID_A_PREFIX : MIDI_TEMP_LOOP_INSTANCE_ID_A_PREFIX; + std::wstring instanceIdPrefixB = IsFromConfigurationFile ? MIDI_PERM_LOOP_INSTANCE_ID_B_PREFIX : MIDI_TEMP_LOOP_INSTANCE_ID_B_PREFIX; + // we should probably set a property based on this as well. - // iterate through all the work we need to do. Just - // "create" instructions, in this case. - for (uint32_t i = 0; i < createArray.Size(); i++) - { - auto jsonEntry = (createArray.GetObjectAt(i)); - if (jsonEntry) - { - //MidiVirtualDeviceEndpointEntry deviceEntry; - //deviceEntry.VirtualEndpointAssociationId = internal::JsonGetWStringProperty( - // jsonEntry, - // MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_ASSOCIATION_ID_PROPERTY_KEY, - // L""); + auto createObject = internal::JsonGetObjectProperty(jsonObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_CREATE_KEY, json::JsonObject{}); - //deviceEntry.ShortUniqueId = internal::JsonGetWStringProperty( - // jsonEntry, - // MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_UNIQUE_ID_PROPERTY_KEY, - // L""); + // Create ---------------------------------- - //deviceEntry.BaseEndpointName = internal::JsonGetWStringProperty( - // jsonEntry, - // MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, - // L""); + if (createObject.Size() > 0) + { + auto o = createObject.First(); + + while (o.HasCurrent()) + { + std::shared_ptr definitionA = std::make_shared(); + std::shared_ptr definitionB = std::make_shared(); + + auto associationObj = o.Current().Value().as(); + + definitionA->AssociationId = o.Current().Key(); + + auto endpointAObject = internal::JsonGetObjectProperty(associationObj, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_A_KEY, nullptr); + auto endpointBObject = internal::JsonGetObjectProperty(associationObj, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_B_KEY, nullptr); + + if (endpointAObject != nullptr && endpointBObject != nullptr) + { + definitionA->EndpointName = internal::JsonGetWStringProperty(endpointAObject, MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, L""); + definitionA->EndpointName = internal::JsonGetWStringProperty(endpointAObject, MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, L""); + definitionA->EndpointName = internal::JsonGetWStringProperty(endpointAObject, MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, L""); + definitionA->InstanceIdPrefix = instanceIdPrefixA; + + definitionB->EndpointName = internal::JsonGetWStringProperty(endpointBObject, MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, L""); + definitionB->EndpointName = internal::JsonGetWStringProperty(endpointBObject, MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, L""); + definitionB->EndpointName = internal::JsonGetWStringProperty(endpointBObject, MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, L""); + definitionB->InstanceIdPrefix = instanceIdPrefixB; + + + if (SUCCEEDED(AbstractionState::Current().GetEndpointManager()->CreateEndpointPair(definitionA, definitionB))) + { + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Loopback endpoint pair created", "message") + ); + + // all good + + internal::JsonSetBoolProperty( + responseObject, + MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_SUCCESS_PROPERTY_KEY, + true); + + // update the return json with the new Ids + + internal::JsonSetWStringProperty( + responseObject, + MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_A_ID_KEY, + definitionA->CreatedEndpointInterfaceId); + + internal::JsonSetWStringProperty( + responseObject, + MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_CREATED_ENDPOINT_B_ID_KEY, + definitionB->CreatedEndpointInterfaceId); + } + else + { + // we failed to create the endpoints. Exit and return a fail. + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Failed to create endpoints", "message") + ); + + } + } + else + { + // couldn't get the endpointA or endpointB objects. Exit and return a fail + + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Failed to get one or both endpoints from the JSON", "message") + ); + + } + + o.MoveNext(); + } + } + else + { + // nothing to create. + } - //deviceEntry.Description = internal::JsonGetWStringProperty( - // jsonEntry, - // MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, - // L""); - // TODO: if no association id, or it already exists in the table, bail + //auto deleteArray = internal::JsonGetArrayProperty(jsonObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_REMOVE_KEY); - // TODO: if no unique Id, bail or maybe generate one + //// Remove ---------------------------------- - // TODO: if a unique id and it's larger than the max length, truncate it + //if (deleteArray.Size() > 0) + //{ + // // TODO : Delete endpoints if they aren't in the config file - // create the device-side endpoint - // LOG_IF_FAILED(AbstractionState::Current().GetEndpointManager()->CreateDeviceSideEndpoint(deviceEntry)); + //} + //else + //{ + // // nothing to remove. + //} - // TODO: This should have the association Id or something in it for the client to make sense of it - //auto singleResponse = internal::JsonCreateSingleWStringPropertyObject( - // MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_ID_PROPERTY_KEY, - // deviceEntry.CreatedDeviceEndpointId); + //auto updateArray = internal::JsonGetArrayProperty(jsonObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_UPDATE_KEY); - // createdDevicesResponseArray.Append(singleResponse); - } - } + //// Update ---------------------------------- - responseObject.SetNamedValue( - MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_CREATED_DEVICES_ARRAY_KEY, - createdDevicesResponseArray); + //if (updateArray.Size() > 0) + //{ + // // TODO + //} + //else + //{ + // // TODO : Update endpoints + //} - // TODO: Process all "update" and "remove" instructions - + } + catch (...) + { + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Exception processing json", "message"), + TraceLoggingWideString(ConfigurationJsonSection, "json") + ); - // TODO: Actual Success or fail response - internal::JsonSetBoolProperty( - responseObject, - MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_SUCCESS_PROPERTY_KEY, - true); + internal::JsonStringifyObjectToOutParam(responseObject, &Response); - TraceLoggingWrite( - MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), - __FUNCTION__, - TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this"), - TraceLoggingWideString(responseObject.Stringify().c_str()) - ); + return E_FAIL; + } // return the json with the information the client will need internal::JsonStringifyObjectToOutParam(responseObject, &Response); diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.h b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.h index c0eb4cc3..fffe1ede 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiConfigurationManager.h @@ -17,7 +17,7 @@ class CMidi2LoopbackMidiConfigurationManager : { public: STDMETHOD(Initialize(_In_ GUID AbstractionId, _In_ IUnknown* MidiDeviceManager)); - STDMETHOD(UpdateConfiguration(_In_ LPCWSTR ConfigurationJsonSection, _Out_ BSTR* Response)); + STDMETHOD(UpdateConfiguration(_In_ LPCWSTR ConfigurationJsonSection, _In_ BOOL IsFromConfigurationFile, _Out_ BSTR* Response)); STDMETHOD(Cleanup)(); private: diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.cpp b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.cpp index a6fd6749..a1d7b276 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.cpp +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.cpp @@ -50,16 +50,6 @@ CMidi2LoopbackMidiEndpointManager::Initialize( -_Use_decl_annotations_ -HRESULT -CMidi2LoopbackMidiEndpointManager::DeleteEndpointPair(std::shared_ptr definition) -{ - - return S_OK; -} - - - HRESULT CMidi2LoopbackMidiEndpointManager::CreateParentDevice() { @@ -109,48 +99,250 @@ CMidi2LoopbackMidiEndpointManager::CreateParentDevice() _Use_decl_annotations_ -HRESULT -CMidi2LoopbackMidiEndpointManager::CreateEndpointPair( +HRESULT +CMidi2LoopbackMidiEndpointManager::DeleteEndpointPair( + _In_ std::shared_ptr definitionA, + _In_ std::shared_ptr definitionB) +{ + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this") + ); + + // we can't really do much with the return values here other than log them. + + LOG_IF_FAILED(DeleteSingleEndpoint(definitionA)); + LOG_IF_FAILED(DeleteSingleEndpoint(definitionB)); + + return S_OK; +} + + +_Use_decl_annotations_ +HRESULT +CMidi2LoopbackMidiEndpointManager::DeleteSingleEndpoint( std::shared_ptr definition ) { + RETURN_HR_IF_NULL(E_INVALIDARG, definition); + TraceLoggingWrite( MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_INFO), - TraceLoggingPointer(this, "this") + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(definition->AssociationId.c_str(), "association id"), + TraceLoggingWideString(definition->EndpointUniqueIdentifier.c_str(), "unique identifier"), + TraceLoggingWideString(definition->InstanceIdPrefix.c_str(), "prefix"), + TraceLoggingWideString(definition->EndpointName.c_str(), "name"), + TraceLoggingWideString(definition->EndpointDescription.c_str(), "description") ); + return m_MidiDeviceManager->DeactivateEndpoint(definition->CreatedShortClientInstanceId.c_str()); +} + + + +_Use_decl_annotations_ +HRESULT +CMidi2LoopbackMidiEndpointManager::CreateSingleEndpoint( + std::shared_ptr definition + ) +{ + RETURN_HR_IF_NULL(E_INVALIDARG, definition); + + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(definition->AssociationId.c_str(), "association id"), + TraceLoggingWideString(definition->EndpointUniqueIdentifier.c_str(), "unique identifier"), + TraceLoggingWideString(definition->InstanceIdPrefix.c_str(), "prefix"), + TraceLoggingWideString(definition->EndpointName.c_str(), "name"), + TraceLoggingWideString(definition->EndpointDescription.c_str(), "description") + ); + + + RETURN_HR_IF_MSG(E_INVALIDARG, definition->EndpointName.empty(), "Empty endpoint name"); + RETURN_HR_IF_MSG(E_INVALIDARG, definition->InstanceIdPrefix.empty(), "Empty endpoint prefix"); + RETURN_HR_IF_MSG(E_INVALIDARG, definition->EndpointUniqueIdentifier.empty(), "Empty endpoint unique id"); + + + //put all of the devproperties we want into arrays and pass into ActivateEndpoint: + + std::wstring mnemonic(TRANSPORT_MNEMONIC); + + DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; + // DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; + + std::wstring endpointName = definition->EndpointName; + std::wstring endpointDescription = definition->EndpointDescription; + + std::vector interfaceDeviceProperties{}; + + bool requiresMetadataHandler = false; + bool multiClient = true; + bool generateIncomingTimestamps = true; + + // no user or in-protocol data in this case + std::wstring friendlyName = internal::CalculateEndpointDevicePrimaryName(endpointName, L"", L""); + + // all the standard properties we define for endpoints + if (internal::AddStandardEndpointProperties( + interfaceDeviceProperties, + m_TransportAbstractionId, + MidiEndpointDevicePurposePropertyValue::NormalMessageEndpoint, + friendlyName, + mnemonic, + endpointName, + endpointDescription, + L"", + L"", + definition->EndpointUniqueIdentifier, + MidiDataFormat::MidiDataFormat_UMP, + MIDI_PROP_NATIVEDATAFORMAT_UMP, + multiClient, + requiresMetadataHandler, + generateIncomingTimestamps + )) + { + // additional properties for this abstraction + + // we clear this because it's not used for this abstraction. + interfaceDeviceProperties.push_back(internal::BuildEmptyDevProperty(PKEY_MIDI_AssociatedUMP)); + + // this is needed for the loopback endpoints to have a relationship with each other + interfaceDeviceProperties.push_back(internal::BuildWStringDevProperty(PKEY_MIDI_VirtualMidiEndpointAssociator, definition->AssociationId)); + } + else + { + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Unable to build standard endpoint properties list", "message") + ); + + return E_FAIL; + } + + // Device properties + + DEVPROPERTY deviceDevProperties[] = { + {{DEVPKEY_Device_PresenceNotForDevice, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)), &devPropTrue}, + {{DEVPKEY_Device_NoConnectSound, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)),&devPropTrue} + }; - // workflow: - // Configuration manager adds the entries to the endpoint table - // Then calls this function to create the pair of endpoints - // - // When endpoints BiDi are instantiated, they look at the endpoint - // table to see what they are supposed to connect to. - // - // They can be created in any order, so that will need to be - // checked for each created endpoint. - // - // Perhaps the table itself should just contain IMidiBiDi-like - // functions that are called by the endpoints? Then the endpoints - // don't need to know anything other than where to send the message. - // That would also be a pattern we can use for other types of - // routing. - // - // So perhaps a set of definitions associated by association id and - // then a related table of routing which has the required functions - // and pointers. Or maybe it all stays in the same definition class? - // and just rename it to MidiLoopbackEndpointDevice ? + SW_DEVICE_CREATE_INFO createInfo = {}; + createInfo.cbSize = sizeof(createInfo); + // build the instance id, which becomes the middle of the SWD id + std::wstring instanceId = internal::NormalizeDeviceInstanceIdWStringCopy( + definition->InstanceIdPrefix + definition->EndpointUniqueIdentifier); + + createInfo.pszInstanceId = instanceId.c_str(); + createInfo.CapabilityFlags = SWDeviceCapabilitiesNone; + createInfo.pszDeviceDescription = endpointName.c_str(); + const ULONG deviceInterfaceIdMaxSize = 255; + wchar_t newDeviceInterfaceId[deviceInterfaceIdMaxSize]{ 0 }; + RETURN_IF_FAILED(m_MidiDeviceManager->ActivateEndpoint( + (PCWSTR)m_parentDeviceId.c_str(), // parent instance Id + true, // UMP-only + MidiFlow::MidiFlowBidirectional, // MIDI Flow + (ULONG)interfaceDeviceProperties.size(), + ARRAYSIZE(deviceDevProperties), + (PVOID)interfaceDeviceProperties.data(), + (PVOID)deviceDevProperties, + (PVOID)&createInfo, + (LPWSTR)&newDeviceInterfaceId, + deviceInterfaceIdMaxSize)); + // now delete all the properties that have been discovered in-protocol + // we have to do this because they end up cached by PNP and come back + // when you recreate a device with the same Id. This is a real problem + // if you are testing function blocks or endpoint properties with this + // loopback transport. + m_MidiDeviceManager->DeleteAllEndpointInProtocolDiscoveredProperties(newDeviceInterfaceId); + // we need this for removal later + definition->CreatedShortClientInstanceId = instanceId; + + definition->CreatedEndpointInterfaceId = internal::NormalizeEndpointInterfaceIdWStringCopy(newDeviceInterfaceId); + + //MidiEndpointTable::Current().AddCreatedEndpointDevice(entry); + //MidiEndpointTable::Current().AddCreatedClient(entry.VirtualEndpointAssociationId, entry.CreatedClientEndpointId); + + return S_OK; +} + + + + + +_Use_decl_annotations_ +HRESULT +CMidi2LoopbackMidiEndpointManager::CreateEndpointPair( + std::shared_ptr definitionA, + std::shared_ptr definitionB +) +{ + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this") + ); + if (SUCCEEDED(CreateSingleEndpoint(definitionA))) + { + if (SUCCEEDED(CreateSingleEndpoint(definitionB))) + { + + // all good now + + } + else + { + // failed to create B. We need to remove A now + + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Failed to create loopback endpoint B. Removing A now.", "message") + ); + + // we can't do anything with the return value here + DeleteSingleEndpoint(definitionA); + + return E_FAIL; + } + } + else + { + // failed to create A + TraceLoggingWrite( + MidiLoopbackMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Failed to create loopback endpoint A", "message") + ); + + return E_FAIL; + } return S_OK; } diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.h b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.h index b6b79a97..9be3ed54 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/Midi2.LoopbackMidiEndpointManager.h @@ -24,10 +24,17 @@ class CMidi2LoopbackMidiEndpointManager : // _Out_ LPWSTR resultJson //)); + HRESULT CreateEndpointPair( + _In_ std::shared_ptr definitionA, + _In_ std::shared_ptr definitionB + ); + + HRESULT DeleteEndpointPair( + _In_ std::shared_ptr definitionA, + _In_ std::shared_ptr definitionB + ); - HRESULT CreateEndpointPair(_In_ std::shared_ptr definition); - HRESULT DeleteEndpointPair(_In_ std::shared_ptr definition); //HRESULT DeleteEndpointPair( @@ -35,6 +42,20 @@ class CMidi2LoopbackMidiEndpointManager : //); private: + + void CleanupDeviceDefinition(_In_ std::shared_ptr definition) + { + definition->AssociationId = internal::ToLowerTrimmedWStringCopy(definition->AssociationId); + internal::InPlaceTrim(definition->EndpointUniqueIdentifier); + internal::InPlaceTrim(definition->InstanceIdPrefix); + internal::InPlaceTrim(definition->EndpointName); + internal::InPlaceTrim(definition->EndpointDescription); + } + + HRESULT CreateSingleEndpoint(_In_ std::shared_ptr definition); + HRESULT DeleteSingleEndpoint(_In_ std::shared_ptr definition); + + GUID m_ContainerId{}; GUID m_TransportAbstractionId{}; diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDevice.h b/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDevice.h index 6e56e990..5e9bccc0 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDevice.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDevice.h @@ -15,10 +15,9 @@ class MidiLoopbackDevice { public: - MidiLoopbackDeviceDefinition Definition; + MidiLoopbackDeviceDefinition DefinitionA; + MidiLoopbackDeviceDefinition DefinitionB; - std::wstring EndpointAInterfaceId{}; - std::wstring EndpointBInterfaceId{}; void RegisterEndpointA(/*_In_ wil::com_ptr_nothrow endpoint,*/ _In_ wil::com_ptr_nothrow callback) { diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDeviceDefinition.h b/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDeviceDefinition.h index 91308075..dc547978 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDeviceDefinition.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/MidiLoopbackDeviceDefinition.h @@ -11,16 +11,18 @@ // This information is provided by the configuration manager + struct MidiLoopbackDeviceDefinition { std::wstring AssociationId{}; - std::wstring EndpointAName{}; - std::wstring EndpointADescription{}; - std::wstring EndpointAUniqueIdentifier{}; + std::wstring EndpointName{}; + std::wstring EndpointDescription{}; + + std::wstring EndpointUniqueIdentifier{}; - std::wstring EndpointBName{}; - std::wstring EndpointBDescription{}; - std::wstring EndpointBUniqueIdentifier{}; + std::wstring InstanceIdPrefix{}; + std::wstring CreatedShortClientInstanceId{}; + std::wstring CreatedEndpointInterfaceId{}; }; diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/abstraction_defs.h b/src/api/Abstraction/LoopbackMidiAbstraction/abstraction_defs.h index abd67e07..35cdd38f 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/abstraction_defs.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/abstraction_defs.h @@ -12,16 +12,20 @@ // The full Id comes back from the swdevicecreate callback #define TRANSPORT_MNEMONIC L"LOOP" -#define MIDI_LOOP_INSTANCE_ID_A_PREFIX L"MIDIU_LOOP_A_" -#define MIDI_LOOP_INSTANCE_ID_B_PREFIX L"MIDIU_LOOP_B_" + +#define MIDI_PERM_LOOP_INSTANCE_ID_A_PREFIX L"MIDIU_LOOP_A_" +#define MIDI_PERM_LOOP_INSTANCE_ID_B_PREFIX L"MIDIU_LOOP_B_" + +#define MIDI_TEMP_LOOP_INSTANCE_ID_A_PREFIX L"MIDIU_LOOP_A_RT_" +#define MIDI_TEMP_LOOP_INSTANCE_ID_B_PREFIX L"MIDIU_LOOP_B_RT_" + // TODO: Names should be moved to .rc for localization #define TRANSPORT_PARENT_ID L"MIDIU_LOOP_TRANSPORT" #define TRANSPORT_PARENT_DEVICE_NAME L"MIDI 2.0 Loopback Devices" - - #define LOOPBACK_PARENT_ROOT L"HTREE\\ROOT\\0" + #define TRANSPORT_ENUMERATOR L"MIDISRV" diff --git a/src/api/Abstraction/LoopbackMidiAbstraction/pch.h b/src/api/Abstraction/LoopbackMidiAbstraction/pch.h index e22b6c3c..ca66d19a 100644 --- a/src/api/Abstraction/LoopbackMidiAbstraction/pch.h +++ b/src/api/Abstraction/LoopbackMidiAbstraction/pch.h @@ -62,12 +62,25 @@ #include "SWDevice.h" #include #include "setupapi.h" -#include "Devpkey.h" +//#include "Devpkey.h" #include "strsafe.h" -#include "string_util.h" +#include "wstring_util.h" + + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" #include "json_helpers.h" +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + namespace internal = ::Windows::Devices::Midi2::Internal; #include "abstraction_defs.h" @@ -75,6 +88,8 @@ namespace internal = ::Windows::Devices::Midi2::Internal; #include "Midi2LoopbackMidiAbstraction_i.c" #include "Midi2LoopbackMidiAbstraction.h" + + #include "mididevicemanagerinterface_i.c" #include "mididevicemanagerinterface.h" @@ -84,8 +99,6 @@ namespace internal = ::Windows::Devices::Midi2::Internal; #include "dllmain.h" -#include "MidiDefs.h" -#include "MidiXProc.h" class CMidi2LoopbackMidiEndpointManager; class CMidi2LoopbackMidiBiDi; diff --git a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.vcxproj b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvAbstraction.vcxproj index aeb25f37..28dfb3dc 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.22621.0 + 10.0.20348.0 diff --git a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.cpp b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.cpp index 1cf80f12..8e0f9ad7 100644 --- a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.cpp +++ b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.cpp @@ -12,7 +12,7 @@ _Use_decl_annotations_ HRESULT -CMidi2MidiSrvConfigurationManager::UpdateConfiguration(LPCWSTR configurationJson, BSTR* response) +CMidi2MidiSrvConfigurationManager::UpdateConfiguration(LPCWSTR configurationJson, BOOL IsFromConfigurationFile, BSTR* response) { TraceLoggingWrite( MidiSrvAbstractionTelemetryProvider::Provider(), @@ -31,7 +31,7 @@ CMidi2MidiSrvConfigurationManager::UpdateConfiguration(LPCWSTR configurationJson { // RPC calls are placed in a lambda to work around compiler error C2712, limiting use of try/except blocks // with structured exception handling. - RpcTryExcept RETURN_IF_FAILED(MidiSrvUpdateConfiguration(bindingHandle.get(), configurationJson, response)); + RpcTryExcept RETURN_IF_FAILED(MidiSrvUpdateConfiguration(bindingHandle.get(), configurationJson, IsFromConfigurationFile, response)); RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) RETURN_IF_FAILED(HRESULT_FROM_WIN32(RpcExceptionCode())); RpcEndExcept return S_OK; diff --git a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.h b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.h index c62243e3..a182c039 100644 --- a/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.h +++ b/src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvConfigurationManager.h @@ -15,7 +15,7 @@ class CMidi2MidiSrvConfigurationManager : { public: STDMETHOD(Initialize(_In_ GUID abstractionGuid, _In_ IUnknown* deviceManagerInterface)); - STDMETHOD(UpdateConfiguration(_In_ LPCWSTR configurationJson, _Out_ BSTR* response)); + STDMETHOD(UpdateConfiguration(_In_ LPCWSTR configurationJson, _In_ BOOL IsFromConfigurationFile, _Out_ BSTR* response)); STDMETHOD(Cleanup)(); private: diff --git a/src/api/Abstraction/MidiSrvAbstraction/pch.h b/src/api/Abstraction/MidiSrvAbstraction/pch.h index c9aa7309..0562ccfb 100644 --- a/src/api/Abstraction/MidiSrvAbstraction/pch.h +++ b/src/api/Abstraction/MidiSrvAbstraction/pch.h @@ -11,6 +11,9 @@ #include #include #include +#include + +using namespace winrt; #include #include @@ -44,6 +47,10 @@ #include #include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + #include "MidiSrvRpc.h" #include "MidiXProc.h" #include "Midi2.MidiSrvAbstraction.h" diff --git a/src/api/Abstraction/NetworkMidiAbstraction/Midi2.NetworkMidiAbstraction.vcxproj b/src/api/Abstraction/NetworkMidiAbstraction/Midi2.NetworkMidiAbstraction.vcxproj index 52346aa9..a077bf24 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.22621.0 + 10.0.20348.0 @@ -95,33 +95,33 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.NetworkMidiabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.NetworkMidiabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.NetworkMidiabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.NetworkMidiabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.NetworkMidiabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midi2.NetworkMidiabstraction\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) @@ -141,13 +141,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.NetworkMidiAbstraction.def @@ -159,13 +159,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.NetworkMidiAbstraction.def @@ -177,13 +177,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.NetworkMidiAbstraction.def @@ -194,12 +194,12 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -220,7 +220,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.NetworkMidiAbstraction.def @@ -237,7 +237,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.NetworkMidiAbstraction.def @@ -248,7 +248,7 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -264,7 +264,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.NetworkMidiAbstraction.def diff --git a/src/api/Abstraction/NetworkMidiAbstraction/pch.h b/src/api/Abstraction/NetworkMidiAbstraction/pch.h index d8e598e1..4e822a25 100644 --- a/src/api/Abstraction/NetworkMidiAbstraction/pch.h +++ b/src/api/Abstraction/NetworkMidiAbstraction/pch.h @@ -51,10 +51,25 @@ namespace json = ::winrt::Windows::Data::Json; #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 "swd_property_helpers.h" +#include "json_helpers.h" + +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + +namespace internal = ::Windows::Devices::Midi2::Internal; #include "Midi2NetworkMidiAbstraction_i.c" #include "Midi2NetworkMidiAbstraction.h" @@ -64,10 +79,6 @@ namespace json = ::winrt::Windows::Data::Json; #include "dllmain.h" -#include "MidiDefs.h" -#include "MidiXProc.h" - - #include "Midi2.NetworkMidiAbstraction.h" #include "Midi2.NetworkMidiIn.h" #include "Midi2.NetworkMidiOut.h" diff --git a/src/api/Abstraction/SampleAbstraction/Midi2.SampleAbstraction.vcxproj b/src/api/Abstraction/SampleAbstraction/Midi2.SampleAbstraction.vcxproj index de89bfdd..07de8143 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.22621.0 + 10.0.20348.0 @@ -96,32 +96,32 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) @@ -141,13 +141,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.SampleAbstraction.def @@ -159,13 +159,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.SampleAbstraction.def @@ -177,13 +177,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.SampleAbstraction.def @@ -194,12 +194,12 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -220,7 +220,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.SampleAbstraction.def @@ -237,7 +237,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.SampleAbstraction.def @@ -248,7 +248,7 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -264,7 +264,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.SampleAbstraction.def diff --git a/src/api/Abstraction/SampleAbstraction/pch.h b/src/api/Abstraction/SampleAbstraction/pch.h index 82313554..286ecad1 100644 --- a/src/api/Abstraction/SampleAbstraction/pch.h +++ b/src/api/Abstraction/SampleAbstraction/pch.h @@ -38,6 +38,21 @@ #include #include +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" +#include "json_helpers.h" + +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + +namespace internal = ::Windows::Devices::Midi2::Internal; + #include "Midi2SampleAbstraction_i.c" #include "Midi2SampleAbstraction.h" diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiAbstraction.vcxproj b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiAbstraction.vcxproj index ae5a5ddd..b6a569dc 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.22621.0 + 10.0.20348.0 @@ -96,32 +96,32 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) @@ -141,13 +141,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualMidiAbstraction.def @@ -159,13 +159,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualMidiAbstraction.def @@ -177,13 +177,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualMidiAbstraction.def @@ -194,12 +194,12 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -220,7 +220,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualMidiAbstraction.def @@ -237,7 +237,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualMidiAbstraction.def @@ -248,7 +248,7 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -264,7 +264,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualMidiAbstraction.def diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp index d42bdecb..7da203ff 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.cpp @@ -35,6 +35,7 @@ _Use_decl_annotations_ HRESULT CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( LPCWSTR ConfigurationJsonSection, + BOOL IsFromConfigurationFile, BSTR* Response ) { @@ -47,6 +48,22 @@ CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( ); + // This abstraction doesn't support creating endpoints from the configuration file. + // They are for runtime creation only. + if (IsFromConfigurationFile) + { + TraceLoggingWrite( + MidiVirtualMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Virtual endpoints can be created only at runtime through the API, not from the configuration file.", "message") + ); + + return E_FAIL; + } + + if (ConfigurationJsonSection == nullptr) return S_OK; //if (ConfigurationJsonSection == L"") return S_OK; @@ -74,6 +91,9 @@ CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( if (createArray == nullptr || createArray.Size() == 0) { // nothing in the array. Maybe we're looking at update or delete + + // TODO: Set the response to something meaningful here + return S_OK; } @@ -94,7 +114,7 @@ CMidi2VirtualMidiConfigurationManager::UpdateConfiguration( deviceEntry.ShortUniqueId = internal::JsonGetWStringProperty( jsonEntry, - MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_UNIQUE_ID_PROPERTY_KEY, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, L""); deviceEntry.BaseEndpointName = internal::JsonGetWStringProperty( diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.h b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.h index 4dbdd8dd..05ba684a 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.h +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiConfigurationManager.h @@ -17,7 +17,7 @@ class CMidi2VirtualMidiConfigurationManager : { public: STDMETHOD(Initialize(_In_ GUID AbstractionId, _In_ IUnknown* MidiDeviceManager)); - STDMETHOD(UpdateConfiguration(_In_ LPCWSTR ConfigurationJsonSection, _Out_ BSTR* Response)); + STDMETHOD(UpdateConfiguration(_In_ LPCWSTR ConfigurationJsonSection, _In_ BOOL IsFromConfigurationFile, _Out_ BSTR* Response)); STDMETHOD(Cleanup)(); private: diff --git a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp index 61f1b094..0aef21ac 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp +++ b/src/api/Abstraction/VirtualMidiAbstraction/Midi2.VirtualMidiEndpointManager.cpp @@ -233,54 +233,61 @@ CMidi2VirtualMidiEndpointManager::CreateClientVisibleEndpoint( DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; // DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; - BYTE nativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP; - UINT32 supportedDataFormat = (UINT32)MidiDataFormat::MidiDataFormat_UMP; - - // this purpose is important because it controls how this shows up to clients - auto endpointPurpose = (uint32_t)MidiEndpointDevicePurposePropertyValue::NormalMessageEndpoint; std::wstring endpointName = entry.BaseEndpointName; std::wstring endpointDescription = entry.Description; - DEVPROPERTY interfaceDevProperties[] = { - - {{PKEY_MIDI_AssociatedUMP, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_EMPTY, 0, nullptr}, - - {{PKEY_MIDI_SupportedDataFormats, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(UINT32)), &supportedDataFormat}, - - {{PKEY_MIDI_SupportsMulticlient, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)),& devPropTrue}, - {{PKEY_MIDI_EndpointRequiresMetadataHandler, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)), &devPropTrue}, - - // this is needed for virtual endpoints (client and device) to have a relationship - {{PKEY_MIDI_VirtualMidiEndpointAssociator, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((entry.VirtualEndpointAssociationId.length() + 1) * sizeof(WCHAR)), (PVOID)entry.VirtualEndpointAssociationId.c_str()}, - - - {{DEVPKEY_DeviceInterface_FriendlyName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((endpointName.length() + 1) * sizeof(WCHAR)), (PVOID)endpointName.c_str()}, - {{PKEY_MIDI_TransportSuppliedEndpointName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((endpointName.length() + 1) * sizeof(WCHAR)), (PVOID)endpointName.c_str()}, + std::vector interfaceDeviceProperties{}; + + bool requiresMetadataHandler = true; + bool multiClient = true; + bool generateIncomingTimestamps = true; + + // no user or in-protocol data in this case + std::wstring friendlyName = internal::CalculateEndpointDevicePrimaryName(endpointName, L"", L""); + + // all the standard properties we define for endpoints + if (internal::AddStandardEndpointProperties( + interfaceDeviceProperties, + m_TransportAbstractionId, + MidiEndpointDevicePurposePropertyValue::NormalMessageEndpoint, + friendlyName, + mnemonic, + endpointName, + endpointDescription, + L"", + L"", + entry.ShortUniqueId, + MidiDataFormat::MidiDataFormat_UMP, + MIDI_PROP_NATIVEDATAFORMAT_UMP, + multiClient, + requiresMetadataHandler, + generateIncomingTimestamps + )) + { + // all good. Add additional properties + // additional properties for this abstraction - {{PKEY_MIDI_EndpointDevicePurpose, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(endpointPurpose)),(PVOID)&endpointPurpose}, - {{PKEY_MIDI_UserSuppliedDescription, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((endpointDescription.length() + 1) * sizeof(WCHAR)), (PVOID)endpointDescription.c_str() }, - {{PKEY_MIDI_NativeDataFormat, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BYTE, static_cast(sizeof(BYTE)), (PVOID)&nativeDataFormat}, + // we clear this because it's not used for this abstraction. + interfaceDeviceProperties.push_back(internal::BuildEmptyDevProperty(PKEY_MIDI_AssociatedUMP)); - {{PKEY_MIDI_GenerateIncomingTimestamp, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)), (PVOID)&devPropTrue}, + // this is needed for the loopback endpoints to have a relationship with each other + interfaceDeviceProperties.push_back(internal::BuildWStringDevProperty(PKEY_MIDI_VirtualMidiEndpointAssociator, entry.VirtualEndpointAssociationId)); + } + else + { + // unable to build properties + TraceLoggingWrite( + MidiVirtualMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Unable to build standard endpoint properties list", "message") + ); - {{PKEY_MIDI_AbstractionLayer, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_GUID, static_cast(sizeof(GUID)), (PVOID)&AbstractionLayerGUID }, // essential to instantiate the right endpoint types - {{PKEY_MIDI_TransportMnemonic, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((mnemonic.length() + 1) * sizeof(WCHAR)), (PVOID)mnemonic.c_str()}, - }; + return E_FAIL; + } DEVPROPERTY deviceDevProperties[] = { {{DEVPKEY_Device_PresenceNotForDevice, DEVPROP_STORE_SYSTEM, nullptr}, @@ -306,9 +313,9 @@ CMidi2VirtualMidiEndpointManager::CreateClientVisibleEndpoint( (PCWSTR)m_parentDeviceId.c_str(), // parent instance Id true, // UMP-only MidiFlow::MidiFlowBidirectional, // MIDI Flow - ARRAYSIZE(interfaceDevProperties), + (ULONG)interfaceDeviceProperties.size(), ARRAYSIZE(deviceDevProperties), - (PVOID)interfaceDevProperties, + (PVOID)interfaceDeviceProperties.data(), (PVOID)deviceDevProperties, (PVOID)&createInfo, (LPWSTR)&newDeviceInterfaceId, @@ -352,60 +359,63 @@ CMidi2VirtualMidiEndpointManager::CreateDeviceSideEndpoint( std::wstring mnemonic(TRANSPORT_MNEMONIC); DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; - DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; - BYTE nativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP; - UINT32 supportedDataFormat = (UINT32)MidiDataFormat::MidiDataFormat_UMP; - - - // this purpose is important because it controls how this shows up to clients - auto endpointPurpose = (uint32_t)MidiEndpointDevicePurposePropertyValue::VirtualDeviceResponder; + //DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; std::wstring endpointName = entry.BaseEndpointName + L" (Virtual MIDI Device)"; std::wstring endpointDescription = entry.Description + L" (This endpoint for use only by the device host application.)"; - DEVPROPERTY interfaceDevProperties[] = { - {{PKEY_MIDI_AssociatedUMP, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_EMPTY, 0, nullptr}, - - {{PKEY_MIDI_SupportedDataFormats, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(UINT32)), &supportedDataFormat}, - - // the device side connection is NOT multi-client. Keep it just to the device app - {{PKEY_MIDI_SupportsMulticlient, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropFalse)),& devPropFalse}, - - // device side shouldn't have a metadata handler - {{PKEY_MIDI_EndpointRequiresMetadataHandler, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropFalse)), &devPropFalse}, - - // this is needed for virtual endpoints (client and device) to have a relationship - {{PKEY_MIDI_VirtualMidiEndpointAssociator, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((entry.VirtualEndpointAssociationId.length() + 1) * sizeof(WCHAR)), (PVOID)entry.VirtualEndpointAssociationId.c_str()}, - - - - {{DEVPKEY_DeviceInterface_FriendlyName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((endpointName.length() + 1) * sizeof(WCHAR)), (PVOID)endpointName.c_str()}, - {{PKEY_MIDI_TransportSuppliedEndpointName, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((endpointName.length() + 1) * sizeof(WCHAR)), (PVOID)endpointName.c_str()}, + std::vector interfaceDeviceProperties{}; + + bool requiresMetadataHandler = false; + bool multiClient = false; + bool generateIncomingTimestamps = true; + + // no user or in-protocol data in this case + std::wstring friendlyName = internal::CalculateEndpointDevicePrimaryName(endpointName, L"", L""); + + // all the standard properties we define for endpoints + if (internal::AddStandardEndpointProperties( + interfaceDeviceProperties, + m_TransportAbstractionId, + MidiEndpointDevicePurposePropertyValue::VirtualDeviceResponder, + friendlyName, + mnemonic, + endpointName, + endpointDescription, + L"", + L"", + entry.ShortUniqueId, + MidiDataFormat::MidiDataFormat_UMP, + MIDI_PROP_NATIVEDATAFORMAT_UMP, + multiClient, + requiresMetadataHandler, + generateIncomingTimestamps + )) + { + // all good. Add additional properties + // additional properties for this abstraction - {{PKEY_MIDI_EndpointDevicePurpose, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_UINT32, static_cast(sizeof(endpointPurpose)),(PVOID)&endpointPurpose}, - {{PKEY_MIDI_UserSuppliedDescription, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((endpointDescription.length() + 1) * sizeof(WCHAR)), (PVOID)endpointDescription.c_str() }, - {{PKEY_MIDI_NativeDataFormat, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BYTE, static_cast(sizeof(BYTE)), (PVOID)&nativeDataFormat}, + // we clear this because it's not used for this abstraction. + interfaceDeviceProperties.push_back(internal::BuildEmptyDevProperty(PKEY_MIDI_AssociatedUMP)); - {{PKEY_MIDI_GenerateIncomingTimestamp, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropTrue)), (PVOID)&devPropTrue}, + // this is needed for the loopback endpoints to have a relationship with each other + interfaceDeviceProperties.push_back(internal::BuildWStringDevProperty(PKEY_MIDI_VirtualMidiEndpointAssociator, entry.VirtualEndpointAssociationId)); + } + else + { + // unable to build properties + TraceLoggingWrite( + MidiVirtualMidiAbstractionTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_ERROR), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Unable to build standard endpoint properties list", "message") + ); - {{PKEY_MIDI_AbstractionLayer, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_GUID, static_cast(sizeof(GUID)), (PVOID)&AbstractionLayerGUID }, // essential to instantiate the right endpoint types - {{PKEY_MIDI_TransportMnemonic, DEVPROP_STORE_SYSTEM, nullptr}, - DEVPROP_TYPE_STRING, static_cast((mnemonic.length() + 1) * sizeof(WCHAR)), (PVOID)mnemonic.c_str()}, - }; + return E_FAIL; + } DEVPROPERTY deviceDevProperties[] = { {{DEVPKEY_Device_PresenceNotForDevice, DEVPROP_STORE_SYSTEM, nullptr}, @@ -436,9 +446,9 @@ CMidi2VirtualMidiEndpointManager::CreateDeviceSideEndpoint( (PCWSTR)m_parentDeviceId.c_str(), // parent instance Id true, // UMP-only MidiFlow::MidiFlowBidirectional, // MIDI Flow - ARRAYSIZE(interfaceDevProperties), + (ULONG)interfaceDeviceProperties.size(), ARRAYSIZE(deviceDevProperties), - (PVOID)interfaceDevProperties, + (PVOID)interfaceDeviceProperties.data(), (PVOID)deviceDevProperties, (PVOID)&createInfo, (LPWSTR)&newDeviceInterfaceId, diff --git a/src/api/Abstraction/VirtualMidiAbstraction/pch.h b/src/api/Abstraction/VirtualMidiAbstraction/pch.h index 64a3ef79..14dd5612 100644 --- a/src/api/Abstraction/VirtualMidiAbstraction/pch.h +++ b/src/api/Abstraction/VirtualMidiAbstraction/pch.h @@ -62,12 +62,24 @@ #include "SWDevice.h" #include #include "setupapi.h" -#include "Devpkey.h" +//#include "Devpkey.h" #include "strsafe.h" -#include "string_util.h" +#include "wstring_util.h" + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" #include "json_helpers.h" +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + namespace internal = ::Windows::Devices::Midi2::Internal; #include "abstraction_defs.h" @@ -84,8 +96,6 @@ namespace internal = ::Windows::Devices::Midi2::Internal; #include "dllmain.h" -#include "MidiDefs.h" -#include "MidiXProc.h" #include "swd_shared.h" class CMidi2VirtualMidiEndpointManager; diff --git a/src/api/Abstraction/VirtualPatchBayAbstraction/Midi2.VirtualPatchBayAbstraction.vcxproj b/src/api/Abstraction/VirtualPatchBayAbstraction/Midi2.VirtualPatchBayAbstraction.vcxproj index 0cc61faf..4fb3129a 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.22621.0 + 10.0.20348.0 @@ -96,32 +96,32 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration)\ @@ -141,13 +141,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualPatchBayAbstraction.def @@ -159,13 +159,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualPatchBayAbstraction.def @@ -177,13 +177,13 @@ true - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc Create pch.h stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualPatchBayAbstraction.def @@ -194,12 +194,12 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -220,7 +220,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualPatchBayAbstraction.def @@ -237,7 +237,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualPatchBayAbstraction.def @@ -248,7 +248,7 @@ - %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir) + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(SolutionDir)Libs\AbstractionUtilities\inc @@ -264,7 +264,7 @@ stdcpp17 - %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies) + %(AdditionalDependencies);onecoreuap.lib;avrt.lib;$(CoreLibraryDependencies);AbstractionUtilities.lib Midi2.VirtualPatchBayAbstraction.def diff --git a/src/api/Abstraction/VirtualPatchBayAbstraction/abstraction_defs.h b/src/api/Abstraction/VirtualPatchBayAbstraction/abstraction_defs.h index 4993db7e..b39b9549 100644 --- a/src/api/Abstraction/VirtualPatchBayAbstraction/abstraction_defs.h +++ b/src/api/Abstraction/VirtualPatchBayAbstraction/abstraction_defs.h @@ -16,7 +16,7 @@ // TODO: Names should be moved to .rc for localization #define TRANSPORT_PARENT_ID L"MIDIU_VPB_TRANSPORT" -#define TRANSPORT_PARENT_DEVICE_NAME L"MIDI 2.0 Virtual Patch Bay" +#define TRANSPORT_PARENT_DEVICE_NAME L"MIDI 2.0 Patch Bay" #define LOOPBACK_PARENT_ROOT L"HTREE\\ROOT\\0" diff --git a/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h b/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h index d0d360b1..133b72d9 100644 --- a/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h +++ b/src/api/Abstraction/VirtualPatchBayAbstraction/pch.h @@ -62,7 +62,22 @@ namespace json = ::winrt::Windows::Data::Json; #include "SWDevice.h" #include #include "setupapi.h" -#include "Devpkey.h" +//#include "Devpkey.h" + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" +#include "json_helpers.h" + +#include "MidiDefs.h" +#include "MidiDataFormat.h" +#include "MidiFlow.h" +#include "MidiAbstraction.h" + +#include "MidiXProc.h" + +namespace internal = ::Windows::Devices::Midi2::Internal; #include "strsafe.h" @@ -76,9 +91,6 @@ namespace json = ::winrt::Windows::Data::Json; #include "dllmain.h" -#include "MidiDefs.h" -#include "MidiXProc.h" - #include "MidiRoute.h" #include "MidiEndpointTable.h" 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 6814eb36..f4331c29 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.3-0150 + 1.0.0-preview.3-0155 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/IMidiServiceMessageProcessingPluginConfiguration.idl b/src/api/Client/Midi2Client/IMidiServiceMessageProcessingPluginConfiguration.idl new file mode 100644 index 00000000..ae6afa83 --- /dev/null +++ b/src/api/Client/Midi2Client/IMidiServiceMessageProcessingPluginConfiguration.idl @@ -0,0 +1,30 @@ +// 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)] + [MIDI_INTERFACE_UUID("2ebcfa13-585a-4376-8fe1-635784fa7fd4",1.0)] + interface IMidiServiceMessageProcessingPluginConfiguration + { + // we configure plugins on a single endpoint + String EndpointDeviceId { get; }; + + // The Id for this plugin type. It is per-type only + Guid MessageProcessingPluginId { get; }; + + // The instance Id. A single endpoint may have multiples of the same plugin type (a generic filter, for example) + Guid PluginInstanceId{ get; }; + + // the actual changes to be made + Windows.Data.Json.JsonObject SettingsJson { get; }; + } +} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/IMidiServiceTransportPluginConfiguration.idl b/src/api/Client/Midi2Client/IMidiServiceTransportPluginConfiguration.idl new file mode 100644 index 00000000..d12470e3 --- /dev/null +++ b/src/api/Client/Midi2Client/IMidiServiceTransportPluginConfiguration.idl @@ -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 "midl_defines.h" +MIDI_IDL_IMPORT + +namespace Windows.Devices.Midi2 +{ + [MIDI_API_CONTRACT(1)] + [MIDI_INTERFACE_UUID("b2417dde-ef35-499b-a89b-0a4c32cc699a",1.0)] + interface IMidiServiceTransportPluginConfiguration + { + // the Id for this transport type + Guid TransportId { get; }; + + // the settings json. This will typically contain operations to create/update/delete + // individual endpoints. The format of this is specific to each transport in the service + Windows.Data.Json.JsonObject SettingsJson { get; }; + } +} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiChannelEndpointListener.h b/src/api/Client/Midi2Client/MidiChannelEndpointListener.h index 9220a305..0b38d82b 100644 --- a/src/api/Client/Midi2Client/MidiChannelEndpointListener.h +++ b/src/api/Client/Midi2Client/MidiChannelEndpointListener.h @@ -9,7 +9,6 @@ #pragma once #include "MidiChannelEndpointListener.g.h" -#include "string_util.h" namespace winrt::Windows::Devices::Midi2::implementation { diff --git a/src/api/Client/Midi2Client/MidiGroupEndpointListener.h b/src/api/Client/Midi2Client/MidiGroupEndpointListener.h index 0d46e47c..fc9297b5 100644 --- a/src/api/Client/Midi2Client/MidiGroupEndpointListener.h +++ b/src/api/Client/Midi2Client/MidiGroupEndpointListener.h @@ -9,7 +9,6 @@ #pragma once #include "MidiGroupEndpointListener.g.h" -#include "string_util.h" namespace winrt::Windows::Devices::Midi2::implementation { diff --git a/src/api/Client/Midi2Client/MidiGroupTerminalBlock.cpp b/src/api/Client/Midi2Client/MidiGroupTerminalBlock.cpp index 9544eb89..1e816c4e 100644 --- a/src/api/Client/Midi2Client/MidiGroupTerminalBlock.cpp +++ b/src/api/Client/Midi2Client/MidiGroupTerminalBlock.cpp @@ -123,7 +123,7 @@ namespace winrt::Windows::Devices::Midi2::implementation m_maxDeviceInputBandwidthIn4KBSecondUnits = header->MaxInputBandwidth; m_maxDeviceOutputBandwidthIn4KBSecondUnits = header->MaxOutputBandwidth; - m_name = internal::TrimmedHStringCopy(name); + m_name = winrt::hstring{ internal::TrimmedWStringCopy(name).c_str() }; return true; } diff --git a/src/api/Client/Midi2Client/MidiMessageTypeEndpointListener.h b/src/api/Client/Midi2Client/MidiMessageTypeEndpointListener.h index 8c50be8a..d0e70b46 100644 --- a/src/api/Client/Midi2Client/MidiMessageTypeEndpointListener.h +++ b/src/api/Client/Midi2Client/MidiMessageTypeEndpointListener.h @@ -9,8 +9,6 @@ #pragma once #include "MidiMessageTypeEndpointListener.g.h" -#include "string_util.h" - namespace winrt::Windows::Devices::Midi2::implementation { struct MidiMessageTypeEndpointListener : MidiMessageTypeEndpointListenerT diff --git a/src/api/Client/Midi2Client/MidiService.cpp b/src/api/Client/Midi2Client/MidiService.cpp index ca403082..8841e918 100644 --- a/src/api/Client/Midi2Client/MidiService.cpp +++ b/src/api/Client/Midi2Client/MidiService.cpp @@ -20,8 +20,10 @@ 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"); + auto responseSummary = winrt::make_self(); if (responseSummary == nullptr) @@ -96,7 +98,7 @@ namespace winrt::Windows::Devices::Midi2::implementation // ensure this is a ping message, just in case if (word0 == INTERNAL_PING_RESPONSE_UMP_WORD0 && word1 == pingSourceId) - { + { if (word2 < pings.size()) { // word2 is our ping index @@ -127,11 +129,14 @@ namespace winrt::Windows::Devices::Midi2::implementation // open the endpoint. We've already set options for it not to send out discovery messages if (!endpoint.Open()) { + internal::LogGeneralError(__FUNCTION__, L"Could not open ping endpoint."); + responseSummary->InternalSetFailed(L"Endpoint open failed. The service may be unavailable."); endpoint.MessageReceived(eventRevokeToken); session.DisconnectEndpointConnection(endpoint.ConnectionId()); + return *responseSummary; } @@ -149,7 +154,7 @@ namespace winrt::Windows::Devices::Midi2::implementation // granted that this adds a few ticks to add this to the collection and build the object response->InternalSetSendInfo(pingSourceId, pingIndex, timestamp); - + // // TODO: Should this use copy_from? pings[pingIndex] = response; @@ -164,6 +169,7 @@ namespace winrt::Windows::Devices::Midi2::implementation if (!allMessagesReceived.wait(timeoutMilliseconds)) { responseSummary->InternalSetFailed(L"Not all ping responses received within appropriate time window."); + internal::LogGeneralError(__FUNCTION__, L"Not all ping responses received within appropriate time window."); } else { @@ -198,7 +204,7 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - midi2::MidiServicePingResponseSummary MidiService::PingService(uint8_t const pingCount) noexcept + midi2::MidiServicePingResponseSummary MidiService::PingService(uint8_t const pingCount) noexcept { return PingService(pingCount, pingCount * 20 + 1000); } @@ -225,9 +231,9 @@ namespace winrt::Windows::Devices::Midi2::implementation return winrt::single_threaded_vector().GetView(); } - foundation::Collections::IVectorView MidiService::GetActiveSessions() noexcept + foundation::Collections::IVectorView MidiService::GetActiveSessions() noexcept { - auto sessionList = winrt::single_threaded_vector(); + auto sessionList = winrt::single_threaded_vector(); try { @@ -265,10 +271,10 @@ 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(); - // auto startTimeString = internal::JsonGetWStringProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_TIME_PROPERTY_KEY, L"").c_str(); - auto startTime = internal::JsonGetDateTimeProperty(sessionJson, MIDI_SESSION_TRACKER_JSON_RESULT_SESSION_TIME_PROPERTY_KEY, noTime); sessionObject->InternalInitialize( @@ -289,7 +295,7 @@ namespace winrt::Windows::Devices::Midi2::implementation 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); @@ -320,12 +326,289 @@ namespace winrt::Windows::Devices::Midi2::implementation } _Use_decl_annotations_ - json::JsonObject MidiService::UpdateRuntimeConfiguration(json::JsonObject configurationUpdate) noexcept + midi2::MidiServiceLoopbackEndpointCreationResult MidiService::CreateTemporaryLoopbackEndpoints( + winrt::guid const& associationId, + midi2::MidiServiceLoopbackEndpointDefinition const& endpointDefinitionA, + midi2::MidiServiceLoopbackEndpointDefinition const& endpointDefinitionB) noexcept + { + internal::LogInfo(__FUNCTION__, L"Enter"); + + // the success code in this defaults to False + auto result = winrt::make_self(); + + // todo: grab this from a constant + winrt::hstring loopbackDeviceAbstractionId = L"{942BF02D-93C0-4EA8-B03E-D51156CA75E1}"; + + + json::JsonObject wrapperObject; + json::JsonObject topLevelTransportPluginSettingsObject; + json::JsonObject abstractionObject; + json::JsonObject endpointCreationObject; + + json::JsonObject endpointAssociationObject; + json::JsonObject endpointDeviceAObject; + json::JsonObject endpointDeviceBObject; + + internal::LogInfo(__FUNCTION__, L" setting json properties"); + + // "endpointTransportPluginSettings": + // { + // endpoint abstraction guid : + // { + // "create" + // { + // associationGuid: + // { + // "endpointA": + // { + // ... endpoint properties ... + // }, + // "endpointB": + // { + // ... endpoint properties ... + // } + // } + // } + // } + // } + + // build Endpoint A + + internal::JsonGetWStringProperty( + endpointDeviceAObject, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, + endpointDefinitionA.Name().c_str()); + + internal::JsonGetWStringProperty( + endpointDeviceAObject, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, + endpointDefinitionA.Description().c_str()); + + internal::JsonGetWStringProperty( + endpointDeviceAObject, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, + endpointDefinitionA.UniqueId().c_str()); + + // build Endpoint B + + internal::JsonGetWStringProperty( + endpointDeviceBObject, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, + endpointDefinitionB.Name().c_str()); + + internal::JsonGetWStringProperty( + endpointDeviceBObject, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, + endpointDefinitionB.Description().c_str()); + + internal::JsonGetWStringProperty( + endpointDeviceBObject, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, + endpointDefinitionB.UniqueId().c_str()); + + // create the association object with the two devices as children + + internal::JsonSetObjectProperty( + endpointAssociationObject, + MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_ENDPOINT_A_KEY, + endpointDeviceAObject); + + internal::JsonSetObjectProperty( + endpointAssociationObject, + 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, + internal::GuidToString(associationId), + endpointAssociationObject); + + // create the abstraction object with the child creation node + + internal::JsonSetObjectProperty( + abstractionObject, + MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICES_CREATE_KEY, + endpointCreationObject); + + // create the main node + + internal::JsonSetObjectProperty( + topLevelTransportPluginSettingsObject, + loopbackDeviceAbstractionId.c_str(), + abstractionObject); + + + // wrap it all up so the json is valid + + internal::JsonSetObjectProperty( + wrapperObject, + MIDI_CONFIG_JSON_TRANSPORT_PLUGIN_SETTINGS_OBJECT, + topLevelTransportPluginSettingsObject); + + // send it up + + + auto iid = __uuidof(IMidiAbstractionConfigurationManager); + winrt::com_ptr configManager; + + auto serviceAbstraction = winrt::create_instance(__uuidof(Midi2MidiSrvAbstraction), CLSCTX_ALL); + + if (serviceAbstraction) + { + auto activateConfigManagerResult = serviceAbstraction->Activate(iid, (void**)&configManager); + + internal::LogInfo(__FUNCTION__, L"config manager activate call completed"); + + + if (FAILED(activateConfigManagerResult) || configManager == nullptr) + { + internal::LogGeneralError(__FUNCTION__, L"Failed to create device. Config manager is null or call failed."); + + // return a fail result + return *result; + } + + internal::LogInfo(__FUNCTION__, L"config manager activate call SUCCESS"); + + auto initializeResult = configManager->Initialize(internal::StringToGuid(loopbackDeviceAbstractionId.c_str()), nullptr); + + + if (FAILED(initializeResult)) + { + internal::LogGeneralError(__FUNCTION__, L"failed to initialize config manager"); + + // return a fail result + return *result; + } + + CComBSTR response{}; + response.Empty(); + + auto jsonPayload = wrapperObject.Stringify(); + + internal::LogInfo(__FUNCTION__, jsonPayload.c_str()); + auto configUpdateResult = configManager->UpdateConfiguration(jsonPayload.c_str(), false, &response); + + if (FAILED(configUpdateResult)) + { + internal::LogGeneralError(__FUNCTION__, L"Failed to configure endpoint"); + + // return a failed result + return *result; + } + + internal::LogInfo(__FUNCTION__, L"configManager->UpdateConfiguration success"); + + json::JsonObject responseObject; + + if (!internal::JsonObjectFromBSTR(&response, responseObject)) + { + internal::LogGeneralError(__FUNCTION__, L"Failed to read json response object from loopback device creation"); + + // return a failed result + return *result; + } + + internal::LogInfo(__FUNCTION__, L"JsonObjectFromBSTR success"); + + + + + // check for actual success + auto successResult = internal::JsonGetBoolProperty(responseObject, MIDI_CONFIG_JSON_ENDPOINT_LOOPBACK_DEVICE_RESPONSE_SUCCESS_PROPERTY_KEY, false); + + if (successResult) + { + internal::LogInfo(__FUNCTION__, L"JSON payload indicates success"); + + + // TODO: A and B are simple properties here. We don't need + // an array because we create one at a time through the API. And when + // created through the config file, there's no response object to + // worry about. + + 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""); + + if (deviceIdA.empty()) + { + internal::LogGeneralError(__FUNCTION__, L"Unexpected empty Device Id A"); + + return *result; + } + + if (deviceIdB.empty()) + { + internal::LogGeneralError(__FUNCTION__, L"Unexpected empty Device Id B"); + + return *result; + } + + + // update the response object with the new ids + + result->SetSuccess(associationId, deviceIdA.c_str(), deviceIdB.c_str()); + } + else + { + internal::LogGeneralError(__FUNCTION__, L"Loopback device creation failed (payload has false success value)"); + + return nullptr; + } + + internal::LogInfo(__FUNCTION__, L"Loopback device creation worked."); + + } + else + { + // failed + internal::LogGeneralError(__FUNCTION__, L"Failed to create service abstraction"); + + } + + return *result; + } + + _Use_decl_annotations_ + bool MidiService::RemoveTemporaryLoopbackEndpoints(_In_ winrt::guid const& associationId) noexcept + { + internal::LogInfo(__FUNCTION__, L"Enter"); + + UNREFERENCED_PARAMETER(associationId); + // TODO: + + return false; + } + + _Use_decl_annotations_ + midi2::MidiServiceConfigurationResponse MidiService::UpdateTransportPluginConfiguration( + midi2::IMidiServiceTransportPluginConfiguration const& configurationUpdate) noexcept + { + internal::LogInfo(__FUNCTION__, L"Enter"); + + UNREFERENCED_PARAMETER(configurationUpdate); + // TODO: + + auto response = winrt::make_self(); + + return *response; + + } + + _Use_decl_annotations_ + midi2::MidiServiceConfigurationResponse MidiService::UpdateProcessingPluginConfiguration( + midi2::IMidiServiceMessageProcessingPluginConfiguration const& configurationUpdate) noexcept { - // TEMP! + internal::LogInfo(__FUNCTION__, L"Enter"); + + UNREFERENCED_PARAMETER(configurationUpdate); + // TODO: - return json::JsonObject{}; + auto response = winrt::make_self(); + return *response; } diff --git a/src/api/Client/Midi2Client/MidiService.h b/src/api/Client/Midi2Client/MidiService.h index e4e31158..90682a1f 100644 --- a/src/api/Client/Midi2Client/MidiService.h +++ b/src/api/Client/Midi2Client/MidiService.h @@ -29,9 +29,21 @@ namespace winrt::Windows::Devices::Midi2::implementation // static uint32_t GetOutgoingMessageQueueMaxMessageCapacity() noexcept { return (uint32_t)MIDI_OUTGOING_MESSAGE_QUEUE_MAX_MESSAGE_COUNT; } - static foundation::Collections::IVectorView GetActiveSessions() noexcept; + 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 UpdateRuntimeConfiguration(_In_ json::JsonObject configurationUpdate) noexcept; private: diff --git a/src/api/Client/Midi2Client/MidiService.idl b/src/api/Client/Midi2Client/MidiService.idl index f7c708ed..1a4d21ca 100644 --- a/src/api/Client/Midi2Client/MidiService.idl +++ b/src/api/Client/Midi2Client/MidiService.idl @@ -13,7 +13,14 @@ import "MidiServiceTransportPluginInformation.idl"; import "MidiServiceMessageProcessingPluginInformation.idl"; import "MidiServicePingResponseSummary.idl"; -import "MidiSessionInformation.idl"; +import "MidiServiceSessionInformation.idl"; + +import "MidiServiceLoopbackEndpointCreationResult.idl"; +import "MidiServiceLoopbackEndpointDefinition.idl"; + +import "IMidiServiceTransportPluginConfiguration.idl"; +import "IMidiServiceMessageProcessingPluginConfiguration.idl"; +import "MidiServiceConfigurationResponse.idl"; namespace Windows.Devices.Midi2 { @@ -37,10 +44,33 @@ namespace Windows.Devices.Midi2 // static UInt32 GetOutgoingMessageQueueMaxMessageCapacity(); - static IVectorView GetActiveSessions(); + static IVectorView GetActiveSessions(); + + + // creates loopback endpoints that live for only as long as the service is running. + // Permanent endpoints need to be created by the user through the settings application + // so they get written to the configuration file and loaded when the service is loaded + // We special-case loopbacks here just like we special-case Virtual Devices in the + // session class, because they are very common to use and have special creation semantics. + static MidiServiceLoopbackEndpointCreationResult CreateTemporaryLoopbackEndpoints( + Guid associationId, + MidiServiceLoopbackEndpointDefinition endpointDefinitionA, + MidiServiceLoopbackEndpointDefinition endpointDefinitionB); + + static Boolean RemoveTemporaryLoopbackEndpoints(Guid associationId); + + // used for CRUD operations for certain endpoints (Transports). Create a component which calls this and + // provides strongly typed parameters specific to your transport. In general, applications should not be + // using this function directly. Instead, they should use a configuration component associated with the plugin. + static MidiServiceConfigurationResponse UpdateTransportPluginConfiguration( + IMidiServiceTransportPluginConfiguration configurationUpdate); - static Windows.Data.Json.JsonObject UpdateRuntimeConfiguration(Windows.Data.Json.JsonObject configurationUpdate); + // used for CRUD operations for certain endpoint message processing plugins (Transforms). Create a component which calls this and + // provides strongly typed parameters specific to your transport In general, applications should not be + // using this function directly. Instead, they should use a configuration component associated with the plugin. + static MidiServiceConfigurationResponse UpdateProcessingPluginConfiguration( + IMidiServiceMessageProcessingPluginConfiguration configurationUpdate); } } diff --git a/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.cpp b/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.cpp new file mode 100644 index 00000000..8b669734 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.cpp @@ -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 "pch.h" +#include "MidiServiceConfigurationResponse.h" +#include "MidiServiceConfigurationResponse.g.cpp" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + winrt::Windows::Devices::Midi2::MidiServiceConfigurationResponseStatus MidiServiceConfigurationResponse::Status() + { + throw hresult_not_implemented(); + } + hstring MidiServiceConfigurationResponse::ResponseJson() + { + throw hresult_not_implemented(); + } +} diff --git a/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.h b/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.h new file mode 100644 index 00000000..1af3ce7e --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.h @@ -0,0 +1,21 @@ +// 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 "MidiServiceConfigurationResponse.g.h" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiServiceConfigurationResponse : MidiServiceConfigurationResponseT + { + MidiServiceConfigurationResponse() = default; + + winrt::Windows::Devices::Midi2::MidiServiceConfigurationResponseStatus Status(); + hstring ResponseJson(); + }; +} diff --git a/src/api/Client/Midi2Client/IMidiTransportSettingsData.idl b/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.idl similarity index 70% rename from src/api/Client/Midi2Client/IMidiTransportSettingsData.idl rename to src/api/Client/Midi2Client/MidiServiceConfigurationResponse.idl index a19df44c..3e194ce1 100644 --- a/src/api/Client/Midi2Client/IMidiTransportSettingsData.idl +++ b/src/api/Client/Midi2Client/MidiServiceConfigurationResponse.idl @@ -9,12 +9,16 @@ #include "midl_defines.h" MIDI_IDL_IMPORT +import "MidiServiceConfigurationResponseStatusEnum.idl"; + namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] - [MIDI_INTERFACE_UUID("b2417dde-ef35-499b-a89b-0a4c32cc699a",1.0)] - interface IMidiTransportSettingsData + [default_interface] + runtimeclass MidiServiceConfigurationResponse { - String SettingsJson { get; set; }; + MidiServiceConfigurationResponseStatus Status { get; }; + + String ResponseJson { get; }; } } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiServiceConfigurationResponseStatusEnum.idl b/src/api/Client/Midi2Client/MidiServiceConfigurationResponseStatusEnum.idl new file mode 100644 index 00000000..02503eb0 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceConfigurationResponseStatusEnum.idl @@ -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/ +// ============================================================================ + +#include "midl_defines.h" +MIDI_IDL_IMPORT + +namespace Windows.Devices.Midi2 +{ + // NOTE: the values are different for function blocks and group terminal + // blocks, so we have to different enumerations + + [MIDI_API_CONTRACT(1)] + enum MidiServiceConfigurationResponseStatus + { + Success = 0, + + ErrorTargetNotFound = 404, + + ErrorJsonNullOrEmpty = 600, + ErrorProcessingJson = 601, + + ErrorNotImplemented = 2600, + + ErrorOther = 9999, + }; +} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.cpp b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.cpp new file mode 100644 index 00000000..73e2adfb --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.cpp @@ -0,0 +1,17 @@ +// 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 "MidiServiceLoopbackEndpointCreationResult.h" +#include "MidiServiceLoopbackEndpointCreationResult.g.cpp" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + +} diff --git a/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.h b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.h new file mode 100644 index 00000000..31f610e7 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.h @@ -0,0 +1,46 @@ +// 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 "MidiServiceLoopbackEndpointCreationResult.g.h" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiServiceLoopbackEndpointCreationResult : MidiServiceLoopbackEndpointCreationResultT + { + MidiServiceLoopbackEndpointCreationResult() = default; + + bool Success() const { return m_success; } + + winrt::guid AssociationId() const { return m_associationId; } + winrt::hstring EndpointDeviceIdA() const { return m_endpointDeviceIdA; } + winrt::hstring EndpointDeviceIdB() const { return m_endpointDeviceIdB; } + + + void SetSuccess( + _In_ winrt::guid associationId, + _In_ winrt::hstring endpointDeviceIdA, + _In_ winrt::hstring endpointDeviceIdB + ) + { + m_success = true; + m_associationId = associationId; + m_endpointDeviceIdA = endpointDeviceIdA; + m_endpointDeviceIdB = endpointDeviceIdB; + } + + private: + bool m_success{ false }; + winrt::guid m_associationId{}; + winrt::hstring m_endpointDeviceIdA{}; + winrt::hstring m_endpointDeviceIdB{}; + + + + }; +} diff --git a/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.idl b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.idl new file mode 100644 index 00000000..5e9e9955 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointCreationResult.idl @@ -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 "midl_defines.h" +MIDI_IDL_IMPORT + +namespace Windows.Devices.Midi2 +{ + [MIDI_API_CONTRACT(1)] + [default_interface] + runtimeclass MidiServiceLoopbackEndpointCreationResult + { + Boolean Success{ get; }; + + Guid AssociationId{ get; }; + + String EndpointDeviceIdA { get; }; + String EndpointDeviceIdB{ get; }; + } +} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.cpp b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.cpp new file mode 100644 index 00000000..960a13c8 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.cpp @@ -0,0 +1,16 @@ +// 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 "MidiServiceLoopbackEndpointDefinition.h" +#include "MidiServiceLoopbackEndpointDefinition.g.cpp" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + +} diff --git a/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.h b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.h new file mode 100644 index 00000000..0de434ea --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.h @@ -0,0 +1,38 @@ +// 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 "MidiServiceLoopbackEndpointDefinition.g.h" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiServiceLoopbackEndpointDefinition : MidiServiceLoopbackEndpointDefinitionT + { + MidiServiceLoopbackEndpointDefinition() = default; + + winrt::hstring Name() const { return m_name; } + void Name(winrt::hstring const& value) { m_name = internal::TrimmedHStringCopy(value); } + + winrt::hstring UniqueId() const { return m_uniqueId; } + void UniqueId(winrt::hstring const& value) { m_uniqueId = internal::TrimmedHStringCopy(value); } + + winrt::hstring Description() const { return m_description; } + void Description(winrt::hstring const& value) { m_description = internal::TrimmedHStringCopy(value); } + + private: + winrt::hstring m_name{}; + winrt::hstring m_uniqueId{}; + winrt::hstring m_description{}; + }; +} +namespace winrt::Windows::Devices::Midi2::factory_implementation +{ + struct MidiServiceLoopbackEndpointDefinition : MidiServiceLoopbackEndpointDefinitionT + { + }; +} diff --git a/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.idl b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.idl new file mode 100644 index 00000000..9c5c39b2 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceLoopbackEndpointDefinition.idl @@ -0,0 +1,24 @@ +// 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 MidiServiceLoopbackEndpointDefinition + { + MidiServiceLoopbackEndpointDefinition(); + + String Name{ get; set; }; + String UniqueId{ get; set; }; + String Description{ get; set; }; + } +} \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.cpp b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.cpp new file mode 100644 index 00000000..89a9f5de --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.cpp @@ -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/ +// ============================================================================ + +#include "pch.h" +#include "MidiServiceSessionConnectionInformation.h" +#include "MidiServiceSessionConnectionInformation.g.cpp" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + + _Use_decl_annotations_ + void MidiServiceSessionConnectionInformation::InternalInitialize( + winrt::hstring const endpointDeviceId, + uint16_t const instanceCount, + foundation::DateTime const earliestConnectionTime + ) + { + m_endpointDeviceId = internal::NormalizeEndpointInterfaceIdHStringCopy(endpointDeviceId); + m_instanceCount = instanceCount; + m_earliestConnectionTime = earliestConnectionTime; + } + + + +} diff --git a/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.h b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.h new file mode 100644 index 00000000..cea19387 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.h @@ -0,0 +1,34 @@ +// 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 "MidiServiceSessionConnectionInformation.g.h" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiServiceSessionConnectionInformation : MidiServiceSessionConnectionInformationT + { + MidiServiceSessionConnectionInformation() = default; + + winrt::hstring EndpointDeviceId() { return m_endpointDeviceId; } + uint16_t InstanceCount() { return m_instanceCount; } + foundation::DateTime EarliestConnectionTime() { return m_earliestConnectionTime; } + + void InternalInitialize( + _In_ winrt::hstring const endpointDeviceId, + _In_ uint16_t const instanceCount, + _In_ foundation::DateTime const earliestConnectionTime + ); + + private: + winrt::hstring m_endpointDeviceId{}; + uint16_t m_instanceCount{}; + foundation::DateTime m_earliestConnectionTime{}; + }; +} diff --git a/src/api/Client/Midi2Client/MidiSessionConnectionInformation.idl b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.idl similarity index 92% rename from src/api/Client/Midi2Client/MidiSessionConnectionInformation.idl rename to src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.idl index 0323f004..38370c90 100644 --- a/src/api/Client/Midi2Client/MidiSessionConnectionInformation.idl +++ b/src/api/Client/Midi2Client/MidiServiceSessionConnectionInformation.idl @@ -13,7 +13,7 @@ namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiSessionConnectionInformation + runtimeclass MidiServiceSessionConnectionInformation { String EndpointDeviceId{ get; }; diff --git a/src/api/Client/Midi2Client/MidiServiceSessionInformation.cpp b/src/api/Client/Midi2Client/MidiServiceSessionInformation.cpp new file mode 100644 index 00000000..7577ee30 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceSessionInformation.cpp @@ -0,0 +1,38 @@ +// 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 "MidiServiceSessionInformation.h" +#include "MidiServiceSessionInformation.g.cpp" + +namespace winrt::Windows::Devices::Midi2::implementation +{ + _Use_decl_annotations_ + void MidiServiceSessionInformation::InternalInitialize( + winrt::guid sessionId, + winrt::hstring sessionName, + uint64_t processId, + winrt::hstring processName, + foundation::DateTime startTime) + { + m_sessionId = sessionId; + m_processId = processId; + m_processName = processName; + m_sessionName = sessionName; + m_startTime = startTime; + } + + _Use_decl_annotations_ + void MidiServiceSessionInformation::InternalAddConnection( + midi2::MidiServiceSessionConnectionInformation const& info + ) + { + m_connections.Append(info); + } + +} diff --git a/src/api/Client/Midi2Client/MidiServiceSessionInformation.h b/src/api/Client/Midi2Client/MidiServiceSessionInformation.h new file mode 100644 index 00000000..f50c8601 --- /dev/null +++ b/src/api/Client/Midi2Client/MidiServiceSessionInformation.h @@ -0,0 +1,51 @@ +// 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 "MidiServiceSessionInformation.g.h" + + +namespace winrt::Windows::Devices::Midi2::implementation +{ + struct MidiServiceSessionInformation : MidiServiceSessionInformationT + { + MidiServiceSessionInformation() = default; + + winrt::guid SessionId() { return m_sessionId; } + uint64_t ProcessId() { return m_processId; } + winrt::hstring ProcessName() { return m_processName; } + winrt::hstring SessionName() { return m_sessionName; } + foundation::DateTime StartTime() { return m_startTime; } + + collections::IVectorView Connections() { return m_connections.GetView(); } + + void InternalInitialize( + _In_ winrt::guid sessionId, + _In_ winrt::hstring sessionName, + _In_ uint64_t processId, + _In_ winrt::hstring processName, + _In_ foundation::DateTime startTime + ); + + void InternalAddConnection( + _In_ midi2::MidiServiceSessionConnectionInformation const& info + ); + + private: + winrt::guid m_sessionId{}; + uint64_t m_processId{}; + winrt::hstring m_processName{}; + winrt::hstring m_sessionName{}; + foundation::DateTime m_startTime{}; + + foundation::Collections::IVector + m_connections{ winrt::single_threaded_vector() }; + + + }; +} diff --git a/src/api/Client/Midi2Client/MidiSessionInformation.idl b/src/api/Client/Midi2Client/MidiServiceSessionInformation.idl similarity index 80% rename from src/api/Client/Midi2Client/MidiSessionInformation.idl rename to src/api/Client/Midi2Client/MidiServiceSessionInformation.idl index 47086628..efee151c 100644 --- a/src/api/Client/Midi2Client/MidiSessionInformation.idl +++ b/src/api/Client/Midi2Client/MidiServiceSessionInformation.idl @@ -9,13 +9,13 @@ #include "midl_defines.h" MIDI_IDL_IMPORT -import "MidiSessionConnectionInformation.idl"; +import "MidiServiceSessionConnectionInformation.idl"; namespace Windows.Devices.Midi2 { [MIDI_API_CONTRACT(1)] [default_interface] - runtimeclass MidiSessionInformation + runtimeclass MidiServiceSessionInformation { Guid SessionId{ get; }; @@ -26,6 +26,6 @@ namespace Windows.Devices.Midi2 Windows.Foundation.DateTime StartTime{ get; }; - IVectorView Connections{ get; }; + IVectorView Connections{ get; }; } } \ No newline at end of file diff --git a/src/api/Client/Midi2Client/MidiSession.cpp b/src/api/Client/Midi2Client/MidiSession.cpp index d0bbc266..99340b71 100644 --- a/src/api/Client/Midi2Client/MidiSession.cpp +++ b/src/api/Client/Midi2Client/MidiSession.cpp @@ -12,7 +12,6 @@ #include "MidiEndpointConnection.h" -#include "string_util.h" #include #include @@ -235,7 +234,7 @@ namespace winrt::Windows::Devices::Midi2::implementation internal::JsonSetWStringProperty( endpointDefinitionObject, - MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_UNIQUE_ID_PROPERTY_KEY, + MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, deviceDefinition.EndpointProductInstanceId().c_str()); internal::JsonSetWStringProperty( @@ -328,7 +327,7 @@ namespace winrt::Windows::Devices::Midi2::implementation internal::LogInfo(__FUNCTION__, L"sending json"); internal::LogInfo(__FUNCTION__, topLevelTransportPluginSettingsObject.Stringify().c_str()); - auto configUpdateResult = configManager->UpdateConfiguration(topLevelTransportPluginSettingsObject.Stringify().c_str(), &response); + auto configUpdateResult = configManager->UpdateConfiguration(topLevelTransportPluginSettingsObject.Stringify().c_str(), false, &response); internal::LogInfo(__FUNCTION__, L"UpdateConfiguration returned"); diff --git a/src/api/Client/Midi2Client/MidiSessionConnectionInformation.cpp b/src/api/Client/Midi2Client/MidiSessionConnectionInformation.cpp deleted file mode 100644 index cb5f95b0..00000000 --- a/src/api/Client/Midi2Client/MidiSessionConnectionInformation.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "pch.h" -#include "MidiSessionConnectionInformation.h" -#include "MidiSessionConnectionInformation.g.cpp" - - -namespace winrt::Windows::Devices::Midi2::implementation -{ - - _Use_decl_annotations_ - void MidiSessionConnectionInformation::InternalInitialize( - winrt::hstring const endpointDeviceId, - uint16_t const instanceCount, - foundation::DateTime const earliestConnectionTime - ) - { - m_endpointDeviceId = internal::NormalizeEndpointInterfaceIdHStringCopy(endpointDeviceId); - m_instanceCount = instanceCount; - m_earliestConnectionTime = earliestConnectionTime; - } - - - -} diff --git a/src/api/Client/Midi2Client/MidiSessionConnectionInformation.h b/src/api/Client/Midi2Client/MidiSessionConnectionInformation.h deleted file mode 100644 index 2caf0995..00000000 --- a/src/api/Client/Midi2Client/MidiSessionConnectionInformation.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "MidiSessionConnectionInformation.g.h" - - -namespace winrt::Windows::Devices::Midi2::implementation -{ - struct MidiSessionConnectionInformation : MidiSessionConnectionInformationT - { - MidiSessionConnectionInformation() = default; - - winrt::hstring EndpointDeviceId() { return m_endpointDeviceId; } - uint16_t InstanceCount() { return m_instanceCount; } - foundation::DateTime EarliestConnectionTime() { return m_earliestConnectionTime; } - - void InternalInitialize( - _In_ winrt::hstring const endpointDeviceId, - _In_ uint16_t const instanceCount, - _In_ foundation::DateTime const earliestConnectionTime - ); - - private: - winrt::hstring m_endpointDeviceId{}; - uint16_t m_instanceCount{}; - foundation::DateTime m_earliestConnectionTime{}; - }; -} diff --git a/src/api/Client/Midi2Client/MidiSessionInformation.cpp b/src/api/Client/Midi2Client/MidiSessionInformation.cpp deleted file mode 100644 index ab5d8e2d..00000000 --- a/src/api/Client/Midi2Client/MidiSessionInformation.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "pch.h" -#include "MidiSessionInformation.h" -#include "MidiSessionInformation.g.cpp" - -namespace winrt::Windows::Devices::Midi2::implementation -{ - _Use_decl_annotations_ - void MidiSessionInformation::InternalInitialize( - winrt::guid sessionId, - winrt::hstring sessionName, - uint64_t processId, - winrt::hstring processName, - foundation::DateTime startTime) - { - m_sessionId = sessionId; - m_processId = processId; - m_processName = processName; - m_sessionName = sessionName; - m_startTime = startTime; - } - - _Use_decl_annotations_ - void MidiSessionInformation::InternalAddConnection( - midi2::MidiSessionConnectionInformation const& info - ) - { - m_connections.Append(info); - } - -} diff --git a/src/api/Client/Midi2Client/MidiSessionInformation.h b/src/api/Client/Midi2Client/MidiSessionInformation.h deleted file mode 100644 index d598c5d9..00000000 --- a/src/api/Client/Midi2Client/MidiSessionInformation.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once -#include "MidiSessionInformation.g.h" - - -namespace winrt::Windows::Devices::Midi2::implementation -{ - struct MidiSessionInformation : MidiSessionInformationT - { - MidiSessionInformation() = default; - - winrt::guid SessionId() { return m_sessionId; } - uint64_t ProcessId() { return m_processId; } - winrt::hstring ProcessName() { return m_processName; } - winrt::hstring SessionName() { return m_sessionName; } - foundation::DateTime StartTime() { return m_startTime; } - - collections::IVectorView Connections() { return m_connections.GetView(); } - - void InternalInitialize( - _In_ winrt::guid sessionId, - _In_ winrt::hstring sessionName, - _In_ uint64_t processId, - _In_ winrt::hstring processName, - _In_ foundation::DateTime startTime - ); - - void InternalAddConnection( - _In_ midi2::MidiSessionConnectionInformation const& info - ); - - private: - winrt::guid m_sessionId{}; - uint64_t m_processId{}; - winrt::hstring m_processName{}; - winrt::hstring m_sessionName{}; - foundation::DateTime m_startTime{}; - - foundation::Collections::IVector - m_connections{ winrt::single_threaded_vector() }; - - - }; -} diff --git a/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.h b/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.h index 62e1e14d..07dca31e 100644 --- a/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.h +++ b/src/api/Client/Midi2Client/MidiVirtualEndpointDevice.h @@ -10,9 +10,6 @@ #pragma once #include "MidiVirtualEndpointDevice.g.h" -#include "string_util.h" - - namespace winrt::Windows::Devices::Midi2::implementation { struct MidiVirtualEndpointDevice : MidiVirtualEndpointDeviceT diff --git a/src/api/Client/Midi2Client/WinRTActivationEntries.txt b/src/api/Client/Midi2Client/WinRTActivationEntries.txt index 03f184d4..92add49a 100644 --- a/src/api/Client/Midi2Client/WinRTActivationEntries.txt +++ b/src/api/Client/Midi2Client/WinRTActivationEntries.txt @@ -77,6 +77,7 @@ Windows.Devices.Midi2.IMidiEndpointConnectionStatics | 0 | 0 | 0 Windows.Devices.Midi2.MidiService | 0 | 0 | 0 Windows.Devices.Midi2.IMidiServiceStatics | 0 | 0 | 0 +Windows.Devices.Midi2.MidiServiceLoopbackEndpointDefinition | 0 | 0 | 0 # Clock diff --git a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj index f5c0d2aa..f4bc170a 100644 --- a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj +++ b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj @@ -100,45 +100,51 @@ Windows.Devices.Midi2 true $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ + $(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(LibraryPath) $(IncludePath) Windows.Devices.Midi2 $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ + $(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(LibraryPath) $(IncludePath) Windows.Devices.Midi2 true $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ + $(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(LibraryPath) $(IncludePath) Windows.Devices.Midi2 $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ + $(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(LibraryPath) $(IncludePath) Windows.Devices.Midi2 true $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ + $(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(LibraryPath) $(IncludePath) Windows.Devices.Midi2 $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\intermediate\$(MSBuildProjectName)\$(Platform)\$(Configuration)\GeneratedFiles\ + $(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration);$(LibraryPath) @@ -159,28 +165,31 @@ _DEBUG;%(PreprocessorDefinitions);WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP - stdcpp20 + stdcpp17 false true true true - $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories) - $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories) - $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories) - stdcpp20 - stdcpp20 + $(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 false false + AbstractionUtilities.lib;%(AdditionalDependencies) false false + AbstractionUtilities.lib;%(AdditionalDependencies) false false + AbstractionUtilities.lib;%(AdditionalDependencies) @@ -207,15 +216,15 @@ NDEBUG;%(PreprocessorDefinitions);WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP - $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories) - $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);%(AdditionalIncludeDirectories) - $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);%(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) + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;%(AdditionalIncludeDirectories) true true true - stdcpp20 - stdcpp20 - stdcpp20 + stdcpp17 + stdcpp17 + stdcpp17 true @@ -223,6 +232,9 @@ false false false + AbstractionUtilities.lib;%(AdditionalDependencies) + AbstractionUtilities.lib;%(AdditionalDependencies) + AbstractionUtilities.lib;%(AdditionalDependencies) @@ -269,6 +281,15 @@ MidiMessageConverter.idl + + MidiServiceConfigurationResponse.idl + + + MidiServiceLoopbackEndpointCreationResult.idl + + + MidiServiceLoopbackEndpointDefinition.idl + MidiServiceMessageProcessingPluginInformation.idl @@ -308,11 +329,11 @@ MidiMessageTypeEndpointListener.idl - - MidiSessionConnectionInformation.idl + + MidiServiceSessionConnectionInformation.idl - - MidiSessionInformation.idl + + MidiServiceSessionInformation.idl MidiSessionSettings.idl @@ -385,6 +406,15 @@ MidiMessageConverter.idl + + MidiServiceConfigurationResponse.idl + + + MidiServiceLoopbackEndpointCreationResult.idl + + + MidiServiceLoopbackEndpointDefinition.idl + MidiServiceMessageProcessingPluginInformation.idl @@ -424,11 +454,11 @@ MidiMessageTypeEndpointListener.idl - - MidiSessionConnectionInformation.idl + + MidiServiceSessionConnectionInformation.idl - - MidiSessionInformation.idl + + MidiServiceSessionInformation.idl MidiSessionSettings.idl @@ -479,8 +509,10 @@ + - + + @@ -506,6 +538,9 @@ + + + @@ -519,8 +554,8 @@ - - + + diff --git a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters index 5751984b..e22feb3b 100644 --- a/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters +++ b/src/api/Client/Midi2Client/Windows.Devices.Midi2.vcxproj.filters @@ -82,6 +82,18 @@ {6427be3d-78fd-4fff-9bf4-2353b462bfc3} + + {f47089c0-b3df-4af8-93e8-35731024db07} + + + {7610a401-8f83-470c-9ccc-6761e3759eab} + + + {a21f8a09-4e72-422f-9569-e3eeee2ac830} + + + {2a7feacb-d6cd-45d7-a7a1-754e28d34e2d} + @@ -168,6 +180,15 @@ API\Service + + API\Service\Configuration + + + API\Service\Configuration + + + API\Service\Configuration + @@ -264,6 +285,15 @@ API\Service + + API\Service\Configuration + + + API\Service\Configuration + + + API\Service\Configuration + @@ -272,9 +302,6 @@ API\Endpoints\Session - - API\Transports - API\Clock @@ -302,15 +329,6 @@ API\Service - - API\Service - - - API\Service - - - API\Service - API\Endpoints\Message Processing Plugins\Interfaces @@ -419,9 +437,6 @@ API\Enumeration - - API\Service - API\Enumeration @@ -434,12 +449,6 @@ API\Endpoints\Message Processing Plugins\Stock Plugins\Virtual Device - - API\Service - - - API\Service - API\Endpoints\Connections @@ -449,6 +458,42 @@ API\Endpoints\Connections + + API\Service\Reporting + + + API\Service\Reporting + + + API\Service\Health + + + API\Service\Health + + + API\Service\Runtime Endpoints + + + API\Service\Runtime Endpoints + + + API\Service\Reporting + + + API\Service\Reporting + + + API\Service\Configuration + + + API\Service\Configuration + + + API\Service\Configuration + + + API\Service\Configuration + diff --git a/src/api/Client/Midi2Client/pch.h b/src/api/Client/Midi2Client/pch.h index 9848be54..05f123f2 100644 --- a/src/api/Client/Midi2Client/pch.h +++ b/src/api/Client/Midi2Client/pch.h @@ -43,7 +43,13 @@ namespace json = ::winrt::Windows::Data::Json; #include "midi_service_interface.h" #include "ump_helpers.h" #include "memory_buffer.h" -#include "string_util.h" +#include "wstring_util.h" +#include "hstring_util.h" + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" #include "json_helpers.h" // shared @@ -101,8 +107,10 @@ namespace midi2 = ::winrt::Windows::Devices::Midi2; #include "MidiServiceTransportPluginInformation.h" #include "MidiServiceMessageProcessingPluginInformation.h" -#include "MidiSessionConnectionInformation.h" -#include "MidiSessionInformation.h" +#include "MidiServiceConfigurationResponse.h" +#include "MidiServiceLoopbackEndpointCreationResult.h" +#include "MidiServiceSessionConnectionInformation.h" +#include "MidiServiceSessionInformation.h" #include "MidiService.h" #include "MidiEndpointDeviceInformation.h" diff --git a/src/api/Inc/MidiDefs.h b/src/api/Inc/MidiDefs.h index 8edd8f98..e91c8349 100644 --- a/src/api/Inc/MidiDefs.h +++ b/src/api/Inc/MidiDefs.h @@ -145,7 +145,7 @@ DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_OUT_GroupTerminalBlocks, 51); // DEVPROP_TYP #define STRING_PKEY_MIDI_AssociatedUMP MIDI_STRING_PKEY_GUID MIDI_STRING_PKEY_PID_SEPARATOR L"52" DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_AssociatedUMP, 52); // DEVPROP_TYPE_STRING -// iSerialNumber for USB +// iSerialNumber for USB, but can be supplied by other endpoints as a config value or a value read from advertising #define STRING_PKEY_MIDI_SerialNumber MIDI_STRING_PKEY_GUID MIDI_STRING_PKEY_PID_SEPARATOR L"53" DEFINE_MIDIDEVPROPKEY(PKEY_MIDI_SerialNumber, 53); // DEVPROP_TYPE_STRING diff --git a/src/api/Inc/hstring_util.h b/src/api/Inc/hstring_util.h new file mode 100644 index 00000000..563ded6c --- /dev/null +++ b/src/api/Inc/hstring_util.h @@ -0,0 +1,83 @@ + +// 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 HSTRING_UTIL_H +#define HSTRING_UTIL_H + +#include +#include +//#include +#include + +namespace Windows::Devices::Midi2::Internal +{ + inline winrt::hstring TrimmedHStringCopy(_In_ winrt::hstring const& s) + { + std::wstring whitespace = L" \0\t\n\r"; + + std::wstring ws{ s.c_str() }; + + size_t index = ws.find_first_not_of(whitespace); + if (index != std::wstring::npos) + { + ws.erase(0, index); + } + + index = ws.find_last_not_of(whitespace); + ws.resize(index + 1); + + return winrt::hstring{ ws.c_str() }; + } + + inline winrt::hstring ToUpperHStringCopy(_In_ winrt::hstring const& s) + { + std::wstring ws{ s }; + std::transform(ws.begin(), ws.end(), ws.begin(), std::towupper); + + return winrt::hstring{ ws }; + } + + inline winrt::hstring ToLowerHStringCopy(_In_ winrt::hstring const& s) + { + std::wstring ws{ s }; + std::transform(ws.begin(), ws.end(), ws.begin(), std::towlower); + + return winrt::hstring{ ws }; + } + + inline winrt::hstring ToUpperTrimmedHStringCopy(_In_ winrt::hstring const& s) + { + return ToUpperHStringCopy(TrimmedHStringCopy(s)); + } + + inline winrt::hstring ToLowerTrimmedHStringCopy(_In_ winrt::hstring const& s) + { + return ToLowerHStringCopy(TrimmedHStringCopy(s)); + } + + + // This is for the device instance id. Not to be confused with the interface id + inline winrt::hstring NormalizeDeviceInstanceIdHStringCopy(_In_ winrt::hstring const& deviceInstanceId) + { + return ToUpperTrimmedHStringCopy(deviceInstanceId); + } + + // This is for the endpoint device interface id (the long SWD id with the GUID) + inline winrt::hstring NormalizeEndpointInterfaceIdHStringCopy(_In_ winrt::hstring const& endpointInterfaceId) + { + return ToLowerTrimmedHStringCopy(endpointInterfaceId); + } + + +} + + +#endif \ No newline at end of file diff --git a/src/api/Inc/string_util.h b/src/api/Inc/wstring_util.h similarity index 55% rename from src/api/Inc/string_util.h rename to src/api/Inc/wstring_util.h index a8a5758e..fe388e9b 100644 --- a/src/api/Inc/string_util.h +++ b/src/api/Inc/wstring_util.h @@ -9,13 +9,15 @@ #pragma once +#ifndef WSTRING_UTIL_H +#define WSTRING_UTIL_H + #include #include +#include namespace Windows::Devices::Midi2::Internal { - - inline void InPlaceToUpper(_Inout_ std::wstring &s) { std::transform(s.begin(), s.end(), s.begin(), towupper); @@ -76,48 +78,6 @@ namespace Windows::Devices::Midi2::Internal return ToLowerWStringCopy(TrimmedWStringCopy(s)); } - // TODO: this could use substr and take one op instad of two - inline winrt::hstring TrimmedHStringCopy(_In_ std::wstring ws) - { - return winrt::hstring{ TrimmedWStringCopy(ws) }; - } - - inline winrt::hstring TrimmedHStringCopy(_In_ winrt::hstring s) - { - std::wstring ws{ s }; - - return TrimmedHStringCopy(ws); - } - - inline winrt::hstring ToUpperHStringCopy(_In_ winrt::hstring s) - { - std::wstring ws{ s }; - std::transform(ws.begin(), ws.end(), ws.begin(), std::towupper); - - return winrt::hstring{ ws }; - } - - inline winrt::hstring ToLowerHStringCopy(_In_ winrt::hstring s) - { - std::wstring ws{ s }; - std::transform(ws.begin(), ws.end(), ws.begin(), std::towlower); - - return winrt::hstring{ ws }; - } - - inline winrt::hstring ToUpperTrimmedHStringCopy(_In_ winrt::hstring s) - { - return ToUpperHStringCopy(TrimmedHStringCopy(s)); - } - - inline winrt::hstring ToLowerTrimmedHStringCopy(_In_ winrt::hstring s) - { - return ToLowerHStringCopy(TrimmedHStringCopy(s)); - } - - - - // This is just to convert all GUIDs to the same case. It does // not add or remove opening / closing brackets @@ -126,55 +86,6 @@ namespace Windows::Devices::Midi2::Internal return ToUpperTrimmedWStringCopy(guidString); } - // This is for the device instance id. Not to be confused with the interface id - inline std::wstring NormalizeDeviceInstanceIdWStringCopy(_In_ std::wstring deviceInstanceId) - { - return ToUpperTrimmedWStringCopy(deviceInstanceId); - } - // This is for the device instance id. Not to be confused with the interface id - inline winrt::hstring NormalizeDeviceInstanceIdHStringCopy(_In_ winrt::hstring deviceInstanceId) - { - return ToUpperTrimmedHStringCopy(deviceInstanceId); - } - - //// This is for the endpoint device interface id (the long SWD id with the GUID) - //inline std::wstring NormalizeEndpointInterfaceIdCopy(_In_ std::wstring endpointInterfaceId) - //{ - // return ToLowerTrimmedWStringCopy(endpointInterfaceId); - //} - - - // This is for the endpoint device interface id (the long SWD id with the GUID) - inline winrt::hstring NormalizeEndpointInterfaceIdHStringCopy(_In_ winrt::hstring endpointInterfaceId) - { - return ToLowerTrimmedHStringCopy(endpointInterfaceId); - } - - // This is for the endpoint device interface id (the long SWD id with the GUID) - inline std::wstring NormalizeEndpointInterfaceIdWStringCopy(_In_ std::wstring endpointInterfaceId) - { - return 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 endpointInterfaceId, _In_ std::wstring 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; - } - - - - - // note that this produces a GUID with uppercase letters and enclosing braces inline std::wstring GuidToString(_In_ GUID guid) { @@ -249,3 +160,6 @@ namespace Windows::Devices::Midi2::Internal } + + +#endif \ No newline at end of file diff --git a/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj b/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj index 6a075814..085e714b 100644 --- a/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj +++ b/src/api/Libs/AM_MIDI2/src/AM_MIDI2.vcxproj @@ -119,31 +119,31 @@ true - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ true - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ true - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ true - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ diff --git a/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj new file mode 100644 index 00000000..0fe62fc4 --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj @@ -0,0 +1,192 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {60d2e061-fc7d-40ff-ad8c-4cb3d175a814} + AbstractionUtilities + 10.0.20348.0 + AbstractionUtilities + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + + + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + + + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + + + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + + + + Level4 + true + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp17 + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc + true + + + + + true + + + + + Level4 + true + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp17 + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc + true + + + + + true + true + true + + + + + Level4 + true + _DEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp17 + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc + true + + + + + true + + + + + Level4 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp17 + %(AdditionalIncludeDirectories);$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(IntDir);$(ProjectDir)inc + true + + + + + true + true + true + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters new file mode 100644 index 00000000..8e128b2d --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/AbstractionUtilities.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + 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 new file mode 100644 index 00000000..9953ff5e --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/inc/endpoint_data_helpers.h @@ -0,0 +1,35 @@ +// 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 new file mode 100644 index 00000000..80e8b48a --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/inc/json_helpers.h @@ -0,0 +1,147 @@ +// 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_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" + + +// 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_SUCCESS_PROPERTY_KEY L"success" +#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_SUCCESS_PROPERTY_KEY L"success" +#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 +{ + 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 new file mode 100644 index 00000000..c7a7b9d7 --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/inc/swd_property_builders.h @@ -0,0 +1,45 @@ +// 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 BuildWStringDevProperty( + _In_ DEVPROPKEY const key, + _In_ std::wstring const& value); + + DEVPROPERTY BuildUInt32DevProperty( + _In_ DEVPROPKEY const key, + _In_ uint32_t const& value); + + DEVPROPERTY BuildByteDevProperty( + _In_ DEVPROPKEY const key, + _In_ uint8_t const& value); + + DEVPROPERTY BuildGuidDevProperty( + _In_ DEVPROPKEY const key, + _In_ GUID const& value); + + DEVPROPERTY BuildBooleanDevProperty( + _In_ DEVPROPKEY const key, + _In_ bool const& value); + + DEVPROPERTY BuildEmptyDevProperty( + _In_ DEVPROPKEY const key); + +} + +#endif \ No newline at end of file diff --git a/src/api/Libs/AbstractionUtilities/inc/swd_property_helpers.h b/src/api/Libs/AbstractionUtilities/inc/swd_property_helpers.h new file mode 100644 index 00000000..cae230ef --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/inc/swd_property_helpers.h @@ -0,0 +1,47 @@ +// 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_HELPERS_H +#define SWD_PROPERTY_HELPERS_H + +#include "MidiDefs.h" +#include "MidiDataFormat.h" + +namespace Windows::Devices::Midi2::Internal +{ + bool AddStandardEndpointProperties( + _In_ std::vector& interfaceDeviceProperties, + + _In_ GUID const& abstractionLayerGuid, + _In_ MidiEndpointDevicePurposePropertyValue const& endpointPurpose, + + _In_ std::wstring const& friendlyName, + + _In_ std::wstring const& transportMnemonic, + _In_ std::wstring const& transportSuppliedEndpointName, + _In_ std::wstring const& transportSuppliedEndpointDescription, + + _In_ std::wstring const& userSuppliedEndpointName, + _In_ std::wstring const& userSuppliedEndpointDescription, + + _In_ std::wstring const& uniqueIdentifier, + + _In_ MidiDataFormat const& supportedDataFormats, + _In_ BYTE const& nativeDataFormat, + + _In_ bool const& supportsMultiClient, + _In_ bool const& requiresMetadataHandler, + _In_ bool const& generateIncomingTimestamps + ); + + +} + +#endif \ 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 new file mode 100644 index 00000000..93249230 --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/src/endpoint_data_helpers.cpp @@ -0,0 +1,69 @@ +// 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/Inc/json_helpers.h b/src/api/Libs/AbstractionUtilities/src/json_helpers.cpp similarity index 51% rename from src/api/Inc/json_helpers.h rename to src/api/Libs/AbstractionUtilities/src/json_helpers.cpp index 7fda7643..87fd342b 100644 --- a/src/api/Inc/json_helpers.h +++ b/src/api/Libs/AbstractionUtilities/src/json_helpers.cpp @@ -6,79 +6,12 @@ // Further information: https://github.com/microsoft/MIDI/ // ============================================================================ -#pragma once - -// this def messes with json so we need to undef it here -#pragma push_macro("GetObject") -#undef GetObject -#include -#pragma pop_macro("GetObject") - -#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_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" - - -// 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_PROPERTY_KEY L"uniqueIdentifier" -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_UNIQUE_ID_MAX_LEN 32 - - -#define MIDI_CONFIG_JSON_ENDPOINT_VIRTUAL_DEVICE_RESPONSE_SUCCESS_PROPERTY_KEY L"success" -#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" - - -// 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" - - +#include "pch.h" namespace Windows::Devices::Midi2::Internal { - inline bool JsonObjectFromBSTR(_In_ BSTR* bstr, _Out_ json::JsonObject &obj) + _Use_decl_annotations_ + bool JsonObjectFromBSTR(BSTR* const bstr, json::JsonObject& obj) noexcept { if (bstr == nullptr) return false; @@ -104,22 +37,30 @@ namespace Windows::Devices::Midi2::Internal - inline bool JsonStringifyObjectToOutParam(_In_ json::JsonObject obj, _Out_ BSTR** outParam) + _Use_decl_annotations_ + bool JsonStringifyObjectToOutParam(json::JsonObject const& obj, BSTR** outParam) noexcept { - ATL::CComBSTR responseString = obj.Stringify().c_str(); - - auto hr = responseString.CopyTo(*outParam); + try + { + ATL::CComBSTR responseString = obj.Stringify().c_str(); + + auto hr = responseString.CopyTo(*outParam); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hr)) + { + return true; + } + } + catch (...) { - return true; + } return false; } - - inline json::JsonObject JsonCreateSingleWStringPropertyObject(_In_ std::wstring key, _In_ std::wstring value) + _Use_decl_annotations_ + json::JsonObject JsonCreateSingleWStringPropertyObject(std::wstring const& key, std::wstring const& value) noexcept { json::JsonObject obj; @@ -129,16 +70,18 @@ namespace Windows::Devices::Midi2::Internal } - - inline json::JsonArray JsonGetArrayProperty(_In_ json::JsonObject parent, _In_ std::wstring key) noexcept + _Use_decl_annotations_ + json::JsonArray JsonGetArrayProperty(json::JsonObject const& parent, std::wstring const& key) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedArray(key); + auto result = parent.GetNamedArray(hkey); return result; } @@ -154,7 +97,8 @@ namespace Windows::Devices::Midi2::Internal return json::JsonArray{}; } - inline bool JsonSetArrayProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ json::JsonArray value) noexcept + _Use_decl_annotations_ + bool JsonSetArrayProperty(json::JsonObject const& parent, std::wstring const& key, json::JsonArray const& value) noexcept { try { @@ -173,16 +117,18 @@ namespace Windows::Devices::Midi2::Internal return false; } - - inline std::wstring JsonGetWStringProperty(_In_ json::JsonObject parent, _In_ std::wstring key, std::wstring defaultValue) noexcept + _Use_decl_annotations_ + std::wstring JsonGetWStringProperty(json::JsonObject const& parent, std::wstring const& key, std::wstring const& defaultValue) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedString(key); + auto result = parent.GetNamedString(hkey); return result.c_str(); } @@ -198,7 +144,8 @@ namespace Windows::Devices::Midi2::Internal return defaultValue; } - inline bool JsonSetWStringProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ std::wstring value) noexcept + _Use_decl_annotations_ + bool JsonSetWStringProperty(json::JsonObject const& parent, std::wstring const& key, std::wstring const& value) noexcept { try { @@ -220,15 +167,22 @@ namespace Windows::Devices::Midi2::Internal } // this handles accuracy of seconds and no finer - inline std::chrono::time_point JsonGetDateTimeProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ std::chrono::time_point defaultValue) noexcept + _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) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedNumber(key); + auto result = parent.GetNamedNumber(hkey); auto seconds = std::chrono::seconds((long)result); std::chrono::time_point tp; @@ -248,7 +202,11 @@ namespace Windows::Devices::Midi2::Internal } // this handles accuracy of seconds and no finer - inline bool JsonSetDateTimeProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ std::chrono::time_point value) noexcept + _Use_decl_annotations_ + bool JsonSetDateTimeProperty( + json::JsonObject const& parent, + std::wstring const& key, + std::chrono::time_point const value) noexcept { try { @@ -269,16 +227,18 @@ namespace Windows::Devices::Midi2::Internal return false; } - - inline GUID JsonGetGuidProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ GUID defaultValue) noexcept + _Use_decl_annotations_ + GUID JsonGetGuidProperty(json::JsonObject const& parent, std::wstring const& key, GUID const& defaultValue) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedString(key); + auto result = parent.GetNamedString(hkey); return StringToGuid(result.c_str()); } @@ -293,7 +253,8 @@ namespace Windows::Devices::Midi2::Internal return defaultValue; } - inline bool JsonSetGuidProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ GUID value) noexcept + _Use_decl_annotations_ + bool JsonSetGuidProperty(json::JsonObject const& parent, std::wstring const& key, GUID const& value) noexcept { try { @@ -314,16 +275,18 @@ namespace Windows::Devices::Midi2::Internal return false; } - - inline bool JsonGetBoolProperty(_In_ json::JsonObject parent, _In_ std::wstring key, bool defaultValue) noexcept + _Use_decl_annotations_ + bool JsonGetBoolProperty(json::JsonObject const& parent, std::wstring const& key, bool const defaultValue) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedBoolean(key); + auto result = parent.GetNamedBoolean(hkey); return result; } @@ -339,7 +302,8 @@ namespace Windows::Devices::Midi2::Internal return defaultValue; } - inline bool JsonSetBoolProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ bool value) noexcept + _Use_decl_annotations_ + bool JsonSetBoolProperty(json::JsonObject const& parent, std::wstring const& key, bool const value) noexcept { try { @@ -358,16 +322,18 @@ namespace Windows::Devices::Midi2::Internal return false; } - - inline double JsonGetDoubleProperty(_In_ json::JsonObject parent, _In_ std::wstring key, double defaultValue) noexcept + _Use_decl_annotations_ + double JsonGetDoubleProperty(json::JsonObject const& parent, std::wstring const& key, double const defaultValue) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedNumber(key); + auto result = parent.GetNamedNumber(hkey); return result; } @@ -383,7 +349,8 @@ namespace Windows::Devices::Midi2::Internal return defaultValue; } - inline bool JsonSetDoubleProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ double value) noexcept + _Use_decl_annotations_ + bool JsonSetDoubleProperty(json::JsonObject const& parent, std::wstring const& key, double const value) noexcept { try { @@ -402,16 +369,18 @@ namespace Windows::Devices::Midi2::Internal return false; } - - inline long JsonGetLongProperty(_In_ json::JsonObject parent, _In_ std::wstring key, long defaultValue) noexcept + _Use_decl_annotations_ + long JsonGetLongProperty(json::JsonObject const& parent, std::wstring const& key, long const defaultValue) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = (long)parent.GetNamedNumber(key); + auto result = (long)parent.GetNamedNumber(hkey); return result; } @@ -427,7 +396,8 @@ namespace Windows::Devices::Midi2::Internal return defaultValue; } - inline bool JsonSetLongProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ long value) noexcept + _Use_decl_annotations_ + bool JsonSetLongProperty(json::JsonObject const& parent, std::wstring const& key, long const value) noexcept { try { @@ -451,16 +421,18 @@ namespace Windows::Devices::Midi2::Internal - - inline json::JsonObject JsonGetObjectProperty(_In_ json::JsonObject parent, _In_ std::wstring key, json::JsonObject defaultValue) noexcept + _Use_decl_annotations_ + json::JsonObject JsonGetObjectProperty(json::JsonObject const& parent, std::wstring const& key, json::JsonObject const& defaultValue) noexcept { if (parent != nullptr) { - if (parent.HasKey(key)) + auto hkey = winrt::to_hstring(key.c_str()); + + if (parent.HasKey(hkey)) { try { - auto result = parent.GetNamedObject(key); + auto result = parent.GetNamedObject(hkey); return result; } @@ -476,7 +448,8 @@ namespace Windows::Devices::Midi2::Internal return defaultValue; } - inline bool JsonSetObjectProperty(_In_ json::JsonObject parent, _In_ std::wstring key, _In_ json::JsonObject value) noexcept + _Use_decl_annotations_ + bool JsonSetObjectProperty(json::JsonObject const& parent, std::wstring const& key, json::JsonObject const& value) noexcept { try { @@ -495,15 +468,5 @@ namespace Windows::Devices::Midi2::Internal return false; } - - - - - - - - - - } diff --git a/src/api/Libs/AbstractionUtilities/src/pch.cpp b/src/api/Libs/AbstractionUtilities/src/pch.cpp new file mode 100644 index 00000000..a128584f --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/src/pch.cpp @@ -0,0 +1,13 @@ +// 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 new file mode 100644 index 00000000..d313325c --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/src/pch.h @@ -0,0 +1,60 @@ +// 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 PCH_H +#define PCH_H + +#ifndef STRICT +#define STRICT +#endif + +#include + + +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + + +#include "SWDevice.h" +#include +#include "setupapi.h" + +#include "strsafe.h" +#include "wstring_util.h" + +#include "MidiDefs.h" +//#include "MidiXProc.h" + +#include "MidiDataFormat.h" + +//#include "MidiDeviceManagerInterface.h" + +namespace internal = ::Windows::Devices::Midi2::Internal; + +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" +#include "json_helpers.h" + + +#endif //PCH_H diff --git a/src/api/Libs/AbstractionUtilities/src/property_builders.cpp b/src/api/Libs/AbstractionUtilities/src/property_builders.cpp new file mode 100644 index 00000000..e69de29b diff --git a/src/api/Libs/AbstractionUtilities/src/swd_property_builders.cpp b/src/api/Libs/AbstractionUtilities/src/swd_property_builders.cpp new file mode 100644 index 00000000..fa51c4c5 --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/src/swd_property_builders.cpp @@ -0,0 +1,68 @@ +// 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_ + DEVPROPERTY BuildWStringDevProperty(DEVPROPKEY const key, std::wstring const& value) + { + auto cleanValue = internal::TrimmedWStringCopy(value); + + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_STRING, static_cast((cleanValue.length() + 1) * sizeof(WCHAR)), (PVOID)cleanValue.c_str() }; + } + + _Use_decl_annotations_ + DEVPROPERTY BuildUInt32DevProperty(DEVPROPKEY const key, uint32_t const& value) + { + + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_UINT32, static_cast(sizeof(value)), (PVOID)&value }; + } + + _Use_decl_annotations_ + DEVPROPERTY BuildByteDevProperty(DEVPROPKEY const key, uint8_t const& value) + { + + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_BYTE, static_cast(sizeof(value)), (PVOID)&value }; + } + + _Use_decl_annotations_ + DEVPROPERTY BuildGuidDevProperty(DEVPROPKEY const key, GUID const& value) + { + + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_GUID, static_cast(sizeof(GUID)), (PVOID)&value }; + } + + _Use_decl_annotations_ + DEVPROPERTY BuildBooleanDevProperty(DEVPROPKEY const key, bool const& value) + { + DEVPROP_BOOLEAN propVal = value ? DEVPROP_TRUE : DEVPROP_FALSE; + + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(propVal)), (PVOID)&propVal }; + + } + + _Use_decl_annotations_ + DEVPROPERTY BuildEmptyDevProperty(DEVPROPKEY const key) + { + return DEVPROPERTY{ {key, DEVPROP_STORE_SYSTEM, nullptr}, + DEVPROP_TYPE_EMPTY, 0, nullptr }; + + } + + + + + +} diff --git a/src/api/Libs/AbstractionUtilities/src/swd_property_helpers.cpp b/src/api/Libs/AbstractionUtilities/src/swd_property_helpers.cpp new file mode 100644 index 00000000..800d7c8d --- /dev/null +++ b/src/api/Libs/AbstractionUtilities/src/swd_property_helpers.cpp @@ -0,0 +1,104 @@ +// 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_ + bool AddStandardEndpointProperties( + std::vector& interfaceDeviceProperties, + + GUID const& abstractionLayerGuid, + MidiEndpointDevicePurposePropertyValue const& endpointPurpose, + + std::wstring const& friendlyName, + + std::wstring const& transportMnemonic, + std::wstring const& transportSuppliedEndpointName, + std::wstring const& transportSuppliedEndpointDescription, + + std::wstring const& userSuppliedEndpointName, + std::wstring const& userSuppliedEndpointDescription, + + std::wstring const& uniqueIdentifier, + + MidiDataFormat const& supportedDataFormats, + BYTE const& nativeDataFormat, + + bool const& supportsMultiClient, + bool const& requiresMetadataHandler, + bool const& generateIncomingTimestamps + ) + { + 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 + + if (!userSuppliedEndpointName.empty()) + { + interfaceDeviceProperties.push_back(BuildWStringDevProperty(PKEY_MIDI_UserSuppliedEndpointName, userSuppliedEndpointName)); + } + + if (!userSuppliedEndpointDescription.empty()) + { + 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/MidiKs/MidiKS.vcxproj b/src/api/Libs/MidiKs/MidiKS.vcxproj index b87e0353..367ce392 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.22621.0 + 10.0.20348.0 @@ -99,31 +99,31 @@ true - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ true - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ true - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ true - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ diff --git a/src/api/Libs/MidiKsCommon/MidiKSCommon.vcxproj b/src/api/Libs/MidiKsCommon/MidiKSCommon.vcxproj index ae5fb21d..0ddf0ef9 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.22621.0 + 10.0.20348.0 @@ -94,28 +94,28 @@ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ diff --git a/src/api/Midi2.sln b/src/api/Midi2.sln index 33f27d5c..fed02a0d 100644 --- a/src/api/Midi2.sln +++ b/src/api/Midi2.sln @@ -8,6 +8,7 @@ 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 @@ -68,12 +69,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MidiSrv", "Service\Exe\Midi {093852BE-32B8-4EB8-814E-91410FFDB4F6} = {093852BE-32B8-4EB8-814E-91410FFDB4F6} {0DDD9961-7959-46B1-A11D-05BA8AF65297} = {0DDD9961-7959-46B1-A11D-05BA8AF65297} {0E739771-0C0B-42EE-AADB-95E7E1E5A5ED} = {0E739771-0C0B-42EE-AADB-95E7E1E5A5ED} + {0F94A751-9159-4A88-8A71-347151124548} = {0F94A751-9159-4A88-8A71-347151124548} {206CEDBF-6343-4171-87A8-1DDDE6E2ED60} = {206CEDBF-6343-4171-87A8-1DDDE6E2ED60} {22ABB513-5E77-474D-AA11-E56B8071EB4C} = {22ABB513-5E77-474D-AA11-E56B8071EB4C} {2480B077-46E5-42AE-9BDB-685AFF258529} = {2480B077-46E5-42AE-9BDB-685AFF258529} {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} {8795821B-541D-4B9B-BF7F-50CA976FC54E} = {8795821B-541D-4B9B-BF7F-50CA976FC54E} @@ -88,6 +92,7 @@ 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 @@ -115,11 +120,13 @@ 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 @@ -147,6 +154,7 @@ 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 @@ -158,11 +166,13 @@ 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 @@ -174,6 +184,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.JitterReductionListen EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.Client.benchmarks", "Test\Midi2.Client.benchmarks\Midi2.Client.benchmarks.vcxproj", "{4DABE157-7DD5-422A-8C77-B83EAC9987D0}" + ProjectSection(ProjectDependencies) = postProject + {574447FB-B44C-403E-9617-092F08B0FB27} = {574447FB-B44C-403E-9617-092F08B0FB27} + {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} = {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} + {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.EndpointMetadataListenerTransform", "Transform\EndpointMetadataListenerTransform\Midi2.EndpointMetadataListenerTransform.vcxproj", "{0DDD9961-7959-46B1-A11D-05BA8AF65297}" ProjectSection(ProjectDependencies) = postProject @@ -206,20 +221,39 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.Transform.unittests", "Test\Midi2.Transform.unittests\Midi2.Transform.unittests.vcxproj", "{1425218C-E6E6-40BB-B99B-052156749E2C}" ProjectSection(ProjectDependencies) = postProject {0DDD9961-7959-46B1-A11D-05BA8AF65297} = {0DDD9961-7959-46B1-A11D-05BA8AF65297} + {0E739771-0C0B-42EE-AADB-95E7E1E5A5ED} = {0E739771-0C0B-42EE-AADB-95E7E1E5A5ED} + {206CEDBF-6343-4171-87A8-1DDDE6E2ED60} = {206CEDBF-6343-4171-87A8-1DDDE6E2ED60} {366FA284-D8C0-4CC5-B9A3-917EAB967173} = {366FA284-D8C0-4CC5-B9A3-917EAB967173} {36E99993-ABE3-44CC-A776-B4E835B5EEC6} = {36E99993-ABE3-44CC-A776-B4E835B5EEC6} + {574447FB-B44C-403E-9617-092F08B0FB27} = {574447FB-B44C-403E-9617-092F08B0FB27} {6D151BF5-40A2-4BD7-BB67-07D2741DA01E} = {6D151BF5-40A2-4BD7-BB67-07D2741DA01E} + {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} = {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} + {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} + {F6ACF293-2612-4D01-AFA4-103282B84A36} = {F6ACF293-2612-4D01-AFA4-103282B84A36} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Midi2.JitterReductionGeneratorTransform", "Transform\JitterReductionGeneratorTransform\Midi2.JitterReductionGeneratorTransform.vcxproj", "{6D151BF5-40A2-4BD7-BB67-07D2741DA01E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Windows.Devices.Midi.shim", "Client\MidiRT\Windows.Devices.Midi.Shim\Windows.Devices.Midi.Shim.vcxproj", "{16F34756-0269-4CEB-8F1C-32D9C6441990}" + ProjectSection(ProjectDependencies) = postProject + {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} = {9991FF5B-E0F0-4373-A7C2-20B1EFDE5F70} + {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} = {EFB7CF90-7DEF-44CF-868A-191CA30E0FCF} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mididmp", "InBoxApps\mididmp\mididmp.vcxproj", "{5EC6D5EB-53D4-4731-891E-F746F0201429}" 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 EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -1017,6 +1051,26 @@ 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 @@ -1064,6 +1118,7 @@ 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 445dc3d5..ed4f344e 100644 --- a/src/api/Service/Exe/MidiConfigurationManager.cpp +++ b/src/api/Service/Exe/MidiConfigurationManager.cpp @@ -375,7 +375,7 @@ std::map CMidiConfigurationManager::GetTranspor __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"JSON Object parsing failed"), + TraceLoggingWideString(L"JSON Object parsing failed", "message"), TraceLoggingWideString(jsonStringSource.c_str(), "Source JSON String") ); @@ -390,7 +390,7 @@ std::map CMidiConfigurationManager::GetTranspor __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"JSON Object parsing failed. Exception.") + TraceLoggingWideString(L"JSON Object parsing failed. Exception.", "message") ); return abstractionSettings; @@ -404,7 +404,7 @@ std::map CMidiConfigurationManager::GetTranspor __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"JSON Object null after parsing") + TraceLoggingWideString(L"JSON Object null after parsing", "message") ); // return the empty map @@ -412,7 +412,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); if (plugins == nullptr) @@ -422,7 +422,7 @@ std::map CMidiConfigurationManager::GetTranspor __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"No transport plugins node in JSON") + TraceLoggingWideString(L"No transport plugins node in JSON", "message") ); // return the empty map @@ -431,19 +431,21 @@ std::map CMidiConfigurationManager::GetTranspor // Iterate through nodes and find each transport abstraction entry. Parse the GUID. Add to results. - for (auto i = plugins.begin(); i != plugins.end(); i++) + auto it = plugins.First(); + + while (it.HasCurrent()) { - std::wstring key = i.Current().Key().c_str(); + std::wstring key = it.Current().Key().c_str(); TraceLoggingWrite( MidiSrvTelemetryProvider::Provider(), __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(key.c_str(), "AbstractionIdGuidString") + TraceLoggingWideString(key.c_str(), "AbstractionIdGuidString", "message") ); - std::wstring transportJson = i.Current().Value().GetObject().Stringify().c_str(); + std::wstring transportJson = it.Current().Value().GetObject().Stringify().c_str(); GUID abstractionId; @@ -461,7 +463,7 @@ std::map CMidiConfigurationManager::GetTranspor TraceLoggingWideString(key.c_str(), "Invalid GUID Property") ); } - + // TODO: Should verify the abstractionId is for an enabled abstraction // before adding it to the returned map @@ -474,8 +476,11 @@ std::map CMidiConfigurationManager::GetTranspor TraceLoggingPointer(this, "this"), TraceLoggingWideString(transportJson.c_str()), TraceLoggingGuid(abstractionId) - ); + ); + + it.MoveNext(); } + } CATCH_LOG(); diff --git a/src/api/Service/Exe/MidiDeviceManager.cpp b/src/api/Service/Exe/MidiDeviceManager.cpp index 7e2eaadb..5990cee5 100644 --- a/src/api/Service/Exe/MidiDeviceManager.cpp +++ b/src/api/Service/Exe/MidiDeviceManager.cpp @@ -38,6 +38,16 @@ CMidiDeviceManager::Initialize( try { + TraceLoggingWrite( + MidiSrvTelemetryProvider::Provider(), + __FUNCTION__, + TraceLoggingLevel(WINEVENT_LEVEL_INFO), + TraceLoggingPointer(this, "this"), + TraceLoggingWideString(L"Loading abstraction layer", "message"), + TraceLoggingGuid(AbstractionLayer, "abstraction layer") + ); + + // provide the initial settings for these transports auto transportSettingsJson = m_ConfigurationManager->GetSavedConfigurationForTransportAbstraction(AbstractionLayer); @@ -61,7 +71,6 @@ CMidiDeviceManager::Initialize( if (SUCCEEDED(initializeResult)) { - OutputDebugString(__FUNCTION__ L": Transport Abstraction initialized.\n"); m_MidiEndpointManagers.emplace(AbstractionLayer, std::move(endpointManager)); } else @@ -71,7 +80,8 @@ CMidiDeviceManager::Initialize( __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Transport abstraction initialization failed.") + TraceLoggingWideString(L"Transport abstraction initialization failed.", "message"), + TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } @@ -83,7 +93,8 @@ CMidiDeviceManager::Initialize( __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Transport abstraction endpoint manager initialization failed.") + TraceLoggingWideString(L"Transport abstraction endpoint manager initialization failed.", "message"), + TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } @@ -93,12 +104,12 @@ CMidiDeviceManager::Initialize( if (abstractionConfigurationManager != nullptr) { - if (transportSettingsJson != L"") + if (!transportSettingsJson.empty()) { - CComBSTR response; + CComBSTR response{}; response.Empty(); - LOG_IF_FAILED(abstractionConfigurationManager->UpdateConfiguration(transportSettingsJson.c_str(), &response)); + LOG_IF_FAILED(abstractionConfigurationManager->UpdateConfiguration(transportSettingsJson.c_str(), true, &response)); // we don't use the response info here. ::SysFreeString(response); @@ -114,14 +125,11 @@ CMidiDeviceManager::Initialize( __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Transport Abstraction activation failed (nullptr return).") + TraceLoggingWideString(L"Transport Abstraction activation failed (nullptr return).", "message"), + TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } - - - - } catch (...) { @@ -131,7 +139,8 @@ CMidiDeviceManager::Initialize( __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Exception loading transport abstraction.") + TraceLoggingWideString(L"Exception loading transport abstraction.", "message"), + TraceLoggingGuid(AbstractionLayer, "abstraction layer") ); } @@ -766,7 +775,7 @@ CMidiDeviceManager::DeactivateEndpoint __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(InstanceId) + TraceLoggingWideString(InstanceId, "instance id") ); auto cleanId = internal::NormalizeDeviceInstanceIdWStringCopy(InstanceId); @@ -837,6 +846,7 @@ CMidiDeviceManager::UpdateAbstractionConfiguration ( GUID AbstractionId, LPCWSTR ConfigurationJson, + BOOL IsFromConfigurationFile, BSTR* Response ) { @@ -847,8 +857,9 @@ CMidiDeviceManager::UpdateAbstractionConfiguration __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_INFO), TraceLoggingPointer(this, "this"), - TraceLoggingGuid(AbstractionId), - TraceLoggingWideString(ConfigurationJson) + TraceLoggingGuid(AbstractionId, "abstraction id"), + TraceLoggingWideString(ConfigurationJson, "config json"), + TraceLoggingBool(IsFromConfigurationFile, "from config file") ); if (auto search = m_MidiAbstractionConfigurationManagers.find(AbstractionId); search != m_MidiAbstractionConfigurationManagers.end()) @@ -857,7 +868,7 @@ CMidiDeviceManager::UpdateAbstractionConfiguration if (configManager) { - return configManager->UpdateConfiguration(ConfigurationJson, Response); + return configManager->UpdateConfiguration(ConfigurationJson, IsFromConfigurationFile, Response); } } else @@ -867,8 +878,8 @@ CMidiDeviceManager::UpdateAbstractionConfiguration __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingGuid(AbstractionId), - TraceLoggingWideString(L"Failed to find the referenced abstraction by its GUID") + TraceLoggingGuid(AbstractionId, "abstraction id"), + TraceLoggingWideString(L"Failed to find the referenced abstraction by its GUID", "message") ); } @@ -880,7 +891,7 @@ CMidiDeviceManager::UpdateAbstractionConfiguration __FUNCTION__, TraceLoggingLevel(WINEVENT_LEVEL_ERROR), TraceLoggingPointer(this, "this"), - TraceLoggingWideString(L"Json is null") + TraceLoggingWideString(L"Json is null", "message") ); } @@ -900,8 +911,6 @@ CMidiDeviceManager::Cleanup() TraceLoggingPointer(this, "this") ); - OutputDebugString(__FUNCTION__ L"\n"); - m_MidiEndpointManagers.clear(); m_MidiAbstractionConfigurationManagers.clear(); diff --git a/src/api/Service/Exe/MidiSrv.vcxproj b/src/api/Service/Exe/MidiSrv.vcxproj index aef44f4d..7ee2743d 100644 --- a/src/api/Service/Exe/MidiSrv.vcxproj +++ b/src/api/Service/Exe/MidiSrv.vcxproj @@ -94,43 +94,43 @@ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration) + $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midixproc\$(Platform)\$(Configuration) + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midixproc\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AbstractionUtilities\$(Platform)\$(Configuration) $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) + %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) - %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) + %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) @@ -146,7 +146,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -163,18 +163,18 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false - %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) + %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) - %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) + %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) @@ -190,7 +190,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false @@ -207,13 +207,13 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false - %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) + %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) @@ -231,13 +231,13 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false - %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) + %(AdditionalIncludeDirectories);$(SolutionDir)VSFiles\intermediate\idl\$(Platform)\$(Configuration);$(ProjectDir)\..\Inc;$(SolutionDir)inc;$(SolutionDir)VSFiles\intermediate\midi2.ksabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.diagnosticsabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.virtualmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.networkmidiabstraction\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\MidiSrv\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.JitterReductionTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.EndpointMetadataListenerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.BS2UMPTransform\$(Platform)\$(Configuration);$(SolutionDir)Libs\AbstractionUtilities\inc;$(SolutionDir)VSFiles\intermediate\midi2.SchedulerTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.UMP2BSTransform\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midi2.midisrvabstraction\$(Platform)\$(Configuration) @@ -253,7 +253,7 @@ $(SolutionDir)idl - Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) + Rpcrt4.lib;onecoreuap.lib;ksuser.lib;avrt.lib;midixproc.lib;AbstractionUtilities.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) false diff --git a/src/api/Service/Exe/MidiSrvRPC.idl b/src/api/Service/Exe/MidiSrvRPC.idl index d1ca09d4..7ccc3f27 100644 --- a/src/api/Service/Exe/MidiSrvRPC.idl +++ b/src/api/Service/Exe/MidiSrvRPC.idl @@ -8,7 +8,10 @@ import "oaidl.idl"; import "ocidl.idl"; -import "mididevicemanagerinterface.idl"; + +import "MidiDataFormat.idl"; +import "MidiFlow.idl"; +//import "mididevicemanagerinterface.idl"; cpp_quote("#define MIDISRV_LRPC_PROTOCOL L\"ncalrpc\"") cpp_quote("#define MIDISRV_ENDPOINT L\"MidiSrvClientRpc\"") @@ -74,18 +77,49 @@ typedef struct MIDISRV_CLIENT interface MidiSrvRPC { // Temporary test RPC, to be removed - HRESULT MidiSrvTestRpc([in] handle_t BindingHandle, [ in, string ] LPCWSTR Identifier, [in] PREQUESTED_SETTINGS RequestedSettings, [out] PALLOCATED_SETTINGS *AllocatedSettings); + HRESULT MidiSrvTestRpc( + [in] handle_t BindingHandle, + [in, string] LPCWSTR Identifier, + [in] PREQUESTED_SETTINGS RequestedSettings, + [out] PALLOCATED_SETTINGS *AllocatedSettings); + + + HRESULT MidiSrvCreateClient( + [in] handle_t BindingHandle, + [in, string] LPCWSTR MidiDevice, + [in] PMIDISRV_CLIENTCREATION_PARAMS CreationParams, + [in] GUID SessionId, + [out] PMIDISRV_CLIENT *Client); + + HRESULT MidiSrvDestroyClient( + [in] handle_t BindingHandle, + [in] MidiClientHandle ClientHandle); + + + // API-driven configuration + HRESULT MidiSrvUpdateConfiguration( + [in] handle_t BindingHandle, + [in, string] LPCWSTR ConfigurationJson, + [in] BOOL IsFromConfigurationFile, + [out] BSTR* Response); - HRESULT MidiSrvCreateClient([in] handle_t BindingHandle, [ in, string ] LPCWSTR MidiDevice, [in] PMIDISRV_CLIENTCREATION_PARAMS CreationParams, [in] GUID SessionId, [out] PMIDISRV_CLIENT *Client); - HRESULT MidiSrvDestroyClient([in] handle_t BindingHandle, [in] MidiClientHandle ClientHandle); - HRESULT MidiSrvUpdateConfiguration([in] handle_t BindingHandle, [in, string] LPCWSTR ConfigurationJson, [out] BSTR* Response); + // Session Management + HRESULT MidiSrvRegisterSession( + [in] handle_t BindingHandle, + [in] GUID SessionId, + [in, string] LPCWSTR SessionName, + [in] DWORD ProcessId, + [in, string] LPCWSTR ProcessName); - HRESULT MidiSrvRegisterSession([in] handle_t BindingHandle, [in] GUID SessionId, [in, string] LPCWSTR SessionName, [in] DWORD ProcessId, [in, string] LPCWSTR ProcessName); - HRESULT MidiSrvDeregisterSession([in] handle_t BindingHandle, [in] GUID SessionId); + HRESULT MidiSrvDeregisterSession( + [in] handle_t BindingHandle, + [in] GUID SessionId); - HRESULT MidiSrvGetSessionList([in] handle_t BindingHandle, [out] BSTR* SessionListJson); + HRESULT MidiSrvGetSessionList( + [in] handle_t BindingHandle, + [out] BSTR* SessionListJson); } diff --git a/src/api/Service/Exe/MidiSrvRpc.cpp b/src/api/Service/Exe/MidiSrvRpc.cpp index 0ee9c1b4..fba3f343 100644 --- a/src/api/Service/Exe/MidiSrvRpc.cpp +++ b/src/api/Service/Exe/MidiSrvRpc.cpp @@ -144,6 +144,7 @@ HRESULT MidiSrvUpdateConfiguration( /* [in] */ handle_t BindingHandle, /*[in, string]*/ __RPC__in_string LPCWSTR ConfigurationJson, + __RPC__in BOOL IsFromConfigurationFile, __RPC__out BSTR* Response) { UNREFERENCED_PARAMETER(BindingHandle); @@ -197,7 +198,7 @@ MidiSrvUpdateConfiguration( CComBSTR response; response.Empty(); - deviceManager->UpdateAbstractionConfiguration(i->first, i->second.c_str(), &response); + deviceManager->UpdateAbstractionConfiguration(i->first, i->second.c_str(), IsFromConfigurationFile, &response); // Probably need to do more formatting of this. Should use the json objects instead diff --git a/src/api/Service/Exe/stdafx.h b/src/api/Service/Exe/stdafx.h index ecb3dd30..6de275e1 100644 --- a/src/api/Service/Exe/stdafx.h +++ b/src/api/Service/Exe/stdafx.h @@ -38,32 +38,59 @@ #include #include +#include "SWDevice.h" +#include +#include + +// Shared helpers #include "midi_ump.h" #include "midi_timestamp.h" -#include "string_util.h" +#include "wstring_util.h" + +// AbstractionUtilities +#include "endpoint_data_helpers.h" +#include "swd_property_builders.h" +#include "swd_property_helpers.h" #include "json_helpers.h" +// Main definitions +#include "MidiDefs.h" + namespace internal = ::Windows::Devices::Midi2::Internal; namespace shared = ::Windows::Devices::Midi2::Internal::Shared; -#include "MidiAbstraction.h" - #include "resource.h" #include "propkey.h" +// Abstractions. Only the Diagnostics abstraction is known to the service +// All the others are discovered through COM + #include "Midi2DiagnosticsAbstraction_i.c" #include "Midi2DiagnosticsAbstraction.h" -#include "Midi2NetworkMidiAbstraction.h" -#include "Midi2VirtualMidiAbstraction.h" -#include "Midi2KSAbstraction.h" +//#include "Midi2NetworkMidiAbstraction.h" +//#include "Midi2VirtualMidiAbstraction.h" +//#include "Midi2KSAbstraction.h" + +// Base MIDI interfaces + +#include "MidiDataFormat.h" +#include "MidiFlow.h" -#include "mididevicemanagerinterface_i.c" -#include "mididevicemanagerinterface.h" +#include "MidiAbstraction.h" +#include "MidiAbstraction_i.c" + +#include "MidiDeviceManagerInterface_i.c" +#include "MidiDeviceManagerInterface.h" #include "MidiEndpointProtocolManagerInterface_i.c" #include "MidiEndpointProtocolManagerInterface.h" +// RPC Calls + +#include "MidiSrvRpc.h" + +// Transforms #include "Midi2BS2UMPTransform.h" #include "Midi2UMP2BSTransform.h" @@ -71,20 +98,12 @@ namespace shared = ::Windows::Devices::Midi2::Internal::Shared; #include "Midi2EndpointMetadataListenerTransform.h" -#include "MidiSrvRpc.h" - -#include "SWDevice.h" -#include -#include -#include -#include "MidiDefs.h" +// MidiSrv internal classes -// need to declare this before the device manager class CMidiEndpointProtocolManager; struct GUIDCompare; class CMidiSessionTracker; - #include "MidiTelemetry.h" #include "MidiPerformanceManager.h" #include "MidiProcessManager.h" diff --git a/src/api/Service/Inc/MidiDeviceManager.h b/src/api/Service/Inc/MidiDeviceManager.h index 59ae8b2b..918b19ca 100644 --- a/src/api/Service/Inc/MidiDeviceManager.h +++ b/src/api/Service/Inc/MidiDeviceManager.h @@ -128,9 +128,11 @@ class CMidiDeviceManager : ); + // this is for runtime updates only, not for config file updates STDMETHOD(UpdateAbstractionConfiguration)( _In_ GUID AbstractionId, _In_ LPCWSTR ConfigurationJson, + _In_ BOOL IsFromConfigurationFile, _Out_ BSTR* Response ); diff --git a/src/api/Test/Libs/MidiKSEnum/MidiKSEnum.vcxproj b/src/api/Test/Libs/MidiKSEnum/MidiKSEnum.vcxproj index 8aa320cd..dbee8601 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 + 10.0.20348.0 @@ -94,28 +94,28 @@ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ diff --git a/src/api/Transform/ByteStreamToUMP/Midi2.BS2UMPTransform.vcxproj b/src/api/Transform/ByteStreamToUMP/Midi2.BS2UMPTransform.vcxproj index db4d7a9d..ebdb15cf 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.22621.0 + 10.0.20348.0 diff --git a/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj b/src/api/Transform/EndpointMetadataListenerTransform/Midi2.EndpointMetadataListenerTransform.vcxproj index f3db27e2..35514a94 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.22621.0 + 10.0.20348.0 Midi2.EndpointMetadataListenerTransform diff --git a/src/api/Transform/EndpointMetadataListenerTransform/pch.h b/src/api/Transform/EndpointMetadataListenerTransform/pch.h index 0b152d43..22dfed73 100644 --- a/src/api/Transform/EndpointMetadataListenerTransform/pch.h +++ b/src/api/Transform/EndpointMetadataListenerTransform/pch.h @@ -51,7 +51,7 @@ #include "strsafe.h" -#include "string_util.h" +#include "wstring_util.h" #include "plugin_defs.h" #include "midi_timestamp.h" #include "midi_ump.h" diff --git a/src/api/Transform/JitterReductionGeneratorTransform/Midi2.JitterReductionGeneratorTransform.vcxproj b/src/api/Transform/JitterReductionGeneratorTransform/Midi2.JitterReductionGeneratorTransform.vcxproj index 73e7c916..128853fc 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.22621.0 + 10.0.20348.0 Midi2.JitterReductionGeneratorTransform diff --git a/src/api/Transform/JitterReductionGeneratorTransform/pch.h b/src/api/Transform/JitterReductionGeneratorTransform/pch.h index de42743a..044bde17 100644 --- a/src/api/Transform/JitterReductionGeneratorTransform/pch.h +++ b/src/api/Transform/JitterReductionGeneratorTransform/pch.h @@ -51,7 +51,7 @@ #include "strsafe.h" -#include "string_util.h" +#include "wstring_util.h" #include "plugin_defs.h" #include "midi_timestamp.h" diff --git a/src/api/Transform/JitterReductionListenerTransform/Midi2.JitterReductionListenerTransform.vcxproj b/src/api/Transform/JitterReductionListenerTransform/Midi2.JitterReductionListenerTransform.vcxproj index aa5f32b7..eaace7a3 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.22621.0 + 10.0.20348.0 Midi2.JitterReductionListenerTransform diff --git a/src/api/Transform/JitterReductionListenerTransform/pch.h b/src/api/Transform/JitterReductionListenerTransform/pch.h index ab286dd4..afb39775 100644 --- a/src/api/Transform/JitterReductionListenerTransform/pch.h +++ b/src/api/Transform/JitterReductionListenerTransform/pch.h @@ -51,7 +51,7 @@ #include "strsafe.h" -#include "string_util.h" +#include "wstring_util.h" #include "plugin_defs.h" #include "midi_timestamp.h" diff --git a/src/api/Transform/SampleTransform/Midi2.SampleTransform.vcxproj b/src/api/Transform/SampleTransform/Midi2.SampleTransform.vcxproj index d1bd17f6..b6287a98 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.22621.0 + 10.0.20348.0 diff --git a/src/api/Transform/SchedulerTransform/Midi2.SchedulerTransform.vcxproj b/src/api/Transform/SchedulerTransform/Midi2.SchedulerTransform.vcxproj index cc85304b..93e07633 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.22621.0 + 10.0.20348.0 diff --git a/src/api/Transform/UMPToByteStream/Midi2.UMP2BSTransform.vcxproj b/src/api/Transform/UMPToByteStream/Midi2.UMP2BSTransform.vcxproj index 6b15998c..058a48b7 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.22621.0 + 10.0.20348.0 @@ -95,32 +95,32 @@ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_LibraryPath_ARM64);$(WindowsSDK_LibraryPath_ARM64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ $(SolutionDir)VSFiles\$(Platform)\$(Configuration)\ - $(SolutionDir)VSFiles\intermediate\MIDI2.UMP2BSTransform\$(Platform)\$(Configuration)\ + $(SolutionDir)VSFiles\intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(WindowsSdkDir)\Testing\Development\lib\$(Platform);$(SolutionDir)\VSFiles\intermediate\midikscommon\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiksenum\$(Platform)\$(Configuration);$(SolutionDir)\VSFiles\intermediate\midiks\$(Platform)\$(Configuration);$(SolutionDir)VSFiles\intermediate\AM_MIDI2\$(Platform)\$(Configuration)\ diff --git a/src/api/idl/IDL.vcxproj b/src/api/idl/IDL.vcxproj index 320bdd1b..af6a0999 100644 --- a/src/api/idl/IDL.vcxproj +++ b/src/api/idl/IDL.vcxproj @@ -181,7 +181,9 @@ + + diff --git a/src/api/idl/IDL.vcxproj.filters b/src/api/idl/IDL.vcxproj.filters index 4a2261ae..a032869d 100644 --- a/src/api/idl/IDL.vcxproj.filters +++ b/src/api/idl/IDL.vcxproj.filters @@ -24,6 +24,12 @@ Source Files + + Source Files + + + Source Files + diff --git a/src/api/idl/MidiAbstraction.idl b/src/api/idl/MidiAbstraction.idl index 547b1c0a..80137432 100644 --- a/src/api/idl/MidiAbstraction.idl +++ b/src/api/idl/MidiAbstraction.idl @@ -6,8 +6,15 @@ // Further information: https://github.com/microsoft/MIDI/ // ============================================================================ -import "unknwn.idl"; -import "mididevicemanagerinterface.idl"; +//import "unknwn.idl"; + +import "oaidl.idl"; +import "ocidl.idl"; + + +import "MidiDataFormat.idl"; +import "MidiFlow.idl"; +import "MidiDeviceManagerInterface.idl"; typedef struct { @@ -201,6 +208,7 @@ interface IMidiAbstractionConfigurationManager : IUnknown HRESULT UpdateConfiguration( [in] LPCWSTR configurationJsonSection, + [in] BOOL IsFromConfigurationFile, [out] BSTR* response ); diff --git a/src/api/idl/MidiDataFormat.idl b/src/api/idl/MidiDataFormat.idl new file mode 100644 index 00000000..8a675a19 --- /dev/null +++ b/src/api/idl/MidiDataFormat.idl @@ -0,0 +1,15 @@ +// 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/ +// ============================================================================ + +typedef enum +{ + MidiDataFormat_Invalid = 0, + MidiDataFormat_ByteStream = 0x1, + MidiDataFormat_UMP = 0x2, + MidiDataFormat_Any = 0x3 +} MidiDataFormat; diff --git a/src/api/idl/MidiDeviceManagerInterface.idl b/src/api/idl/MidiDeviceManagerInterface.idl index 74bce633..007d51d9 100644 --- a/src/api/idl/MidiDeviceManagerInterface.idl +++ b/src/api/idl/MidiDeviceManagerInterface.idl @@ -9,20 +9,8 @@ import "unknwn.idl"; -typedef enum -{ - MidiFlowIn = 0, - MidiFlowOut, - MidiFlowBidirectional -} MidiFlow; - -typedef enum -{ - MidiDataFormat_Invalid = 0, - MidiDataFormat_ByteStream = 0x1, - MidiDataFormat_UMP = 0x2, - MidiDataFormat_Any = 0x3 -} MidiDataFormat; +import "MidiFlow.idl"; +import "MidiDataFormat.idl"; [ object, @@ -80,10 +68,11 @@ interface IMidiDeviceManagerInterface : IUnknown ); - // Update the running configuration for an abstraction or endpoints managed by that abstraction + // Update the configuration for an abstraction or endpoints managed by that abstraction HRESULT UpdateAbstractionConfiguration( [in] GUID AbstractionId, [in] LPCWSTR ConfigurationJson, + [in] BOOL IsFromConfigurationFile, [out] BSTR* Response ); diff --git a/src/api/idl/MidiEndpointProtocolManagerInterface.idl b/src/api/idl/MidiEndpointProtocolManagerInterface.idl index 3901d76e..22a3cb0f 100644 --- a/src/api/idl/MidiEndpointProtocolManagerInterface.idl +++ b/src/api/idl/MidiEndpointProtocolManagerInterface.idl @@ -11,9 +11,9 @@ import "unknwn.idl"; [ object, - local, - uuid(7a3def20-fb76-49b6-a3a0-3dcbcda8f482), - pointer_default(unique) + local, + uuid(7a3def20-fb76-49b6-a3a0-3dcbcda8f482), + pointer_default(unique) ] interface IMidiEndpointProtocolManagerInterface : IUnknown { diff --git a/src/api/idl/MidiFlow.idl b/src/api/idl/MidiFlow.idl new file mode 100644 index 00000000..b8a12e54 --- /dev/null +++ b/src/api/idl/MidiFlow.idl @@ -0,0 +1,14 @@ +// 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/ +// ============================================================================ + +typedef enum +{ + MidiFlowIn = 0, + MidiFlowOut, + MidiFlowBidirectional +} MidiFlow; \ No newline at end of file diff --git a/src/oob-setup/api-package/WindowsMidiServices.wxs b/src/oob-setup/api-package/WindowsMidiServices.wxs index 750eba14..2bedecfb 100644 --- a/src/oob-setup/api-package/WindowsMidiServices.wxs +++ b/src/oob-setup/api-package/WindowsMidiServices.wxs @@ -94,7 +94,7 @@ Bitness="always64" Directory="SERVICE_INSTALLFOLDER" Guid="25E35CBB-4C66-4BEB-9B03-BC2E2D99317B" - NeverOverwrite="true"> + NeverOverwrite="false"> diff --git a/src/user-tools/midi-console/Midi/Commands/Endpoint/EndpointPropertiesCommand.cs b/src/user-tools/midi-console/Midi/Commands/Endpoint/EndpointPropertiesCommand.cs index 676d24fa..961f6930 100644 --- a/src/user-tools/midi-console/Midi/Commands/Endpoint/EndpointPropertiesCommand.cs +++ b/src/user-tools/midi-console/Midi/Commands/Endpoint/EndpointPropertiesCommand.cs @@ -63,7 +63,6 @@ public override int Execute(CommandContext context, Settings settings) table.AddColumn(column1); - TableColumn column2 = new TableColumn(AnsiMarkupFormatter.FormatTableColumnHeading(Resources.Strings.PropertiesTableColumnHeaderValue)); //Console.WriteLine("Window width " + Console.WindowWidth); @@ -453,17 +452,39 @@ public override int Execute(CommandContext context, Settings settings) table.AddRow(AnsiMarkupFormatter.FormatError("No matching container found"), ""); } + // write out the properties table + + AnsiConsole.Write(table); + + if (settings.IncludeRaw) { + AnsiConsole.WriteLine(); + AnsiConsole.WriteLine("Raw properties"); + AnsiConsole.WriteLine(); + // spit out all properties by key / value in a new table + var rawPropertyTable = new Table(); - table.AddEmptyRow(); - table.AddRow(AnsiMarkupFormatter.FormatTableColumnHeading("All Raw Properties"), ""); + AnsiMarkupFormatter.SetTableBorderStyle(rawPropertyTable); - DisplayProperties(table, di.Properties); + TableColumn rawColumn1 = new TableColumn( + AnsiMarkupFormatter.FormatTableColumnHeading(Resources.Strings.PropertiesTableColumnHeaderProperty)); + + rawPropertyTable.AddColumn(rawColumn1); + + TableColumn rawColumn2 = new TableColumn( + AnsiMarkupFormatter.FormatTableColumnHeading(Resources.Strings.PropertiesTableColumnHeaderValue)); + + rawPropertyTable.AddColumn(rawColumn2); + + //rawPropertyTable.AddRow(AnsiMarkupFormatter.FormatTableColumnHeading("All Raw Properties"), ""); + + DisplayProperties(rawPropertyTable, di.Properties); + + AnsiConsole.Write(rawPropertyTable); } - AnsiConsole.Write(table); } diff --git a/src/user-tools/midi-console/Midi/Midi.csproj b/src/user-tools/midi-console/Midi/Midi.csproj index b4b4a30c..4c63474b 100644 --- a/src/user-tools/midi-console/Midi/Midi.csproj +++ b/src/user-tools/midi-console/Midi/Midi.csproj @@ -31,7 +31,7 @@ - +