Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hanging service #396

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/nuke_build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void UpdateSetupBundleInfoIncludeFile(string platform)
.SetPublishTrimmed(false)
.SetSelfContained(false)
.SetRuntime(rid)
.AddNoWarns(618) // ignore CS0618 which I have no control over because it's in projection assemblies
.AddNoWarns(8618) // ignore CS8618 which I have no control over because it's in projection assemblies
);

// This just doesn't work. Even in Visual Studio, publishing the WinAppSdk app just fails for "unknown" reasons.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/staging/app-sdk/Arm64EC/mididiag.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion build/staging/version/BundleInfo.wxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Include>
<?define SetupVersionName="Developer Preview 7 Arm64" ?>
<?define SetupVersionNumber="1.0.24257.1727" ?>
<?define SetupVersionNumber="1.0.24260.2134" ?>
</Include>
2 changes: 1 addition & 1 deletion samples/csharp-net/basics/client-basics-cs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.3" />
<PackageReference Include="Microsoft.Windows.Devices.Midi2" Version="1.0.24257.1727-preview.7" />
<PackageReference Include="Microsoft.Windows.Devices.Midi2" Version="1.0.24259.2038-preview.7" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 7 additions & 4 deletions samples/csharp-net/virtual-device-app-winui/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ private void OnMidiMessageReceived(IMidiMessageReceivedEventSource sender, MidiM

private void OnStreamConfigurationRequestReceived(MidiVirtualDevice sender, MidiStreamConfigRequestReceivedEventArgs args)
{


System.Diagnostics.Debug.WriteLine("Stream configuration request received");
}


Expand All @@ -164,9 +163,9 @@ MidiVirtualDeviceCreationConfig DefineDevice()
string userSuppliedName = "Pad Controller App";
string userSuppliedDescription = "My favorite demo app for Windows MIDI Services";

string transportSuppliedName = "Contoso Pad Controller 1.0";
string transportSuppliedName = "Pad Controller";
string transportSuppliedDescription = "A sample app-to-app MIDI virtual device";
string transportSuppliedManufacturerName = "Constoso, Inc.";
string transportSuppliedManufacturerName = "Constoso";

string endpointSuppliedName = transportSuppliedName;

Expand All @@ -186,6 +185,7 @@ MidiVirtualDeviceCreationConfig DefineDevice()
declaredEndpointInfo.SupportsReceivingJitterReductionTimestamps = false;
declaredEndpointInfo.SupportsSendingJitterReductionTimestamps = false;
declaredEndpointInfo.HasStaticFunctionBlocks = true;


var declaredDeviceIdentity = new MidiDeclaredDeviceIdentity() ;
// todo: set any device identity values if you want. This is optional
Expand All @@ -205,6 +205,9 @@ MidiVirtualDeviceCreationConfig DefineDevice()

);

// if set to true, WinMM / WinRT MIDI 1.0 backwards-compat endpoints won't be created
config.CreateOnlyUmpEndpoints = false;

// Function blocks. The MIDI 2 UMP specification covers the meanings
// of these values
var block1 = new MidiFunctionBlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.3" />
<PackageReference Include="Microsoft.Windows.Devices.Midi2" Version="1.0.24257.1727-preview.7" />
<PackageReference Include="Microsoft.Windows.Devices.Midi2" Version="1.0.24259.2038-preview.7" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240829007" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<PackageReference Include="WinUIEx" Version="2.4.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ CMidi2DiagnosticsEndpointManager::CreateLoopbackEndpoint(

std::vector<DEVPROPERTY> interfaceDeviceProperties{};

bool requiresMetadataHandler = true;
//bool requiresMetadataHandler = true;
bool multiClient = true;

// do not generate incoming (from device) timestamps automatically.
Expand Down Expand Up @@ -163,7 +163,7 @@ CMidi2DiagnosticsEndpointManager::CreateLoopbackEndpoint(
commonProperties.SupportedDataFormats = MidiDataFormat::MidiDataFormat_UMP;
commonProperties.NativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP;
commonProperties.SupportsMultiClient = multiClient;
commonProperties.RequiresMetadataHandler = requiresMetadataHandler;
//commonProperties.RequiresMetadataHandler = requiresMetadataHandler;
commonProperties.GenerateIncomingTimestamps = generateIncomingTimestamps;
commonProperties.ManufacturerName = TRANSPORT_MANUFACTURER;
commonProperties.SupportsMidi1ProtocolDefaultValue = true;
Expand Down Expand Up @@ -250,7 +250,7 @@ CMidi2DiagnosticsEndpointManager::CreatePingEndpoint(
commonProperties.SupportedDataFormats = MidiDataFormat::MidiDataFormat_UMP;
commonProperties.NativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP;
commonProperties.SupportsMultiClient = multiClient;
commonProperties.RequiresMetadataHandler = false;
//commonProperties.RequiresMetadataHandler = false;
commonProperties.GenerateIncomingTimestamps = generateIncomingTimestamps;
commonProperties.ManufacturerName = TRANSPORT_MANUFACTURER;
commonProperties.SupportsMidi1ProtocolDefaultValue = false;
Expand Down
14 changes: 12 additions & 2 deletions src/api/Abstraction/KSAbstraction/Midi2.KSMidiEndpointManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ CMidi2KSMidiEndpointManager::OnDeviceAdded(
// These properties were originally meant only for the results of protocol negotiation, but they were confusing when not set

commonProperties.NativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP;
commonProperties.RequiresMetadataHandler = true;
//commonProperties.RequiresMetadataHandler = true;
commonProperties.SupportsMidi1ProtocolDefaultValue = true;
commonProperties.SupportsMidi2ProtocolDefaultValue = true;
}
Expand All @@ -609,7 +609,7 @@ CMidi2KSMidiEndpointManager::OnDeviceAdded(
// These properties were originally meant only for the results of protocol negotiation, but they were confusing when not set

commonProperties.NativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_BYTESTREAM;
commonProperties.RequiresMetadataHandler = false;
//commonProperties.RequiresMetadataHandler = false;
commonProperties.SupportsMidi1ProtocolDefaultValue = true;
commonProperties.SupportsMidi2ProtocolDefaultValue = false;
}
Expand Down Expand Up @@ -840,6 +840,16 @@ HRESULT CMidi2KSMidiEndpointManager::OnDeviceRemoved(DeviceWatcher, DeviceInform
{
if (device.Id() == Pin->Id)
{
TraceLoggingWrite(
MidiKSAbstractionTelemetryProvider::Provider(),
MIDI_TRACE_EVENT_INFO,
TraceLoggingString(__FUNCTION__, MIDI_TRACE_EVENT_LOCATION_FIELD),
TraceLoggingLevel(WINEVENT_LEVEL_INFO),
TraceLoggingPointer(this, "this"),
TraceLoggingWideString(L"Removing endpoint / pin entry", MIDI_TRACE_EVENT_MESSAGE_FIELD),
TraceLoggingWideString(device.Id().c_str(), "device id")
);

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CMidi2KSAggregateMidiEndpointManager::CreateMidiUmpEndpoint(
commonProperties.GenerateIncomingTimestamps = true;

commonProperties.NativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_BYTESTREAM;
commonProperties.RequiresMetadataHandler = false;
//commonProperties.RequiresMetadataHandler = false;
commonProperties.SupportsMidi1ProtocolDefaultValue = true;
commonProperties.SupportsMidi2ProtocolDefaultValue = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ CMidi2LoopbackMidiConfigurationManager::UpdateConfiguration(
definitionA->EndpointDescription = endpointAObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, L"");
definitionA->EndpointUniqueIdentifier = endpointAObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, L"");
definitionA->InstanceIdPrefix = instanceIdPrefixA;
definitionA->UMPOnly = endpointAObject.GetNamedBoolean(MIDI_CONFIG_JSON_ENDPOINT_COMMON_UMP_ONLY_PROPERTY, false);


definitionB->EndpointName = endpointBObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_NAME_PROPERTY, L"");
definitionB->EndpointDescription = endpointBObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_DESCRIPTION_PROPERTY, L"");
definitionB->EndpointUniqueIdentifier = endpointBObject.GetNamedString(MIDI_CONFIG_JSON_ENDPOINT_COMMON_UNIQUE_ID_PROPERTY, L"");
definitionB->InstanceIdPrefix = instanceIdPrefixB;
definitionB->UMPOnly = endpointBObject.GetNamedBoolean(MIDI_CONFIG_JSON_ENDPOINT_COMMON_UMP_ONLY_PROPERTY, false);


if (definitionA->EndpointName.empty() || definitionB->EndpointName.empty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ CMidi2LoopbackMidiEndpointManager::CreateSingleEndpoint(
std::wstring friendlyName = internal::CalculateEndpointDevicePrimaryName(endpointName, L"", L"");


bool requiresMetadataHandler = false;
//bool requiresMetadataHandler = false;
bool multiClient = true;
bool generateIncomingTimestamps = true;

Expand Down Expand Up @@ -258,7 +258,7 @@ CMidi2LoopbackMidiEndpointManager::CreateSingleEndpoint(
commonProperties.SupportedDataFormats = MidiDataFormat::MidiDataFormat_UMP;
commonProperties.NativeDataFormat = MIDI_PROP_NATIVEDATAFORMAT_UMP;
commonProperties.SupportsMultiClient = multiClient;
commonProperties.RequiresMetadataHandler = requiresMetadataHandler;
//commonProperties.RequiresMetadataHandler = requiresMetadataHandler;
commonProperties.GenerateIncomingTimestamps = generateIncomingTimestamps;
commonProperties.ManufacturerName = TRANSPORT_MANUFACTURER;
commonProperties.SupportsMidi1ProtocolDefaultValue = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ struct MidiLoopbackDeviceDefinition

std::wstring CreatedShortClientInstanceId{};
std::wstring CreatedEndpointInterfaceId{};

bool UMPOnly{ false };
};
8 changes: 7 additions & 1 deletion src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvBiDi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ CMidi2MidiSrvBiDi::SendMidiMessage(
{
if (m_MidiSrv)
{
return m_MidiSrv->SendMidiMessage(Data, Length, Position);
//return m_MidiSrv->SendMidiMessage(Data, Length, Position);

auto hr = m_MidiSrv->SendMidiMessage(Data, Length, Position);
LOG_IF_FAILED(hr);

return hr;

}

return E_ABORT;
Expand Down
5 changes: 4 additions & 1 deletion src/api/Abstraction/MidiSrvAbstraction/Midi2.MidiSrvOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ CMidi2MidiSrvOut::SendMidiMessage(
{
if (m_MidiSrv)
{
return m_MidiSrv->SendMidiMessage(Data, Length, Position);
auto hr = m_MidiSrv->SendMidiMessage(Data, Length, Position);
LOG_IF_FAILED(hr);

return hr;
}

return E_ABORT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ CMidi2VirtualMidiAbstraction::Activate(

);

return E_NOINTERFACE;
RETURN_IF_FAILED(E_NOINTERFACE);
}

return S_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
<ClInclude Include="Midi2.VirtualMidiEndpointManager.h" />
<ClInclude Include="Midi2.VirtualMidiPluginMetadataProvider.h" />
<ClInclude Include="MidiEndpointTable.h" />
<ClInclude Include="MidiVirtualDeviceEndpointEntry.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Resource.h" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
<ClInclude Include="Midi2.VirtualMidiPluginMetadataProvider.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MidiVirtualDeviceEndpointEntry.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Midi2.VirtualMidiAbstraction.rc">
Expand Down
Loading