Compare commits

...

3 Commits
main ... rob

Author SHA1 Message Date
rc 579506e4c5 Fix port 2022-03-05 15:31:22 +01:00
rc f0d95ecb9d disable console log of osc messages and debug set to false 2022-03-05 13:32:05 +01:00
rc 198bbf69cc Calibrate global reference with btn1 2022-03-05 13:23:30 +01:00
1 changed files with 16 additions and 7 deletions

View File

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