add port
This commit is contained in:
@ -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 {
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user