MIDI REMOTE API: Get type of track?

I would like to know if the selected track is midi, audio, instrument, etc.

Is it possible to get the type of track that is selected with the remote midi api?

I have been searching for that in the API reference website, but I didn’t find it…

On CB 13.0.51 and 14, you can try this:

var selTrackDA=page.mHostAccess.makeDirectAccess(page.mHostAccess.mTrackSelection.mMixerChannel)

var trackSelected=page.mHostAccess.mTrackSelection.mMixerChannel.mValue.mSelected

var trackSelectedCV=surface.makeCustomValueVariable("trackSelectedCV")

page.makeValueBinding(trackSelectedCV,trackSelected).mOnValueChange=function(activeDevice,activeMapping,value){

    if(value==1){

        //selected
        var baseObjectID=selTrackDA.getBaseObjectID(activeMapping)
        var objectUniqueName=selTrackDA.getObjectUniqueName(activeMapping,baseObjectID)
        var trackType=objectUniqueName.replace(/\s?\d+$/, '')
        console.log("type="+trackType)
        
    }
    
}

Wow!!

It works perfectly!!

I would need two lifes to understand that code… but I will try to analyze it calmly! :slightly_smiling_face:

Thanks a lot @m.c !!!

1 Like

I just stumbled over this thread and first I have to say that it is really nice to see how supportive the community is. This is great.
As a side remark: Examples like this show what for sure cannot be the future of programming a remote controller. With all due respect for the API-Developers (they are not to blame imho): If such a piece of code is necessary to achieve a trivial result as required, we are in the late stone-age of software development. I mean, generally speakingt: The scripting language for programming Remotes is on an abstraction level that is shockingly low.
Again: I am NOT criticicing the API-developers, but the paradigms we are using in the third decade of the 2000th…it is simply absurd.

1 Like