kegel/web/osctl.js

23 lines
467 B
JavaScript

const oscPort = new osc.WebSocketPort({
url: `${PROTO}://${SERVER_IP}:${SERVER_PORT}/`,
metadata: true
})
function sendAll (address, args) {
//console.log('posiljam', address, args)
oscPort.send({ address, args })
}
oscPort.on("ready", function () {
console.log("OSC listening!")
oscPort.on("message", function (msg) {
//console.log('msg!', msg);
var cb = oscCallbacks[msg.address]
if (cb) {
cb(msg.args)
}
})
})
oscPort.open()