add port
This commit is contained in:
@ -27,12 +27,6 @@ socket.onopen = function (event) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function sendToServer(message: OSCMessage) {
|
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) {
|
if (socket.readyState === WebSocket.OPEN) {
|
||||||
socket.send(JSON.stringify(message));
|
socket.send(JSON.stringify(message));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -473,11 +473,14 @@ export class SoundEvent extends AudibleEvent {
|
|||||||
let oscAddress = "address" in event ? event.address : "/topos";
|
let oscAddress = "address" in event ? event.address : "/topos";
|
||||||
oscAddress = oscAddress?.startsWith("/") ? oscAddress : "/" + oscAddress;
|
oscAddress = oscAddress?.startsWith("/") ? oscAddress : "/" + oscAddress;
|
||||||
|
|
||||||
|
let oscPort = "port" in event ? event.port : 57120;
|
||||||
|
|
||||||
if (filteredEvent.freq) {
|
if (filteredEvent.freq) {
|
||||||
delete filteredEvent.note;
|
delete filteredEvent.note;
|
||||||
}
|
}
|
||||||
sendToServer({
|
sendToServer({
|
||||||
address: oscAddress,
|
address: oscAddress,
|
||||||
|
port: oscPort,
|
||||||
message: event,
|
message: event,
|
||||||
timetag: Math.round(Date.now() + this.nudge - this.app.clock.deviation),
|
timetag: Math.round(Date.now() + this.nudge - this.app.clock.deviation),
|
||||||
} as OSCMessage);
|
} as OSCMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user