Skip to content

Commit 7a852b9

Browse files
committed
Also fix names of UWP output devices when there's two or more of the same kind attached.
1 parent 1e5b499 commit 7a852b9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

RtMidi.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -3441,14 +3441,15 @@ std::vector<UWPMidiClass::port> UWPMidiClass::list_ports(winrt::hstring device_s
34413441
return retval;
34423442
}
34433443

3444-
// Fix MIDI OUT port names starting with `MIDI` to MIDI IN port names with similar ID strings
3444+
// Fix MIDI OUT port names starting with `MIDI` or `2 - MIDI` to MIDI IN port names with similar ID strings
34453445
void UWPMidiClass::fix_display_name(const std::vector<port>& in_ports,
34463446
std::vector<port>& out_ports)
34473447
{
34483448
for (auto& outp : out_ports)
34493449
{
3450-
if (outp.hex_id.empty() ||
3451-
std::string_view{ outp.name }.substr(0, 4) != "MIDI")
3450+
if (outp.hex_id.empty())
3451+
continue;
3452+
if (std::string_view{ outp.name }.substr(0, 4) != "MIDI" && std::string_view{ outp.name }.substr(1, 7) != " - MIDI")
34523453
continue;
34533454

34543455
for (const auto& inp : in_ports)

0 commit comments

Comments
 (0)