Hello,
I'm trying to synchronize Open Stage Control with a DAW.
I can retrieve any value from the DAW by sending messages like: "/get", "/channel/1/name".
I already have a widget that sends all the "/get" messages every 1000ms (this value can be adjusted using an input widget).
But this is where I encounter problems: the DAW does not send a message containing the number of channels, so Open Stage Control has no idea how many times it needs to clone the channel strip.
If a new channel is created, the DAW sends all the associated values; if a channel is deleted, a message is also sent: "/channel/1/delete".
Here is the script I am currently using:
const noms =get('channel_name')
let j = 10;
for (let i = 0; i < 10; i++) {
let name = noms[i];
if (name === "undefined") {
j--;
console.log(`channel ${i + 1} n'existe pas`);
} else {
console.log(`channel ${i + 1} : ${name}`);
}
}
console.log(`Nombre de channels : ${j}`);
channel_name value :
[
"OSC{/channel/1/name}",
"OSC{/channel/2/name}",
"OSC{/channel/3/name}",
"OSC{/channel/4/name}",
"OSC{/channel/5/name}",
"OSC{/channel/6/name}",
"OSC{/channel/7/name}",
"OSC{/channel/8/name}",
"OSC{/channel/9/name}",
"OSC{/channel/10/name}"
]
It works, but even if I reinitialize the channel_name widget, it still retains the old values in memory. If a channel is deleted, the name in channel_name does not become "undefined".
I realize that this approach is a bit awkward.
I can't find a way to properly reset the values of the channel_name widget.
Does anyone have any suggestions or a better approach to synchronize the number of channels between the DAW and Open Stage Control?
Thank you very much in advance!