Some parameter tweaks, expose port numbers on top

main
Jurij Podgoršek 2022-03-22 20:05:29 +01:00
parent 2a38878687
commit 251efac204
3 changed files with 33 additions and 9 deletions

View File

@ -141,8 +141,8 @@ function modulirajParametre() {
obj_limit *= 1 - dqY; obj_limit *= 1 - dqY;
} }
if (keysPressed[0]) { if (keysPressed[0]) {
width *= 1 + (dqX / 2); width *= 1 + (dqX / 3);
barva_mod += (dqZ / 100); barva_mod += (dqZ / 1000);
} }
} }

View File

@ -9,7 +9,8 @@
"osc": "^2.4.2", "osc": "^2.4.2",
"pm2": "^5.1.0", "pm2": "^5.1.0",
"three": "0.135.0", "three": "0.135.0",
"ws": "^7.3.1" "ws": "^7.3.1",
"hydra-osc": "dev-master"
}, },
"scripts": { "scripts": {
"start": "npx nodemon server.js /dev/ttyUSB0" "start": "npx nodemon server.js /dev/ttyUSB0"

View File

@ -1,11 +1,26 @@
// Which port do I send OSC messages to? (SupperCollider, ...)
const OSCPORT = 57120;
// Which port do I listen to (for visuals, calibration)
const PORT = 6676
// Do we have a problem, shall we debug?
const DEBUG = true
const express = require('express') const express = require('express')
const http = require('http') const http = require('http')
const WebSocket = require('ws') const WebSocket = require('ws')
const osc = require('osc') const osc = require('osc')
const readline = require('readline') const readline = require('readline')
const fs = require('fs') const fs = require('fs')
const port = 6676
// Vzemi iz argumenta // Vzemi iz argumenta
const tty = process.argv[2] const tty = process.argv[2]
@ -30,8 +45,6 @@ const include_files = [
const app = express(); const app = express();
const server = http.Server(app); const server = http.Server(app);
const DEBUG = true
// Odprti serijski OSC link // Odprti serijski OSC link
let scon = null let scon = null
@ -91,6 +104,14 @@ app.get('/test', (req, res) => {
res.sendFile(__dirname + '/test.html'); res.sendFile(__dirname + '/test.html');
}); });
// Hydra inclusion
app.get('/hydra', function(req, res) {
res.sendFile(__dirname + '/hydra-osc-main/index.html');
});
app.get('/lib/osc.min.js', function(req, res) {
res.sendFile(__dirname + '/hydra-osc-main/lib/osc.min.js');
});
let settings = {}; let settings = {};
app.get('/settings', function(req, res) { app.get('/settings', function(req, res) {
res.send(settings); res.send(settings);
@ -102,7 +123,7 @@ include_files.map(function(file) {
}); });
}); });
server.listen(port, () => console.log('listening on *:' + port)) server.listen(PORT, () => console.log('listening on *:' + PORT))
// Websocket init // Websocket init
const wss = new WebSocket.Server({ server }) const wss = new WebSocket.Server({ server })
@ -110,15 +131,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(6696, '224.0.1.9');
*/
const scudp = new osc.UDPPort({ const scudp = new osc.UDPPort({
remotePort: 57120 remotePort: OSCPORT
//socket: sss //socket: sss
}) })