diff --git a/docs/developer-how-to/how-to-install-development-builds.md b/docs/developer-how-to/how-to-install-development-builds.md index 6a56baea..06983bab 100644 --- a/docs/developer-how-to/how-to-install-development-builds.md +++ b/docs/developer-how-to/how-to-install-development-builds.md @@ -15,6 +15,10 @@ If you are a regular musician, we generally recommend you stick with what is ins > Note: The steps in this file will eventually be replaced by developer-mode settings in the MIDI Settings app. +## Enable developer mode + +In Windows Settings, you must enable developer mode. System > For Developers > + ## Install PowerShell 7 The scripts require PowerShell 7 or newer. You can install PowerShell [following these instructions](https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows). diff --git a/src/api/Inc/midi_naming.h b/src/api/Inc/midi_naming.h index 206dc433..6f37d1d5 100644 --- a/src/api/Inc/midi_naming.h +++ b/src/api/Inc/midi_naming.h @@ -122,6 +122,11 @@ namespace WindowsMidiServicesInternal::Midi1PortNaming // TEMPORARY code name = transportSuppliedEndpointName; + if (name.empty()) + { + name = blockName; + } + return truncateToWinMMLimit ? name.substr(0, MAXPNAMELEN - 1) : name; } @@ -172,15 +177,27 @@ namespace WindowsMidiServicesInternal::Midi1PortNaming return name + L" " + suffix; } - // this is the fallback + + // this is the fallback. This needs better calculation to better support block name std::wstring name; - if (blockName != parentDeviceName) + if (!transportSuppliedEndpointName.empty()) + { + if (auto pos = blockName.find(transportSuppliedEndpointName); pos != std::wstring::npos) + { + name = internal::TrimmedWStringCopy(transportSuppliedEndpointName + L" " + internal::TrimmedWStringCopy(blockName.substr(pos + transportSuppliedEndpointName.length()))); + } + else + { + name = internal::TrimmedWStringCopy(transportSuppliedEndpointName + L" " + blockName); + } + } + else if (!blockName.empty()) { - name = parentDeviceName + L" " + blockName; + name = blockName; } - else + else if (!parentDeviceName.empty()) { name = parentDeviceName; } diff --git a/src/api/Service/Exe/MidiDeviceManager.cpp b/src/api/Service/Exe/MidiDeviceManager.cpp index 41e30149..6178890f 100644 --- a/src/api/Service/Exe/MidiDeviceManager.cpp +++ b/src/api/Service/Exe/MidiDeviceManager.cpp @@ -11,6 +11,10 @@ #include "Midi2KSAggregateTransport.h" #include "Midi2KSTransport.h" #include "Midi2LoopbackMidiTransport.h" +// naming +#include "midi_naming.h" + + using namespace winrt::Windows::Devices::Enumeration; @@ -2466,8 +2470,7 @@ CMidiDeviceManager::SyncMidi1Ports( { if (portInfo[flow][groupIndex].IsEnabled && !portInfo[flow][groupIndex].InterfaceId.empty()) { - - bool useOldStyleWinMMPortNaming{ true }; // TODO: Get this from reg key and local property + bool useOldStyleWinMMPortNaming{ true }; // TODO: Get this from reg key and local property, not from being hard-coded here if (interfaceProperties.empty()) { @@ -2493,14 +2496,22 @@ CMidiDeviceManager::SyncMidi1Ports( DEVPROP_TYPE_BYTE, (ULONG)(sizeof(BYTE)), (PVOID)(&(nativeDataFormat)) }); } - //if (transportId == winrt::guid(__uuidof(Midi2KSAggregateTransport)) || - // transportId == winrt::guid(__uuidof(Midi2LoopbackMidiTransport)) || - // (transportId == winrt::guid(__uuidof(Midi2KSTransport)) && WI_IsFlagSet(nativeDataFormat, MidiDataFormats::MidiDataFormats_ByteStream))) + // TEMP! This needs to be controlled by a property + if (transportId == winrt::guid(__uuidof(Midi2KSTransport))) + { + useOldStyleWinMMPortNaming = false; + } + + // this tells us to use the GTB name, and only the GTB name, as the WinMM port name. It overrides other settings prop = deviceInfo.Properties().Lookup(STRING_PKEY_MIDI_UseGroupTerminalBlocksForExactMidi1PortNames); if (prop) { usePortInfoName = winrt::unbox_value(prop); } + else + { + usePortInfoName = false; + } prop = deviceInfo.Properties().Lookup(STRING_PKEY_MIDI_CustomEndpointName); if (prop) diff --git a/src/api/Service/Exe/stdafx.h b/src/api/Service/Exe/stdafx.h index 9a58e7ff..c958b2c7 100644 --- a/src/api/Service/Exe/stdafx.h +++ b/src/api/Service/Exe/stdafx.h @@ -80,9 +80,6 @@ namespace json = ::winrt::Windows::Data::Json; #include "WindowsMidiServices.h" -// naming -#include "midi_naming.h" - // RPC Calls #include "MidiSrvRpc.h" diff --git a/src/api/Transport/KSTransport/Midi2.KSMidiEndpointManager.cpp b/src/api/Transport/KSTransport/Midi2.KSMidiEndpointManager.cpp index cd9b3684..da880d5e 100644 --- a/src/api/Transport/KSTransport/Midi2.KSMidiEndpointManager.cpp +++ b/src/api/Transport/KSTransport/Midi2.KSMidiEndpointManager.cpp @@ -87,7 +87,7 @@ CMidi2KSMidiEndpointManager::OnDeviceAdded( TraceLoggingWideString(device.Id().c_str(), "device id") ); - DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; +// DEVPROP_BOOLEAN devPropTrue = DEVPROP_TRUE; DEVPROP_BOOLEAN devPropFalse = DEVPROP_FALSE; wil::unique_handle hFilter; @@ -621,7 +621,7 @@ CMidi2KSMidiEndpointManager::OnDeviceAdded( else if (MidiPin->NativeDataFormat == KSDATAFORMAT_SUBTYPE_MIDI) { // for a native MIDI 1 device, the driver provides a MIDI 1 port name in the GTB - // but it's just the pin (iJack) name, so we still set this to false. Change in behavior. + // but it's just the pin (iJack) name, so we still set this to false. Change in behavior from earlier when this was true. interfaceDevProperties.push_back({ { PKEY_MIDI_UseGroupTerminalBlocksForExactMidi1PortNames, DEVPROP_STORE_SYSTEM, nullptr }, DEVPROP_TYPE_BOOLEAN, static_cast(sizeof(devPropFalse)), (PVOID) & (devPropFalse) }); } diff --git a/src/app-sdk/midi1monitor/main.cpp b/src/app-sdk/midi1monitor/main.cpp index 8a8bb8ec..34ee0501 100644 --- a/src/app-sdk/midi1monitor/main.cpp +++ b/src/app-sdk/midi1monitor/main.cpp @@ -45,7 +45,7 @@ void LoadWinMMDevices() for (uint16_t i = 0; i < inputDeviceCount; i++) { - MIDIINCAPSW inputCaps{}; + MIDIINCAPSW inputCaps{ 0 }; auto result = midiInGetDevCaps(i, &inputCaps, sizeof(inputCaps)); diff --git a/src/oob-setup/api-package/WindowsMidiServices.wxs b/src/oob-setup/api-package/WindowsMidiServices.wxs index 4d4a326c..65881a31 100644 --- a/src/oob-setup/api-package/WindowsMidiServices.wxs +++ b/src/oob-setup/api-package/WindowsMidiServices.wxs @@ -84,7 +84,7 @@ - + - +