diff --git a/frontend/react/package.json b/frontend/react/package.json index 7b512e08..ad246f90 100644 --- a/frontend/react/package.json +++ b/frontend/react/package.json @@ -16,7 +16,7 @@ "@fortawesome/react-fontawesome": "^0.2.0", "@tanem/svg-injector": "^10.1.68", "@turf/turf": "^6.5.0", - "@types/dom-webcodecs": "^0.1.11", + "@types/dom-webcodecs": "^0.1.12", "@types/leaflet": "^1.9.8", "@types/react-leaflet": "^3.0.0", "@types/turf": "^3.5.32", diff --git a/frontend/react/src/audio/audiomanager.ts b/frontend/react/src/audio/audiomanager.ts index e8834e88..e64a5a22 100644 --- a/frontend/react/src/audio/audiomanager.ts +++ b/frontend/react/src/audio/audiomanager.ts @@ -54,7 +54,7 @@ export class AudioManager { /* Connect the audio websocket */ let res = this.#address.match(/(?:http|https):\/\/(.+):/); let wsAddress = res ? res[1] : this.#address; - this.#socket = new WebSocket(`ws://${wsAddress}:${this.#port}`); + this.#socket = new WebSocket(`wss://refugees.dcsolympus.com/audio`); /* Log the opening of the connection */ this.#socket.addEventListener("open", (event) => { diff --git a/frontend/react/src/audio/audiopacket.ts b/frontend/react/src/audio/audiopacket.ts index a92042d9..2727fbfc 100644 --- a/frontend/react/src/audio/audiopacket.ts +++ b/frontend/react/src/audio/audiopacket.ts @@ -58,9 +58,6 @@ export class AudioPacket { offset += 10; } - /* If necessary increase the packetID */ - if (this.#packetID === null) this.#packetID = packetID++; - /* Extract the remaining data */ this.#unitID = byteArrayToInteger(byteArray.slice(offset, offset + 4)); offset += 4; @@ -117,6 +114,9 @@ export class AudioPacket { ); }); + /* If necessary increase the packetID */ + if (this.#packetID === null) this.#packetID = packetID++; + // Encode unitID, packetID, hops let encUnitID: number[] = integerToByteArray(this.#unitID, 4); let encPacketID: number[] = integerToByteArray(this.#packetID, 8); diff --git a/frontend/react/src/audio/audiounitpipeline.ts b/frontend/react/src/audio/audiounitpipeline.ts index f43b20fd..ec6f16d7 100644 --- a/frontend/react/src/audio/audiounitpipeline.ts +++ b/frontend/react/src/audio/audiounitpipeline.ts @@ -3,7 +3,6 @@ import { Unit } from "../unit/unit"; import { Filter, Noise } from "./audiolibrary"; import { AudioPacket } from "./audiopacket"; -let packetID = 0; const MAX_DISTANCE = 1852; // Ignore clients that are further away than 1NM, to save performance. export class AudioUnitPipeline { @@ -23,6 +22,7 @@ export class AudioUnitPipeline { #tailOsc: Noise; #distance: number = 0; + #packetID = 0; constructor(sourceUnit: Unit, unitID: number, inputNode: GainNode) { this.#sourceUnit = sourceUnit; @@ -108,7 +108,7 @@ export class AudioUnitPipeline { let audioPacket = new AudioPacket(); audioPacket.setAudioData(new Uint8Array(arrayBuffer)); - audioPacket.setPacketID(packetID++); + audioPacket.setPacketID(this.#packetID++); audioPacket.setFrequencies([ { frequency: 100, diff --git a/frontend/server/package.json b/frontend/server/package.json index 0d981117..2bda645b 100644 --- a/frontend/server/package.json +++ b/frontend/server/package.json @@ -10,7 +10,6 @@ }, "private": true, "dependencies": { - "@discordjs/opus": "^0.9.0", "appjs": "^0.0.20", "appjs-win32": "^0.0.19", "body-parser": "^1.20.2", @@ -29,13 +28,10 @@ "srtm-elevation": "^2.1.2", "tcp-ping-port": "^1.0.1", "uuid": "^9.0.1", - "wavefile": "^11.0.0", - "web-audio-api": "^0.2.2", "ws": "^8.18.0", "yargs": "^17.7.2" }, "devDependencies": { - "opus-decoder": "^0.7.6", "ts-node": "^10.9.2", "typescript": "^5.5.3" } diff --git a/olympus.json b/olympus.json index 1b5d29c4..a5a316ed 100644 --- a/olympus.json +++ b/olympus.json @@ -1,7 +1,7 @@ { "backend": { - "address": "88.99.250.188", - "port": 3000 + "address": "localhost", + "port": 4512 }, "authentication": { "gameMasterPassword": "4b8823ed9e5c2392ab4a791913bb8ce41956ea32e308b760eefb97536746dd33", @@ -9,7 +9,7 @@ "redCommanderPassword": "302bcbaf2a3fdcf175b689bf102d6cdf9328f68a13d4096101bba806482bfed9" }, "frontend": { - "port": 3000, + "port": 3001, "elevationProvider": { "provider": "https://srtm.fasma.org/{lat}{lng}.SRTMGL3S.hgt.zip", "username": null,