2021-08-12 18:10:19 +02:00
|
|
|
var oscPort = new osc.WebSocketPort({
|
|
|
|
url: location.origin.replace(/https?/, 'ws'),
|
|
|
|
metadata: true
|
|
|
|
});
|
|
|
|
|
|
|
|
oscPort.open();
|
|
|
|
|
|
|
|
oscPort.on("ready", function () {
|
2021-08-14 15:15:16 +02:00
|
|
|
console.log("OSC listening!")
|
2021-08-12 18:10:19 +02:00
|
|
|
// Example send
|
|
|
|
/*
|
|
|
|
oscPort.send({
|
|
|
|
address: "/carrier/frequency",
|
|
|
|
args: [
|
|
|
|
{
|
|
|
|
type: "f",
|
|
|
|
value: 440
|
|
|
|
}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
oscPort.on("message", function (msg) {
|
2021-08-14 15:15:16 +02:00
|
|
|
oscCallbacks[msg.address].forEach(cb => cb(msg.args))
|
|
|
|
});
|
2021-08-12 18:10:19 +02:00
|
|
|
});
|