Compare commits

...

3 Commits
main ... rob

  1. 23
      server.js

23
server.js

@ -110,15 +110,17 @@ const wss = new WebSocket.Server({ server })
// Relay multicast to websockets
// @TODO still sends to supercollider? Do we need two sockets?
var dgram = require('dgram');
var sss = dgram.createSocket('udp4');
sss.on('listening', () => {
sss.addMembership('224.0.1.9');
})
sss.bind(6696, '224.0.1.9');
//var dgram = require('dgram');
//var sss = dgram.createSocket('udp4');
//sss.on('listening', () => {
// sss.addMembership('224.0.1.9');
//})
//sss.bind(57120);
const scudp = new osc.UDPPort({
socket: sss
//socket: sss
remotePort: 57121,
localPort: 57100
})
scudp.on('open', () => {
@ -173,6 +175,12 @@ function eulerFromQuaternion(quaternion) {
}
const sendAll = (msg, info, oscWS, osclients) => {
if (msg.address == '/keys') {
if (msg.args[0] == 1) {
eulerRotation = [0, 0, 0];
console.log("EULER ROTATION RESET");
}
}
// Convert quaternion diff to euler angle diff
if (msg.address == '/quaternionDiff') {
@ -200,6 +208,7 @@ const sendAll = (msg, info, oscWS, osclients) => {
})
if (scudp) {
console.log("SENDING UDP", msg)
scudp.send(msg)
}
}

Loading…
Cancel
Save