diff --git a/frontend/react/src/audio/audiounitpipeline.ts b/frontend/react/src/audio/audiounitpipeline.ts index f10e0a21..f43b20fd 100644 --- a/frontend/react/src/audio/audiounitpipeline.ts +++ b/frontend/react/src/audio/audiounitpipeline.ts @@ -3,6 +3,7 @@ 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 { @@ -107,6 +108,7 @@ export class AudioUnitPipeline { let audioPacket = new AudioPacket(); audioPacket.setAudioData(new Uint8Array(arrayBuffer)); + audioPacket.setPacketID(packetID++); audioPacket.setFrequencies([ { frequency: 100, diff --git a/frontend/react/src/audio/radiosink.ts b/frontend/react/src/audio/radiosink.ts index d8f8cbff..f6767b4e 100644 --- a/frontend/react/src/audio/radiosink.ts +++ b/frontend/react/src/audio/radiosink.ts @@ -2,6 +2,8 @@ import { AudioSink } from "./audiosink"; import { AudioPacket } from "./audiopacket"; import { getApp } from "../olympusapp"; +let packetID = 0; + /* Radio sink, basically implements a simple SRS Client in Olympus. Does not support encryption at this moment */ export class RadioSink extends AudioSink { #encoder: AudioEncoder; @@ -102,6 +104,7 @@ export class RadioSink extends AudioSink { if (this.#ptt) { let audioPacket = new AudioPacket(); audioPacket.setAudioData(new Uint8Array(arrayBuffer)); + audioPacket.setPacketID(packetID++); audioPacket.setFrequencies([{ frequency: this.#frequency, modulation: this.#modulation, diff --git a/frontend/react/src/radio/microphonehandler.ts b/frontend/react/src/radio/microphonehandler.ts deleted file mode 100644 index 90f6a68d..00000000 --- a/frontend/react/src/radio/microphonehandler.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { SRSRadioSetting } from "../interfaces"; -import { AudioPacket } from "./audiopacket"; -import { CapturePipeline } from "./capturepipeline"; - -export class MicrophoneHandler { - #socket: WebSocket; - #setting: SRSRadioSetting; - - constructor(socket, setting) { - this.#socket = socket; - this.#setting = setting; - - console.log("Starting microphone handler"); - - const pipeline = new CapturePipeline(); - - navigator.mediaDevices.enumerateDevices() - .then(function(devices) { - devices.forEach(function(device) { - console.log(device.kind + ": " + device.label + - " id = " + device.deviceId); - }); - }) - - pipeline.connect().then(() => { - pipeline.onencoded = (data) => { - let buffer = new ArrayBuffer(data.byteLength); - data.copyTo(buffer); - let packet = new AudioPacket(new Uint8Array(buffer), this.#setting); - this.#socket.send(packet.getArray()); - } - }) - } -}