How many possible midi message in the custom api remote script

Hello, is it possible to use one value per midi CC to send command to cubase in a custom api remote script ? Seems like I only have success using distinct midi message, that limit the number of different midi message to how many ? I have a large template and need 3 different PLE per track in my custom script, which is a few thousands, the workaround would be to use multiple midi remote devices but asking just in case

var b1 = deviceDriver.mSurface.makeButton(0, 0, 1, 1)
b1.mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(15, 127).setValueRange(1, 1)
page.makeCommandBinding(b1.mSurfaceValue, ‘Process Project Logical Editor’, ‘PresetA’)

var b2 = deviceDriver.mSurface.makeButton(0, 0, 1, 1)
b2.mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(15, 127).setValueRange(2, 2)
page.makeCommandBinding(b2.mSurfaceValue, ‘Process Project Logical Editor’, ‘PresetB’)

result is that it trigger both presets quickly

Hi, check this code:

var surface=deviceDriver.mSurface

var initMidiCCCustomVariable=surface.makeCustomValueVariable("initMidiCCCustomVariable")
initMidiCCCustomVariable.mMidiBinding
    .setInputPort(midiInput)
    .bindToControlChange(15,127)

var b1=surface.makeButton(0,0,1,1)
var b2=surface.makeButton(1,0,1,1)

page.makeCommandBinding(b1.mSurfaceValue,"Process Project Logical Editor","PresetA")

page.makeCommandBinding(b2.mSurfaceValue,"Process Project Logical Editor","PresetB")

initMidiCCCustomVariable.mOnProcessValueChange=function(activeDevice,value,diff){
    var value127=Math.round(127*value)

    switch (value127){

        case 1:
            b1.mSurfaceValue.setProcessValue(activeDevice,1)
            break 

        case 2:
            b2.mSurfaceValue.setProcessValue(activeDevice,1)
            break

        //And So on
    
    }

}

Notice how the mOnProcessValueChange allows us to trigger different buttons’ surface values, which are then bound to commands. Notice also that these buttons don’t have any midi binding at all. We need just one custom variable.

Instead of 7-bit, you can even use 14bit MIDI, so that with just one custom var you can control more than 16000 commands.

Finally, you can always use midi sysex, but in the use case you presented I don’t see a benefit.

the goat has saved me again

thank you

Side note:

I only hope that everyone reading this is aware of the modern meaning of “goat”: “greatest of all time” in this context.

When I originally learned English (as my second language) being the goat was not a good thing :zany_face:

Of course ! Thank you aha