Skip to content

Commit d5be00d

Browse files
committed
winmidi: port info: set product & serial
1 parent eccce47 commit d5be00d

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

include/libremidi/backends/winmidi/observer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ class observer_impl final
114114
.device = to_string(p.EndpointDeviceId()),
115115
.port = gp.Number(),
116116
.manufacturer = to_string(tinfo.ManufacturerName),
117+
.product = to_string(tinfo.Name),
118+
.serial = to_string(tinfo.SerialNumber),
117119
.device_name = to_string(p.Name()),
118120
.port_name = to_string(gp.Name()),
119121
.display_name = to_string(gp.Name()) + " " + std::to_string(gp.Number()),

include/libremidi/observer_configuration.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,35 @@ struct LIBREMIDI_EXPORT port_information
2424
// ALSA Raw: unused
2525
// ALSA Seq: snd_seq_t*
2626
// CoreMIDI: MidiClientRef
27-
// WebMIDI: unused
2827
// JACK: jack_client_t*
2928
// PipeWire: unused // FIXME: pw_context? pw_main_loop?
29+
// WebMIDI: unused
3030
// WinMIDI: TODO
3131
// WinMM: unused
3232
// WinUWP: unused
3333
client_handle client = static_cast<client_handle>(-1);
3434

3535
/// Container identifier if the API provides one
36-
// WinMIDI: ContainerID GUID (bit_cast to a winapi or winrt::GUID ;
37-
// this is not the string but the binary representation).
3836
// ALSA: device id (std::string), e.g. ID_PATH as returned by udev: "pci-0000:00:14.0-usb-0:12:1.0"
3937
// CoreMIDI: USBLocationID (int32_t)
38+
// WinMIDI: ContainerID GUID (bit_cast to a winapi or winrt::GUID ;
39+
// this is not the string but the binary representation).
4040
container_identifier container = std::monostate{};
4141

4242
/// Device identifier if the API provides one
43-
// WinMM: MIDI{IN,OUT}CAPS mId / pId { uint16_t manufacturer_id, uint16_t product_id; }
44-
// WinMIDI: EndpointDeviceId (std::string), e.g. "\\?\swd#midisrv#midiu_ksa..."
4543
// ALSA: sysfs path (std::string), e.g. "/sys/devices/pci0000:00/0000:00:02.2/0000:02:00.0/sound/card0/controlC0"
4644
// CoreMIDI: USBVendorProduct (int32_t)
45+
// WinMIDI: EndpointDeviceId (std::string), e.g. "\\?\swd#midisrv#midiu_ksa..."
46+
// WinMM: MIDI{IN,OUT}CAPS mId / pId { uint16_t manufacturer_id, uint16_t product_id; }
4747
device_identifier device = std::monostate{};
4848

4949
/// Handle to the port identifier if the API provides one
5050
// ALSA Raw: bit_cast to struct { uint16_t card, device, sub, padding; }.
5151
// ALSA Seq: bit_cast to struct { uint32_t client, port; }
5252
// CoreMIDI: MidiObjectRef's kMIDIPropertyUniqueID (uint32_t)
53-
// WebMIDI: index of the MIDI device in the list provided by the browser.
5453
// JACK: jack_port_id_t
5554
// PipeWire: port.id
55+
// WebMIDI: index of the MIDI device in the list provided by the browser.
5656
// WinMIDI: uint64_t terminal_block_number; (MidiGroupTerminalBlock::Number(), index is 1-based)
5757
// WinMM: port index between 0 and midi{In,Out}GetNumDevs()
5858
// WinUWP: index of the MIDI device in the list provided by the OS.
@@ -68,13 +68,15 @@ struct LIBREMIDI_EXPORT port_information
6868

6969
// ALSA Raw: ID_MODEL_FROM_DATABASE if provided by udev
7070
// ALSA Seq: ID_MODEL_FROM_DATABASE if provided by udev
71+
// WinMIDI: MidiEndpointDeviceInformation::GetTransportSuppliedInfo().Name
7172
std::string product{};
7273

7374
/// "Unique" serial number. Note that this is super unreliable - pretty
7475
/// much no MIDI device manufacturer bothers with unique per-device serial number
7576
/// unlike most USB devices.
7677
// ALSA Raw: ID_USB_SERIAL if provided by udev.
7778
// ALSA Seq: ID_USB_SERIAL if provided by udev.
79+
// WinMIDI: MidiEndpointDeviceInformation::GetTransportSuppliedInfo().SerialNumber
7880
std::string serial{};
7981

8082
// ALSA Raw: Name returned by snd_rawmidi_info_get_name
@@ -97,8 +99,8 @@ struct LIBREMIDI_EXPORT port_information
9799

98100
/// Port type
99101
// CoreMIDI: available
100-
// WinMM: unavailable
101102
// WinMIDI: available
103+
// WinMM: unavailable
102104
port_type type = port_type::unknown;
103105

104106
// Equality and comparison operators are deleted as there is not one

0 commit comments

Comments
 (0)