I am writing a (java)script that has access to many pages of remote control parameters. For each page of parameters I execute a script like this:
That marks each parameter interested.remoteControls1.selectedPageIndex().set(0);
for (var i = 0; i < 8; i++) {
var parameter = remoteControls1.getParameter(i);
parameter.markInterested();
}
When it comes to flushing the parameters to the device for updating, I use this script:
// the indices of the parameters that we want to send as MIDI CC messages
const PARAMETER_INDICES = [0, 1, 2, 3, 4, 5, 6, 7];
// the MIDI CC numbers that correspond to the parameters on the hardware device
const MIDI_CC_NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8];
// get the values of the parameters and multiply them by 120
var values = PARAMETER_INDICES.map(function(index) {
remoteControls1.selectedPageIndex().set(0);
return remoteControls1.getParameter (index).get() * 120;
});
// round the values to the nearest integer
values = values.map(function(value) {
return Math.round(value);
});
// send a MIDI CC message for each parameter
for (var i = 0; i < PARAMETER_INDICES.length; i++) {
host.getMidiOutPort(0).sendMidi(176, MIDI_CC_NUMBERS, values);
}
Everything works, however, when a parameter is changed it updates each and every parameter marked interested in the whole script (~300 in my case), instead of just updating the parameter that has been changed. This can get a bit much and laggy. Moss mentioned this problem in his excellent scripting tutorials and briefly mentioned a bit of code as a solution, however I don't understand enough about coding to dissect and re-apply it for my use case here.
If anyone could help me out on this, it would be much appreciated I plan to make the script available as a blueprint and with some OpenStageControl GUI surfaces once I'm done, as I don't see any scripts so far that are capable of handling multiple parameter control pages at once.