Skip to content

Commit

Permalink
Merge pull request #519 from microsoft/pete-dev
Browse files Browse the repository at this point in the history
Pete dev sync to main for wdmaud2 specifically
  • Loading branch information
Psychlist1972 authored Feb 7, 2025
2 parents 8ca72dd + 9ca6d3e commit 86ecf1d
Show file tree
Hide file tree
Showing 51 changed files with 691 additions and 237 deletions.
4 changes: 2 additions & 2 deletions build/nuke_build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Build : NukeBuild


//string VersionName => "Developer Preview 9";
string VersionName => "Customer Preview 1";
string NuGetVersionName => "preview-10";
string VersionName => "Customer Preview 2";
string NuGetVersionName => "preview-11";

// we set these here, especially the time, so it's the same for all platforms in the single build

Expand Down
4 changes: 2 additions & 2 deletions build/staging/version/BundleInfo.wxi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Include>
<?define SetupVersionName="Customer Preview 1 Arm64" ?>
<?define SetupVersionNumber="1.0.3-preview-10.250204-1909" ?>
<?define SetupVersionName="Customer Preview 2 Arm64" ?>
<?define SetupVersionNumber="1.0.3-preview-11.250206-2105" ?>
</Include>
8 changes: 4 additions & 4 deletions build/staging/version/WindowsMidiServicesVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ namespace Microsoft.Midi.Common
public static class MidiBuildInformation
{
public const string Source = "GitHub Preview";
public const string Name = "Customer Preview 1";
public const string BuildFullVersion = "1.0.3-preview-10.250204-1909";
public const string Name = "Customer Preview 2";
public const string BuildFullVersion = "1.0.3-preview-11.250206-2105";
public const string VersionMajor = "1";
public const string VersionMinor = "0";
public const string VersionRevision = "3";
public const string VersionDateNumber = "250204";
public const string VersionTimeNumber = "1909";
public const string VersionDateNumber = "250206";
public const string VersionTimeNumber = "2105";
}
}

8 changes: 4 additions & 4 deletions build/staging/version/WindowsMidiServicesVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#define WINDOWS_MIDI_SERVICES_VERSION_INCLUDE

#define WINDOWS_MIDI_SERVICES_BUILD_SOURCE L"GitHub Preview"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME L"Customer Preview 1"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L"1.0.3-preview-10.250204-1909"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_NAME L"Customer Preview 2"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_FULL L"1.0.3-preview-11.250206-2105"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MAJOR L"1"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_MINOR L"0"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_REVISION L"3"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_DATE_NUMBER L"250204"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L"1909"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_DATE_NUMBER L"250206"
#define WINDOWS_MIDI_SERVICES_BUILD_VERSION_TIME_NUMBER L"2105"

#endif

2 changes: 1 addition & 1 deletion samples/cpp-winrt/basics/client-basics-cpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250204-1909</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250206-2105</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>false</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/basics/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-10.250204-1909" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250206-2105" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250204-1909</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250206-2105</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/loopback-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-10.250204-1909" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250206-2105" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion samples/cpp-winrt/send-speed/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-10.250204-1909" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250206-2105" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion samples/cpp-winrt/send-speed/send-speed-cpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250204-1909</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250206-2105</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/simple-app-to-app-midi/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-10.250204-1909" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250206-2105" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250204-1909</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250206-2105</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/static-enum-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-10.250204-1909" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250206-2105" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250204-1909</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250206-2105</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp-winrt/watch-endpoints/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.240405.15" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-10.250204-1909" targetFramework="native" />
<package id="Microsoft.Windows.Devices.Midi2" version="1.0.3-preview-11.250206-2105" targetFramework="native" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.240405.15\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-10.250204-1909</WindowsMidiServicesSdkPackage>
<WindowsMidiServicesSdkPackage>Microsoft.Windows.Devices.Midi2.1.0.3-preview-11.250206-2105</WindowsMidiServicesSdkPackage>
<CppWinRTOptimized>true</CppWinRTOptimized>
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
Expand Down
8 changes: 4 additions & 4 deletions src/api/Client/WinMM/MidiSrvPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,20 +465,19 @@ CMidiPort::Callback(_In_ PVOID data, _In_ UINT size, _In_ LONGLONG position, LON
while(callbackDataRemaining > 0 &&
(buffer->dwBytesRecorded < buffer->dwBufferLength))
{
if(0 != (*callbackData & MIDI_STATUSBYTEFILTER))
if (0 != (*callbackData & MIDI_STATUSBYTEFILTER))
{
// this is a status byte message, we're going to need some additional checks.

// we're in a sysex block and somehow received a normal midi message,
// that's an error, complete the sysex and exit out of processing sysex.
if(MIDI_EOX != *callbackData &&
(*callbackData & MIDI_STATUSBYTEFILTER) < MIDI_SYSEX)
if (*callbackData < MIDI_SYSEX)
{
RETURN_IF_FAILED(CompleteLongBuffer(MIM_LONGERROR, position));
m_IsInSysex = false;
break;
}
else if(MIDI_SYSTEM_REALTIME_FILTER != (*callbackData & MIDI_SYSTEM_REALTIME_FILTER))
else if (MIDI_SYSTEM_REALTIME_FILTER != (*callbackData & MIDI_SYSTEM_REALTIME_FILTER))
{
// a sys-ex block is supposed to end with a MIDI_EOX, however
// any valid MIDI status byte CAN end a sys-ex block EXCEPT
Expand Down Expand Up @@ -569,6 +568,7 @@ CMidiPort::Callback(_In_ PVOID data, _In_ UINT size, _In_ LONGLONG position, LON
callbackDataRemaining-=3;
dataWritten = true;
}

// if it's not a message with a status byte, it should be
// running status, which requires 2 bytes, and our running
// status should be valid.
Expand Down
11 changes: 11 additions & 0 deletions src/api/Client/WinMM/MidiSrvPorts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

using unique_hdevinfo = wil::unique_any_handle_invalid<decltype(&::SetupDiDestroyDeviceInfoList), ::SetupDiDestroyDeviceInfoList>;

// via https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#define HINST_WDMAUD2 ((HINSTANCE)&__ImageBase)


CMidiPorts::CMidiPorts()
{
TraceLoggingWrite(
Expand Down Expand Up @@ -388,10 +393,16 @@ CMidiPorts::GetDevCaps(MidiFlow flow, UINT portNumber, DWORD_PTR midiCaps)
if (MidiFlowIn == flow)
{
memset((PVOID) midiCaps, 0, sizeof(MIDIINCAPSW));

// set the default name in case the port is not active. Some apps ignore the hresult
::LoadStringW(HINST_WDMAUD2, IDS_MIDI_UNAVAILABLE_ENDPOINT, ((MIDIINCAPSW*)midiCaps)->szPname, MAXPNAMELEN);
}
else
{
memset((PVOID) midiCaps, 0, sizeof(MIDIOUTCAPSW));

// set the default name in case the port is not active. Some apps ignore the hresult
::LoadStringW(HINST_WDMAUD2, IDS_MIDI_UNAVAILABLE_ENDPOINT, ((MIDIOUTCAPSW*)midiCaps)->szPname, MAXPNAMELEN);
}

auto lock = m_Lock.lock();
Expand Down
2 changes: 2 additions & 0 deletions src/api/Client/WinMM/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#define IDS_SUBMIXER_CDLINE_SHORT 111
#define IDS_SUBMIXER_CDLINE_LONG 112

#define IDS_MIDI_UNAVAILABLE_ENDPOINT 200

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
Expand Down
2 changes: 2 additions & 0 deletions src/api/Client/WinMM/winmmdrv.rc
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@ BEGIN
IDS_SUBMIXER_VOLUME_LONG "Volume"
IDS_SUBMIXER_MUTE_SHORT "Mute"
IDS_SUBMIXER_MUTE_LONG "Mute"

IDS_MIDI_UNAVAILABLE_ENDPOINT "(unavailable)"
END

Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ _Use_decl_annotations_
HRESULT
CMidi2NetworkMidiConfigurationManager::Initialize(
GUID transportId,
IMidiDeviceManagerInterface* midiDeviceManager,
IMidiServiceConfigurationManagerInterface* midiServiceConfigurationManagerInterface
IMidiDeviceManager* midiDeviceManager,
IMidiServiceConfigurationManager* midiServiceConfigurationManager
)
{
UNREFERENCED_PARAMETER(transportId);
UNREFERENCED_PARAMETER(midiServiceConfigurationManagerInterface);
UNREFERENCED_PARAMETER(midiServiceConfigurationManager);


TraceLoggingWrite(
Expand All @@ -32,7 +32,7 @@ CMidi2NetworkMidiConfigurationManager::Initialize(
);

RETURN_HR_IF_NULL(E_INVALIDARG, midiDeviceManager);
RETURN_IF_FAILED(midiDeviceManager->QueryInterface(__uuidof(IMidiDeviceManagerInterface), (void**)&m_midiDeviceManager));
RETURN_IF_FAILED(midiDeviceManager->QueryInterface(__uuidof(IMidiDeviceManager), (void**)&m_midiDeviceManager));

return S_OK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class CMidi2NetworkMidiConfigurationManager :

{
public:
STDMETHOD(Initialize(_In_ GUID transportId, _In_ IMidiDeviceManagerInterface* midiDeviceManager, _In_ IMidiServiceConfigurationManagerInterface* midiServiceConfigurationManagerInterface));
STDMETHOD(Initialize(_In_ GUID transportId, _In_ IMidiDeviceManager* midiDeviceManager, _In_ IMidiServiceConfigurationManager* midiServiceConfigurationManager));
STDMETHOD(UpdateConfiguration(_In_ LPCWSTR configurationJsonSection, _Out_ LPWSTR* Response));
STDMETHOD(Shutdown)();

STDMETHOD(ValidateHostDefinition(_In_ MidiNetworkHostDefinition& definition, _Out_ winrt::hstring& errorMessage));
// STDMETHOD(ValidateClientDefinition(_In_ MidiNetworkUdpClientDefinition& definition));

private:
wil::com_ptr_nothrow<IMidiDeviceManagerInterface> m_midiDeviceManager;
wil::com_ptr_nothrow<IMidiDeviceManager> m_midiDeviceManager;

};
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ using namespace Microsoft::WRL::Wrappers;
_Use_decl_annotations_
HRESULT
CMidi2NetworkMidiEndpointManager::Initialize(
IMidiDeviceManagerInterface* midiDeviceManager,
IMidiEndpointProtocolManagerInterface* midiEndpointProtocolManager
IMidiDeviceManager* midiDeviceManager,
IMidiEndpointProtocolManager* midiEndpointProtocolManager
)
{
TraceLoggingWrite(
Expand All @@ -35,8 +35,8 @@ CMidi2NetworkMidiEndpointManager::Initialize(

RETURN_HR_IF(E_INVALIDARG, nullptr == midiDeviceManager);

RETURN_IF_FAILED(midiDeviceManager->QueryInterface(__uuidof(IMidiDeviceManagerInterface), (void**)&m_midiDeviceManager));
RETURN_IF_FAILED(midiEndpointProtocolManager->QueryInterface(__uuidof(IMidiEndpointProtocolManagerInterface), (void**)&m_midiProtocolManager));
RETURN_IF_FAILED(midiDeviceManager->QueryInterface(__uuidof(IMidiDeviceManager), (void**)&m_midiDeviceManager));
RETURN_IF_FAILED(midiEndpointProtocolManager->QueryInterface(__uuidof(IMidiEndpointProtocolManager), (void**)&m_midiProtocolManager));

m_transportId = TRANSPORT_LAYER_GUID; // this is needed so MidiSrv can instantiate the correct transport
m_containerId = m_transportId; // we use the transport ID as the container ID for convenience
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CMidi2NetworkMidiEndpointManager :

{
public:
STDMETHOD(Initialize(_In_ IMidiDeviceManagerInterface*, _In_ IMidiEndpointProtocolManagerInterface*));
STDMETHOD(Initialize(_In_ IMidiDeviceManager*, _In_ IMidiEndpointProtocolManager*));
STDMETHOD(Shutdown)();

STDMETHOD(InitiateDiscoveryAndNegotiation(_In_ std::wstring const& endpointDeviceInterfaceId));
Expand Down Expand Up @@ -64,8 +64,8 @@ class CMidi2NetworkMidiEndpointManager :

HRESULT CreateParentDevice();

wil::com_ptr_nothrow<IMidiDeviceManagerInterface> m_midiDeviceManager;
wil::com_ptr_nothrow<IMidiEndpointProtocolManagerInterface> m_midiProtocolManager;
wil::com_ptr_nothrow<IMidiDeviceManager> m_midiDeviceManager;
wil::com_ptr_nothrow<IMidiEndpointProtocolManager> m_midiProtocolManager;


std::jthread m_backgroundEndpointCreatorThread;
Expand Down
Loading

0 comments on commit 86ecf1d

Please sign in to comment.