Auto detect multiport device

Hi,

I have a device with multiple midi ports. And Cubase seems to be able to auto detect these. This is the code I tried that doesn’t work. Like this the device is not detected. I can only add it manually:

        midiInput[0] = deviceDriver.mPorts.makeMidiInput('Port')
        midiOutput[0] = deviceDriver.mPorts.makeMidiOutput('Port Out')

        deviceDriver.makeDetectionUnit().detectPortPair(midiInput[0],  midiOutput[0])
            .expectInputNameEquals('CustomDev')
            .expectOutputNameEquals('CustomDev')
        

        midiInput[1] = deviceDriver.mPorts.makeMidiInput('Port2')
        midiOutput[1] = deviceDriver.mPorts.makeMidiOutput('Port2 Out')

        deviceDriver.makeDetectionUnit().detectPortPair(midiInput[1],  midiOutput[1])
            .expectInputNameEquals('MIDIIN2 (CustomDev)')
            .expectOutputNameEquals('MIDIOUT2 (CustomDev)')

If I do it with only one port the code works just fine and Cubase detects my device:

        midiInput[0] = deviceDriver.mPorts.makeMidiInput('Port')
        midiOutput[0] = deviceDriver.mPorts.makeMidiOutput('Port Out')

        deviceDriver.makeDetectionUnit().detectPortPair(midiInput[0],  midiOutput[0])
            .expectInputNameEquals('CustomDev')
            .expectOutputNameEquals('CustomDev')

The port name also is not the problem because this also works:

        midiInput[0] = deviceDriver.mPorts.makeMidiInput('Port')
        midiOutput[0] = deviceDriver.mPorts.makeMidiOutput('Port Out')

        deviceDriver.makeDetectionUnit().detectPortPair(midiInput[0],  midiOutput[0])
            .expectInputNameEquals('MIDIIN2 (CustomDev)')
            .expectOutputNameEquals('MIDIOUT2 (CustomDev)')

Is this even possible?

it’s been a while since I last played with the API, and I don’t know if it helps with your use case – but have you maybe tried experimenting with “Contains” or “StartsWith” or “EndsWith” rather than “Equals”?

Thank you. I just tried it with Contains which I guess supersedes Starts and EndsWith in this case. Also I trimmed the name to the minium needed to still be unique. … but no change. Still doesn’t work

Sorry - that sucks!

By the way, when you said:

Were you talking about the MIDI Remote detecting such a device, or just the main Cubase MIDI as visible in the Studio Setup > MIDI Port Setup ?

I was talking about the detection. I can add it manually. The ports are there and work fine.

me too.

My question was, if you had evidence, that the MIDI Remote can auto detect multiple ports on a different device than the one you’re creating.

If yes, you should be able to find the code for it.

I don’t know if it actually can work. Hence my question:

sorry - I don’t know


I only asked/suggested, because you didn’t actually answer my prior followup question.

(emphasis mine)

But never mind, I’ll see myself out …