Skip to content

Commit

Permalink
Tweak MIDI 1 port names to only use the I/O-GroupIndex suffix when a …
Browse files Browse the repository at this point in the history
…native UMP device
  • Loading branch information
Psychlist1972 committed Feb 8, 2025
1 parent 9385084 commit 45a07a8
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/api/Service/Exe/MidiDeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2529,15 +2529,31 @@ CMidiDeviceManager::SyncMidi1Ports(
friendlyName = baseFriendlyName;
}

// append the flow(Input or Output) & group number (group index + 1) to the friendly name.
if (MidiFlowIn == (MidiFlow) flow)

// if the device is a new MIDI 2 device, we'll add the group number. Otherwise, we'll leave
// off the differentiator. This is in testing with community. If you still see this in
// after the Canary period ends, then this was preferred :)
//
// The next step if this doesn't work is to see if the name is already used, and then
// add the differentiator only in that case.

if (nativeDataFormat == MidiDataFormats::MidiDataFormats_UMP)
{
friendlyName = friendlyName + L" I-" + std::to_wstring(groupIndex+1);
// append the flow(Input or Output) & group number (group index + 1) to the friendly name.
if (MidiFlowIn == (MidiFlow)flow)
{
friendlyName = friendlyName + L" I-" + std::to_wstring(groupIndex + 1);
}
else
{
friendlyName = friendlyName + L" O-" + std::to_wstring(groupIndex + 1);
}
}
else
{
friendlyName = friendlyName + L" O-" + std::to_wstring(groupIndex+1);
// native bytestream port. Leaving off the differentiator for now per Canary note above.
}

interfaceProperties.push_back(DEVPROPERTY{ {DEVPKEY_DeviceInterface_FriendlyName, DEVPROP_STORE_SYSTEM, nullptr},
DEVPROP_TYPE_STRING, (ULONG)(sizeof(wchar_t) * (wcslen(friendlyName.c_str()) + 1)), (PVOID)friendlyName.c_str() });

Expand Down

0 comments on commit 45a07a8

Please sign in to comment.