This commit is contained in:
2023-11-22 20:57:51 +01:00
parent ea0c7f3165
commit 565fc60113
2 changed files with 3 additions and 6 deletions

View File

@ -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 {

View File

@ -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);