mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 10:36:34 +01:00
WebSockets: improve support for callbacks in JS client lib
This commit is contained in:
parent
1f3b40f4bd
commit
da670aa186
4 changed files with 91 additions and 48 deletions
|
|
@ -38,26 +38,28 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
|
|||
main();
|
||||
|
||||
function main () {
|
||||
ardour.messageCallback = (msg) => {
|
||||
log(`↙ ${msg}`, 'message-in');
|
||||
ardour.addCallback({
|
||||
onMessage: (msg) => {
|
||||
log(`↙ ${msg}`, 'message-in');
|
||||
|
||||
if (msg.node == 'strip_desc') {
|
||||
createStrip (msg.addr, ...msg.val);
|
||||
} else if (msg.node == 'strip_plugin_desc') {
|
||||
createStripPlugin (msg.addr, ...msg.val);
|
||||
} else if (msg.node == 'strip_plugin_param_desc') {
|
||||
createStripPluginParam (msg.addr, ...msg.val);
|
||||
} else if (FEEDBACK_NODES.includes(msg.node)) {
|
||||
if (widgets[msg.hash]) {
|
||||
widgets[msg.hash].value = msg.val[0];
|
||||
if (msg.node == 'strip_desc') {
|
||||
createStrip (msg.addr, ...msg.val);
|
||||
} else if (msg.node == 'strip_plugin_desc') {
|
||||
createStripPlugin (msg.addr, ...msg.val);
|
||||
} else if (msg.node == 'strip_plugin_param_desc') {
|
||||
createStripPluginParam (msg.addr, ...msg.val);
|
||||
} else if (FEEDBACK_NODES.includes(msg.node)) {
|
||||
if (widgets[msg.hash]) {
|
||||
widgets[msg.hash].value = msg.val[0];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onError: () => {
|
||||
log('Client error', 'error');
|
||||
}
|
||||
};
|
||||
|
||||
ardour.errorCallback = () => {
|
||||
log('Client error', 'error');
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
ardour.open();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue