Multiple MIDI ports in Remote driver?

Is it possible to open multiple MIDI ports within a MIDI Remote driver (JavaScript).

I tried a brief experiment, but was not successful. Quite possible that I’m doing something wrong. To clarify, I’m attempting to open two ports to the same device. Specifically, I’m trying to open both Novation SL MkIII and MIDIIN2 (Novation SL MkIII).

It probably dumb anyway, because InControl is only using MIDI channel 16 on MIDIIN2.

Hi @Dave_B, you have to set unique names like this:

var midiInput1 = deviceDriver.mPorts.makeMidiInput('Input 1')
var midiInput2 = deviceDriver.mPorts.makeMidiInput('Input 2')

var midiOutput1 = deviceDriver.mPorts.makeMidiOutput('Output 1')
var midiOutput2 = deviceDriver.mPorts.makeMidiOutput('Output 2')

knob1.mSurfaceValue.mMidiBinding
    .setInputPort(midiInput1)
    .setOutputPort(midiOutput1)
    .bindToControlChange (0, 22)

knob2.mSurfaceValue.mMidiBinding
    .setInputPort(midiInput2)
    .setOutputPort(midiOutput2)
    .bindToControlChange (0, 22)

Interesting! I had tried the open syntax similar to how you illustrated, however I was trying to open two ports to the same Novation SL MKIII and it seemed to cause the driver to malfunction. I had not yet tried binding anything. I’ll have to revisit this.

Would it be an issue if each of the makeMidiInput/Output use the expect syntax:

deviceDriver.makeDetectionUnit().detectPortPair(midiInput, midiOutput)
    .expectInputNameEquals('To-Cubase')
    .expectOutputNameEquals('From-Cubase')
    .expectSysexIdentityResponse(/*vendor id (1 or 3 bytes, here: 3 bytes)*/'002029', /*device family*/'0101', /*model number*/'0000')

I tried the procedure outlined above but it doesn’t seem to work.

My goal is to use a combined script for a couple of MIDI controllers, so that I can use the buttons on one of them to change pages on all of them, as if they were one controller.

As soon as I add the second set of ports to the script, it stops working. @Jochen_Trappe can you please point me in the right direction? Is this supposed to work at all?

var midiInput = deviceDriver.mPorts.makeMidiInput()
var midiOutput = deviceDriver.mPorts.makeMidiOutput()
var midiInput2 = deviceDriver.mPorts.makeMidiInput()
var midiOutput2 = deviceDriver.mPorts.makeMidiOutput()

deviceDriver.makeDetectionUnit().detectPortPair(midiInput, midiOutput)
    .expectInputNameEquals('Midi Fighter Twister')
    .expectOutputNameEquals('Midi Fighter Twister')

deviceDriver.makeDetectionUnit().detectPortPair(midiInput2, midiOutput2)
    .expectInputNameEquals('PreSonus FP2')
    .expectOutputNameEquals('PreSonus FP2')

Hi,

If i’m not mistaken, you need to provide different strings for each midi Input/output.

Like this:

These names should be displayed when setting up your script manually.

Thomas

Hi @dada_sandor and @thomas_martin,

POINT 1

That’s true as soon as you use more than one pair of IO-ports.

POINT 2
A DetectionUnit tells Cubendo how to auto-detect a device. You create one DetectionUnit for each operating system (and all of their MIDI backends). I hope the following example enables you to solve your issue:

var midiInput = deviceDriver.mPorts.makeMidiInput("input1")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("output1")
var midiInput2 = deviceDriver.mPorts.makeMidiInput("input2")
var midiOutput2 = deviceDriver.mPorts.makeMidiOutput("output2")

var detectionUnitWindows = deviceDriver.makeDetectionUnit()

detectionUnitWindows.detectPortPair(midiInput, midiOutput)
    .expectInputNameEquals('Midi Fighter Twister')
    .expectOutputNameEquals('Midi Fighter Twister')

detectionUnitWindows.detectPortPair(midiInput2, midiOutput2)
    .expectInputNameEquals('PreSonus FP2')
    .expectOutputNameEquals('PreSonus FP2')

// next OS detection unit definitions ... 
var detectionUnitWindowsRTMIDI = deviceDriver.makeDetectionUnit()
// ...
var detectionUnitWindowsMacOS = deviceDriver.makeDetectionUnit()
// ...

Hi @Jochen_Trappe and @thomas_martin ,

Thank you for your input. I tried this and and it doesn’t seem to work.

The issue is that it seems that Cubase “locks in” on the controller that was used first (first MIDI binding defined) and only lets me use those ports for the script. Here’s how it goes:

  1. I define both MIDI I/O pairs
  2. I create MIDI bindings for the first controller and they work as expected
  3. I create MIDI bindings for the second controller, reload the script, and they don’t work
  4. I remove the MIDI bindings for the first controller, reload the script, the second controller still doesn’t work
  5. I restart Cubase. Now the second controller works.
  6. I add the MIDI bindings of the first controller, and reload the script. Still only the second controller works.
  7. I restart Cubase. Now the first controller works as the first MIDI binding in the code is related to the first controller.

Let me know if I’m missing something from your explanation. The only point I didn’t quite understand is creating different DetectionUnits for different operating systems. Do I need to detect each controller more than once? I work on MacOS only.

Hi @dada_sandor , please provide screenshots of the lower MIDI Remote zone and the MIDI Remote Manager Window.

Hi @Jochen_Trappe ,

Here are the screenshots as requested:


It’s a fully functioning script for the Midi Fighter, I only added one button (top right corner) to test the second controller.

Here are some snippets of the code (declaration of I/O pairs and example MIDI bindings for the controllers)

var midiInput = deviceDriver.mPorts.makeMidiInput("input1")
var midiOutput = deviceDriver.mPorts.makeMidiOutput("output1")
var midiInput2 = deviceDriver.mPorts.makeMidiInput("input2")
var midiOutput2 = deviceDriver.mPorts.makeMidiOutput("output2")

deviceDriver.makeDetectionUnit().detectPortPair(midiInput, midiOutput)
   .expectInputNameEquals('Midi Fighter Twister')
   .expectOutputNameEquals('Midi Fighter Twister')

deviceDriver.makeDetectionUnit().detectPortPair(midiInput2, midiOutput2)
    .expectInputNameEquals('PreSonus FP2')
    .expectOutputNameEquals('PreSonus FP2')

//-----------

var knob = surface.makeKnob(2+c*3, r*3, 3, 3)
    knob.mSurfaceValue.mMidiBinding
    .setInputPort(midiInput).setOutputPort(midiOutput)
    .bindToControlChange(0, c+r*inarow).setTypeAbsolute()

//-------------

var btn_Solo = surface.makeButton(28, 1, 1, 1)
    btn_Solo.mSurfaceValue.mMidiBinding
    .setInputPort(midiInput2).setOutputPort(midiOutput2)
    .bindToNote (0, 0x08)