Skip to content

alsa names are a bit too mutch #348

Open
@shemeshg

Description

@shemeshg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions