diff --git a/anim.js b/anim.js index 27cbd61..3831bb8 100644 --- a/anim.js +++ b/anim.js @@ -141,8 +141,8 @@ function modulirajParametre() { obj_limit *= 1 - dqY; } if (keysPressed[0]) { - width *= 1 + (dqX / 2); - barva_mod += (dqZ / 100); + width *= 1 + (dqX / 3); + barva_mod += (dqZ / 1000); } } diff --git a/package.json b/package.json index 49e9118..0fc32fa 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "osc": "^2.4.2", "pm2": "^5.1.0", "three": "0.135.0", - "ws": "^7.3.1" + "ws": "^7.3.1", + "hydra-osc": "dev-master" }, "scripts": { "start": "npx nodemon server.js /dev/ttyUSB0" diff --git a/server.js b/server.js index ac4e5f0..4c05a94 100644 --- a/server.js +++ b/server.js @@ -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 http = require('http') const WebSocket = require('ws') const osc = require('osc') const readline = require('readline') const fs = require('fs') - -const port = 6676 // Vzemi iz argumenta const tty = process.argv[2] @@ -30,8 +45,6 @@ const include_files = [ const app = express(); const server = http.Server(app); -const DEBUG = true - // Odprti serijski OSC link let scon = null @@ -91,6 +104,14 @@ app.get('/test', (req, res) => { 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 = {}; app.get('/settings', function(req, res) { 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 const wss = new WebSocket.Server({ server }) @@ -110,15 +131,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'); +*/ const scudp = new osc.UDPPort({ - remotePort: 57120 + remotePort: OSCPORT //socket: sss })