Voice Activity Detection
diff --git a/js/codec/Codec.js b/js/codec/Codec.js
index a2ddc2ab..5d07d1d7 100644
--- a/js/codec/Codec.js
+++ b/js/codec/Codec.js
@@ -110,7 +110,8 @@ class OpusCodec extends Codec {
}
initialise() {
this.fn_newHandle = Module.cwrap("codec_opus_createNativeHandle", "pointer", ["number", "number"]);
- this.fn_decode = Module.cwrap("codec_opus_decode", "number", ["pointer", "pointer", "number", "number"]); /* codec_opus_decode(handle, buffer, length, maxlength) */
+ this.fn_decode = Module.cwrap("codec_opus_decode", "number", ["pointer", "pointer", "number", "number"]);
+ /* codec_opus_decode(handle, buffer, length, maxlength) */
this.fn_encode = Module.cwrap("codec_opus_encode", "number", ["pointer", "pointer", "number", "number"]);
this.nativeHandle = this.fn_newHandle(this.channelCount, this.type);
this.encodeBufferRaw = Module._malloc(this.bufferSize);
diff --git a/js/codec/Codec.js.map b/js/codec/Codec.js.map
index 9c6070f8..80e63244 100644
--- a/js/codec/Codec.js.map
+++ b/js/codec/Codec.js.map
@@ -1 +1 @@
-{"version":3,"file":"Codec.js","sourceRoot":"","sources":["Codec.ts"],"names":[],"mappings":";;;;;;;;AAAA;IAII,YAAY,MAAmB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,MAAmB,EAAE,SAAiB,EAAE,MAAc;QAC9D,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAChE,GAAG,CAAA,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC;YACrE,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GAAG,CAC9B,IAAI,CAAC,MAAM,CAAC,cAAc,CAA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AAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;QACxH,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YACb,MAAM,CAAC,4BAA4B,GAAG,MAAM,GAAG,GAAG,CAAC;QACvD,CAAC;QACD,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC;QAClG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;CACJ"}
\ No newline at end of file
diff --git a/js/codec/Codec.ts b/js/codec/Codec.ts
index fcc2da40..fcf7cab1 100644
--- a/js/codec/Codec.ts
+++ b/js/codec/Codec.ts
@@ -152,7 +152,8 @@ class OpusCodec extends Codec {
initialise() {
this.fn_newHandle = Module.cwrap("codec_opus_createNativeHandle", "pointer", ["number", "number"]);
- this.fn_decode = Module.cwrap("codec_opus_decode", "number", ["pointer", "pointer", "number", "number"]); /* codec_opus_decode(handle, buffer, length, maxlength) */
+ this.fn_decode = Module.cwrap("codec_opus_decode", "number", ["pointer", "pointer", "number", "number"]);
+ /* codec_opus_decode(handle, buffer, length, maxlength) */
this.fn_encode = Module.cwrap("codec_opus_encode", "number", ["pointer", "pointer", "number", "number"]);
this.nativeHandle = this.fn_newHandle(this.channelCount, this.type);
@@ -164,16 +165,16 @@ class OpusCodec extends Codec {
this.decodeBuffer = new Uint8Array(Module.HEAPU8.buffer, this.decodeBufferRaw, this.bufferSize);
}
- deinitialise() { } //TODO
+ deinitialise() { } //TODO
decode(data: Uint8Array): Promise
{
return new Promise((resolve, reject) => {
- if(data.byteLength > this.decodeBuffer.byteLength) throw "Data to long!";
+ if (data.byteLength > this.decodeBuffer.byteLength) throw "Data to long!";
this.decodeBuffer.set(data);
//console.log("decode(" + data.length + ")");
//console.log(data);
let result = this.fn_decode(this.nativeHandle, this.decodeBuffer.byteOffset, data.byteLength, this.decodeBuffer.byteLength);
- if(result < 0) {
+ if (result < 0) {
reject("invalid result on decode (" + result + ")");
return;
}
@@ -181,8 +182,8 @@ class OpusCodec extends Codec {
let buf = Module.HEAPF32.slice(this.decodeBuffer.byteOffset / 4, (this.decodeBuffer.byteOffset / 4) + (result * this.channelCount));
let audioBuf = AudioController.globalContext.createBuffer(this.channelCount, result, this._codecSampleRate);
- for(let offset = 0; offset < result; offset++) {
- for(let channel = 0; channel < this.channelCount; channel++)
+ for (let offset = 0; offset < result; offset++) {
+ for (let channel = 0; channel < this.channelCount; channel++)
audioBuf.getChannelData(channel)[offset] = buf[offset * this.channelCount + this.channelCount];
}
@@ -191,17 +192,18 @@ class OpusCodec extends Codec {
}
encode(data: AudioBuffer): Uint8Array | string {
- if(data.length * this.channelCount > this.encodeBuffer.length) throw "Data to long!";
+ if (data.length * this.channelCount > this.encodeBuffer.length) throw "Data to long!";
- for(let offset = 0; offset < data.length; offset++) {
- for(let channel = 0; channel < this.channelCount; channel++)
+ for (let offset = 0; offset < data.length; offset++) {
+ for (let channel = 0; channel < this.channelCount; channel++)
this.encodeBuffer[offset * this.channelCount + channel] = data.getChannelData(channel)[offset];
}
let result = this.fn_encode(this.nativeHandle, this.encodeBuffer.byteOffset, data.length, this.encodeBuffer.byteLength);
- if(result < 0) {
+ if (result < 0) {
return "invalid result on encode (" + result + ")";
}
- let buf = Module.HEAP8.slice(this.encodeBuffer.byteOffset , this.encodeBuffer.byteOffset + result);
+ let buf = Module.HEAP8.slice(this.encodeBuffer.byteOffset, this.encodeBuffer.byteOffset + result);
return Uint8Array.from(buf);
}
+}
\ No newline at end of file
diff --git a/js/main.js b/js/main.js
index d05230b3..7009fee1 100644
--- a/js/main.js
+++ b/js/main.js
@@ -10,10 +10,8 @@ let modal = 0;
$("#test").click(function () {
console.log("Executing test function");
});
-//$("#test").trigger("click");
-$("#test_tab").tabify();
//Modals.spawnConnectModal();
-Modals.spawnSettingsModal();
+//Modals.spawnSettingsModal();
/*
createErrorModal("Could not connect to remote host",() => {
let tag = $.spawn("div");
@@ -23,5 +21,10 @@ createErrorModal("Could not connect to remote host",() => {
}, {
footer: ""
}).open();
-*/
+*/
+window.addEventListener("beforeunload", function (event) {
+ if (globalClient.serverConnection && globalClient.serverConnection.connected)
+ event.returnValue = "Are you really sure?
You're still connected!";
+ //event.preventDefault();
+});
//# sourceMappingURL=main.js.map
\ No newline at end of file
diff --git a/js/main.js.map b/js/main.js.map
index 597e2fdc..3ddd4c57 100644
--- a/js/main.js.map
+++ b/js/main.js.map
@@ -1 +1 @@
-{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,kCAAkC;AAClC,uCAAuC;AACvC,iDAAiD;AAGjD,IAAI,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;AAClC,IAAI,IAAI,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACnC,YAAY,CAAC,KAAK,EAAE,CAAC;AACrB,iFAAiF;AAEjF,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IACb,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AACH,8BAA8B;AAC9B,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,CAAC;AAExB,6BAA6B;AAC7B,MAAM,CAAC,kBAAkB,EAAE,CAAC;AAC5B;;;;;;;;;EASE"}
\ No newline at end of file
+{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,kCAAkC;AAClC,uCAAuC;AACvC,iDAAiD;AAGjD,IAAI,YAAY,GAAG,IAAI,QAAQ,EAAE,CAAC;AAClC,IAAI,IAAI,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACnC,YAAY,CAAC,KAAK,EAAE,CAAC;AACrB,iFAAiF;AAEjF,IAAI,KAAK,GAAG,CAAC,CAAC;AACd,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC;IACb,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,6BAA6B;AAC7B,8BAA8B;AAC9B;;;;;;;;;EASE;AAEF,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,UAAU,KAAK;IACnD,EAAE,CAAA,CAAC,YAAY,CAAC,gBAAgB,IAAI,YAAY,CAAC,gBAAgB,CAAC,SAAS,CAAC;QACxE,KAAK,CAAC,WAAW,GAAG,iDAAiD,CAAC;IAC1E,yBAAyB;AAC7B,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/js/main.ts b/js/main.ts
index 208a6094..33067435 100644
--- a/js/main.ts
+++ b/js/main.ts
@@ -13,11 +13,9 @@ let modal = 0;
$("#test").click(function () {
console.log("Executing test function");
});
-//$("#test").trigger("click");
-$("#test_tab").tabify();
//Modals.spawnConnectModal();
-Modals.spawnSettingsModal();
+//Modals.spawnSettingsModal();
/*
createErrorModal("Could not connect to remote host",() => {
let tag = $.spawn("div");
@@ -27,4 +25,10 @@ createErrorModal("Could not connect to remote host",() => {
}, {
footer: ""
}).open();
-*/
\ No newline at end of file
+*/
+
+window.addEventListener("beforeunload", function (event) {
+ if(globalClient.serverConnection && globalClient.serverConnection.connected)
+ event.returnValue = "Are you really sure?
You're still connected!";
+ //event.preventDefault();
+});
\ No newline at end of file