Skip to content

Commit

Permalink
Merge pull request #4897 from fwolter/fix-x32
Browse files Browse the repository at this point in the history
Fix matching of X32 MIDI in/out devices
  • Loading branch information
Swiftb0y committed Aug 15, 2022
2 parents 3fcece4 + 0e7c9d9 commit 1ed11fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/controllers/midi/portmidienumerator.cpp
Expand Up @@ -25,8 +25,10 @@ bool recognizeDevice(const PmDeviceInfo& deviceInfo) {
// devices that have an equivalent "deviceName" and ### section.
const QRegularExpression kMidiDeviceNameRegex(QStringLiteral("^(.*) MIDI (\\d+)( .*)?$"));

const QRegularExpression kInputRegex(QStringLiteral("^(.*) in (\\d+)( .*)?$"));
const QRegularExpression kOutputRegex(QStringLiteral("^(.*) out (\\d+)( .*)?$"));
const QRegularExpression kInputRegex(QStringLiteral("^(.*) in( \\d+)?( .*)?$"),
QRegularExpression::CaseInsensitiveOption);
const QRegularExpression kOutputRegex(QStringLiteral("^(.*) out( \\d+)?( .*)?$"),
QRegularExpression::CaseInsensitiveOption);

// This is a broad pattern that matches a text blob followed by a numeral
// potentially followed by non-numeric text. The non-numeric requirement is
Expand Down
13 changes: 13 additions & 0 deletions src/test/portmidienumeratortest.cpp
Expand Up @@ -75,6 +75,19 @@ TEST_F(PortMidiEnumeratorTest, InputOutputPortsLinked) {
"Pure Data Midi in 1",
"Pure Data Midi out 1"));

ASSERT_FALSE(shouldLinkInputToOutput(
"Pure Data Midi in 1",
"Pure Data Midi out 2"));

ASSERT_TRUE(shouldLinkInputToOutput(
"foo in 123 bar test",
"foo out 123 bar test"));

// Bug 1986440 - Behringer X32
ASSERT_TRUE(shouldLinkInputToOutput(
"X-USB MIDI IN",
"X-USB MIDI OUT"));

// Strip ' input ' from inputs and ' output ' from outputs.

// Lemur Daemon shows 8 port pairs named like: 'Daemon Input 1' and 'Daemon
Expand Down

0 comments on commit 1ed11fc

Please sign in to comment.