From 565fc60113eaacd95083ea2c1ecfeb52ee66ea2a Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Wed, 22 Nov 2023 20:57:51 +0100 Subject: [PATCH] add port --- src/IO/OSC.ts | 6 ------ src/classes/SoundEvent.ts | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/IO/OSC.ts b/src/IO/OSC.ts index 9f8e429..33e87fa 100644 --- a/src/IO/OSC.ts +++ b/src/IO/OSC.ts @@ -27,12 +27,6 @@ socket.onopen = function (event) { }; export function sendToServer(message: OSCMessage) { - // Check the port in the message and change port if necessary - if (message.port != parseInt(socket.url.split(":")[2])) { - socket.close(); - socket = new WebSocket(`ws://localhost:${message.port}`); - } - if (socket.readyState === WebSocket.OPEN) { socket.send(JSON.stringify(message)); } else { diff --git a/src/classes/SoundEvent.ts b/src/classes/SoundEvent.ts index 166540a..90b3567 100644 --- a/src/classes/SoundEvent.ts +++ b/src/classes/SoundEvent.ts @@ -473,11 +473,14 @@ export class SoundEvent extends AudibleEvent { let oscAddress = "address" in event ? event.address : "/topos"; oscAddress = oscAddress?.startsWith("/") ? oscAddress : "/" + oscAddress; + let oscPort = "port" in event ? event.port : 57120; + if (filteredEvent.freq) { delete filteredEvent.note; } sendToServer({ address: oscAddress, + port: oscPort, message: event, timetag: Math.round(Date.now() + this.nudge - this.app.clock.deviation), } as OSCMessage);