Hi everyone,
I am a simple enthusiast using Cubase 15 Pro and running a very complex custom hardware setup: an external touchscreen control surface running a custom C# WPF application (called Sherlock 2 in homage to the superb work done by Karol Obara of 14BitMIDI with his Sherlock Plugin ) and with 20 pages and 240 buttons.
My workflow relies heavily on keeping tracks deactivated by default in a large template to save system resources. To make my touchscreen dynamic, I absolutely need bidirectional feedback: when I select an instrument track in Cubase (using the mouse or keyboard arrows), I want Cubase to automatically send the Selected Track Name back to my C# application so my touchscreen layout can adapt instantly.
We previously tried using Windows UI Automation in C# to “spy” on the Cubase window focus, but it is way too resource-intensive and causes major UI lags in our template.
We want to move to a clean, native solution using the Cubase MIDI Remote API (JavaScript).
My questions for the script experts here:
Is it possible via the MIDI Remote JS API to listen to the “Selected Track Change” event and extract the string of the track name?
Can a MIDI Remote script send this text string over a virtual MIDI port (like loopMIDI) or via a specific SysEx/MIDI message that my C# application could listen to?
If anyone has a snippet of JS code or an example of a callback function (mOnTitleChange or similar) that achieves this, I would be extremely grateful!
Here is the draft of the MIDI Remote JS callback we want to use to get the track title:
var hostSelectedTrackTitle = page.mHostAccess.mTrackSelection.mMixerChannel.mValue.mTitle;
hostSelectedTrackTitle.mOnTitleChange = function(activeDeviceInstance, activeMapping, trackTitle) { if (!trackTitle) return; var charCodes = []; for (var i = 0; i < trackTitle.length; i++) { charCodes.push(trackTitle.charCodeAt(i)); } var fullMessage = [0xF0, 0x00, 0x21, 0x1A].concat(charCodes, [0xF7]); console.log("Track changed to: " + trackTitle); };
My questions for the script experts here:
-
Is it possible via the MIDI Remote JS API to listen to the “Selected Track Change” event and extract the string of the track name?
-
Can a MIDI Remote script send this text string over a virtual MIDI port (like loopMIDI) or via a specific SysEx/MIDI message that my C# application could listen to?
-
If anyone has a snippet of JS code or an example of a callback function (
mOnTitleChangeor similar) that achieves this, I would be extremely grateful!
Thanks a lot for your help and insights!
