-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alsa names are a bit too mutch #348
Comments
Port names are a pretty big failure point with our hardware editors. We haven’t managed to get around SysEx size limitations in Linux, so changes here wouldn’t affect us today, but I would be very careful changing the current behavior as you may break compatibility for existing implementations.On Mar 7, 2025, at 8:33 AM, shemeshg ***@***.***> wrote:
isn't this, a bit too match, and needs to be optional with flags?
os << snd_seq_client_info_get_name( cinfo );
os << ":";
os << snd_seq_port_info_get_name( pinfo );
os << " "; // These lines added to make sure devices are listed
os << snd_seq_port_info_get_client( pinfo ); // with full portnames added to ensure individual device names
os << ":";
os << snd_seq_port_info_get_port( pinfo );
I don't mind filter that myself on my side
std::string IMidiInOut::extractAlsaNameIfRequired(const std::string& input) {
// Regex pattern to match the desired part
std::regex pattern(R"((.*):(.* \d+:\d+$))");
std::smatch match;
if (std::regex_match(input, match, pattern)) {
// match[2] contains the part after the first colon, but includes the numbers at the end
std::string namePart = match[2];
// Find the position of the last space
size_t lastSpace = namePart.find_last_of(' ');
if (lastSpace != std::string::npos) {
// Remove the digits part after the last space
namePart = namePart.substr(0, lastSpace);
}
return namePart;
}
// Return an empty string if the pattern does not match
return input;
}
but I don't think all this verbosity is required by anyone, aseptically it yields different string for each call.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
shemeshg created an issue (thestk/rtmidi#348)
isn't this, a bit too match, and needs to be optional with flags?
os << snd_seq_client_info_get_name( cinfo );
os << ":";
os << snd_seq_port_info_get_name( pinfo );
os << " "; // These lines added to make sure devices are listed
os << snd_seq_port_info_get_client( pinfo ); // with full portnames added to ensure individual device names
os << ":";
os << snd_seq_port_info_get_port( pinfo );
I don't mind filter that myself on my side
std::string IMidiInOut::extractAlsaNameIfRequired(const std::string& input) {
// Regex pattern to match the desired part
std::regex pattern(R"((.*):(.* \d+:\d+$))");
std::smatch match;
if (std::regex_match(input, match, pattern)) {
// match[2] contains the part after the first colon, but includes the numbers at the end
std::string namePart = match[2];
// Find the position of the last space
size_t lastSpace = namePart.find_last_of(' ');
if (lastSpace != std::string::npos) {
// Remove the digits part after the last space
namePart = namePart.substr(0, lastSpace);
}
return namePart;
}
// Return an empty string if the pattern does not match
return input;
}
but I don't think all this verbosity is required by anyone, aseptically it yields different string for each call.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@shemeshg what is the output actually looking like? Are you sure all the information is not necessary when a given client has or connects to several ports? |
attached one line complete name, one line a manipulated...
Tested: This is very match unlike
also if it were as expected wouldn't you rather a struct that return these? (or even better - accepted struct byref to maintain polymorphism) also in the name of consistency, if these numbers had any meaning, we'd have to keep unique id's logic for Virtual Ports (this was not tested), though it might by be argued as "none issue" since I don't know how in a way, these numbers |
What are the two port names (20:0 and 20:1) supposed to be? That output
would cause us many headaches if we were trying to differentiate between
ports.
…On Fri, Mar 7, 2025 at 11:13 AM shemeshg ***@***.***> wrote:
very sure,
for some reasons I can not reproduce the problem where it's yield
different string over time...
I guess this was a problem of my ubuntu intel virtual machine
one line complete name, one line a manipulated...
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
—
Reply to this email directly, view it on GitHub
<#348 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGQHAEY75TI5SOUVABMRWD2THVWTAVCNFSM6AAAAABYRTNTY2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBXGIYTQNRUGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: shemeshg]*shemeshg* left a comment (thestk/rtmidi#348)
<#348 (comment)>
very sure,
for some reasons I can not reproduce the problem where it's yield
different string over time...
I guess this was a problem of my ubuntu intel virtual machine
one line complete name, one line a manipulated...
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
Midi Through:Midi Through Port-0 14:0
Midi Through Port-0
Launch Control XL:Launch Control XL Launch Contro 20:0
Launch Control XL Launch Contro
Launch Control XL:Launch Control XL Launch Contro 20:1
Launch Control XL Launch Contro
—
Reply to this email directly, view it on GitHub
<#348 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGQHAEY75TI5SOUVABMRWD2THVWTAVCNFSM6AAAAABYRTNTY2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBXGIYTQNRUGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
these are just in and out respectively. xx.0 - in xx.1-out |
thanks @shemeshg, I'm not familiar with the alsa APIs but I had to deal with parsing the output of "alsaconnect" program: https://github.com/smoothdeveloper/alsa.aconnect/blob/main/tests/alsa.aconnect.tests/tests.fs#L40 What feels likely, is that if changes are made to rtmidi, it should probably use the same information as that command line https://github.com/bear24rw/alsa-utils/blob/master/seq/aconnect/aconnect.c I think the fact that ids may change over time is normal, especially with many devices and probably non deterministic things occuring with USB & drivers loading or listing order. |
All this information is necessary because the construction varies from device to device. Device A: Device B: If two identical devices or client instances are connected the port numbers are the only thing that allows to uniquely identify the port that shall be connected. Note: RtMidi ports numbers may change during runtime of your software while ALSA device and port numbers are stable. So between runs the numbers have no meaning but during runs they have a unique meaning. |
In that case, it might be beneficial if RTMidi sorted its own port ID based on the ALSA The focus should be on sorting by a consistent integer to provide reasonably ordered RTMidi port number, (not necessarily presenting them), Alternatively, it would be better to provide a hash of PortId + PortName. This could be achieved by having one common class for all operating systems, passed by reference (to avoid damaging current implementations), or using an In my software I do what LogicPro does (add prefix
the code for the unsigned int IMidiInOut::unqIdPortNumber(unsigned int portNumber)
{
unsigned unqId = 0;
std::string portnameWithoutUnqIdx = p_midi->getPortName(portNumber);
for ( unsigned i=0; i<portNumber; i++ ) {
if ( p_midi->getPortName(i) == portnameWithoutUnqIdx){unqId ++;}
}
return unqId;
} this is why I find consistent ordering important |
Port name inconsistency from os to os is a huge pain in the ass, we have very carefully crafted code to ensure our customers are able to automatically connect their hardware to our software regardless of OS.The Windows MM api does not provide a method to access port names, multiport devices are presented with the first port as “Device name” and every other port as “MIDI2 (devicename)”, MIDI3 (devicename), etc.MacOS presents the ports as “Devicename portname” and it’s relatively clean, unless you have a multiport device without descriptors for the port names. So for our product QuNexus, the original firmware 1.0 didn’t name the ports in the descriptor, so MacOS/RtMIDI would present it as “QuNexus Port 1”, “QuNexus Port 2”, etc. This caused us major problems because if the system language was set to spanish, the ports would be “QuNexus Puerto 1”, etc, and our editor wouldn’t recognize the device. We transitioned all of our products to name the ports because of this.For Linux, we have an unreleased version of the QuNexus editor, we’ve held it back because RtMidi on Linux can’t send large (>10k) SysEx packets, which breaks our firmware updates. It’s been a while since I looked at the code, but I remember that earlier versions of Alsa didn’t report the port names, but we could use the port numbers to determine which was which.We have to handle all of these different variations in our code if we want devices to connect without user interaction. The newwindows midi services API (midi 2.0), when implemented, allows multiclient port access - windowsMM being single client has kept us from switching to a method where we poll all usb devices/ports with sysex id requests, which would remove the need for us to track/decode port names.It occurred to me that since the windows UWP api was released, we haven’t evaluated it for port names or multiclient port access. I provide all of this info as context for the challenges we face making things work for tens of thousands of end users. Please be careful when modifying how port names are presented in the API :).Cheers,Eric BatemanOn Mar 8, 2025, at 1:24 PM, shemeshg ***@***.***> wrote:
In that case, it might be beneficial if RTMidi sorted its own port ID based on the ALSA snd_seq_port_info_get_port.
Additionally, it makes sense to determine the equivalent function for macOS, UMP, and Windows.
The focus should be on sorting by a consistent integer RTMidi port number, not necessarily presenting them, or providing another means to retrieve that information.
Alternatively, it would be better to provide a hash of PortId + PortName.
This could be achieved by having one common class for all operating systems, passed by reference (to avoid damaging current implementations), or using an #IFDEF class for each OS.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
shemeshg left a comment (thestk/rtmidi#348)
In that case, it might be beneficial if RTMidi sorted its own port ID based on the ALSA snd_seq_port_info_get_port.
Additionally, it makes sense to determine the equivalent function for macOS, UMP, and Windows.
The focus should be on sorting by a consistent integer RTMidi port number, not necessarily presenting them, or providing another means to retrieve that information.
Alternatively, it would be better to provide a hash of PortId + PortName.
This could be achieved by having one common class for all operating systems, passed by reference (to avoid damaging current implementations), or using an #IFDEF class for each OS.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***>
|
isn't this, a bit too match, and needs to be optional with flags?
I don't mind filter that myself on my side
but I don't think all this verbosity is required by anyone, aseptically it yields different string for each call.
The text was updated successfully, but these errors were encountered: