Small bugfixes from preview on server

This commit is contained in:
Pax1601
2024-10-08 08:30:26 +02:00
parent 0003363d71
commit 88cf20a4d9
6 changed files with 10 additions and 14 deletions

View File

@@ -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",

View File

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

View File

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

View File

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

View File

@@ -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"
}

View File

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