Skip to content

Commit

Permalink
name update to fix empty names
Browse files Browse the repository at this point in the history
  • Loading branch information
Psychlist1972 committed Feb 17, 2025
1 parent 2c1ae03 commit 593ce15
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/api/Inc/midi_naming.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ namespace WindowsMidiServicesInternal::Midi1PortNaming
// TEMPORARY code
name = transportSuppliedEndpointName;

if (name.empty())
{
name = blockName;
}


return truncateToWinMMLimit ? name.substr(0, MAXPNAMELEN - 1) : name;
}
Expand Down Expand Up @@ -172,17 +177,18 @@ namespace WindowsMidiServicesInternal::Midi1PortNaming
return name + L" " + suffix;
}


// this is the fallback

std::wstring name;

if (blockName != parentDeviceName)
if (!transportSuppliedEndpointName.empty() && blockName != transportSuppliedEndpointName)
{
name = parentDeviceName + L" " + blockName;
name = internal::TrimmedWStringCopy(transportSuppliedEndpointName + L" " + blockName);
}
else
{
name = parentDeviceName;
name = transportSuppliedEndpointName;
}

return truncateToWinMMLimit ? name.substr(0, MAXPNAMELEN - 1) : name;
Expand Down
8 changes: 8 additions & 0 deletions src/api/Service/Exe/MidiDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include "Midi2KSAggregateTransport.h"
#include "Midi2KSTransport.h"
#include "Midi2LoopbackMidiTransport.h"
// naming
#include "midi_naming.h"



using namespace winrt::Windows::Devices::Enumeration;

Expand Down Expand Up @@ -2504,6 +2508,10 @@ CMidiDeviceManager::SyncMidi1Ports(
{
usePortInfoName = winrt::unbox_value<bool>(prop);
}
else
{
usePortInfoName = false;
}

prop = deviceInfo.Properties().Lookup(STRING_PKEY_MIDI_CustomEndpointName);
if (prop)
Expand Down
3 changes: 0 additions & 3 deletions src/api/Service/Exe/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ namespace json = ::winrt::Windows::Data::Json;

#include "WindowsMidiServices.h"

// naming
#include "midi_naming.h"

// RPC Calls

#include "MidiSrvRpc.h"
Expand Down

0 comments on commit 593ce15

Please sign in to comment.