2 lines
9.7 KiB
JavaScript
2 lines
9.7 KiB
JavaScript
window.JitsiMeetJS=window.JitsiMeetJS||{},window.JitsiMeetJS.app=window.JitsiMeetJS.app||{},window.JitsiMeetJS.app.effects=window.JitsiMeetJS.app.effects||{},window.JitsiMeetJS.app.effects.rnnoise=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/libs/",n(n.s=2)}([function(t,e,n){"use strict";(function(t){var n,r=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var r;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(t,e){r=t}));var i,o={};for(i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);var s,a,u=[];s="object"==typeof window,a="function"==typeof importScripts,"object"==typeof t&&"object"==typeof t.versions&&t.versions.node;var c,f="";(s||a)&&(a?f=self.location.href:document.currentScript&&(f=document.currentScript.src),n&&(f=n),f=0!==f.indexOf("blob:")?f.substr(0,f.lastIndexOf("/")+1):"",a&&(c=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}));var l,m,p=e.print||console.log.bind(console),h=e.printErr||console.warn.bind(console);for(i in o)o.hasOwnProperty(i)&&(e[i]=o[i]);o=null,e.arguments&&(u=e.arguments),e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(l=e.wasmBinary),e.noExitRuntime&&e.noExitRuntime,"object"!=typeof WebAssembly&&h("no native wasm support detected");var d,y,w,_=new WebAssembly.Table({initial:1,maximum:1,element:"anyfunc"}),b=!1;function v(t){d=t,e.HEAP8=new Int8Array(t),e.HEAP16=new Int16Array(t),e.HEAP32=w=new Int32Array(t),e.HEAPU8=y=new Uint8Array(t),e.HEAPU16=new Uint16Array(t),e.HEAPU32=new Uint32Array(t),e.HEAPF32=new Float32Array(t),e.HEAPF64=new Float64Array(t)}var g=e.INITIAL_MEMORY||16777216;function P(t){for(;t.length>0;){var n=t.shift();if("function"!=typeof n){var r=n.func;"number"==typeof r?void 0===n.arg?e.dynCall_v(r):e.dynCall_vi(r,n.arg):r(void 0===n.arg?null:n.arg)}else n(e)}}(m=e.wasmMemory?e.wasmMemory:new WebAssembly.Memory({initial:g/65536,maximum:32768}))&&(d=m.buffer),g=d.byteLength,v(d),w[24364]=5340496;var I=[],A=[],R=[],S=[],T=0,M=null,E=null;function O(t){throw e.onAbort&&e.onAbort(t),p(t+=""),h(t),b=!0,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(t)}function x(t){return e=t,n="data:application/octet-stream;base64,",String.prototype.startsWith?e.startsWith(n):0===e.indexOf(n);var e,n}e.preloadedImages={},e.preloadedAudios={};var W,J="rnnoise.wasm";function j(){try{if(l)return new Uint8Array(l);if(c)return c(J);throw"both async and sync fetching of the wasm failed"}catch(t){O(t)}}function F(t){try{return m.grow(t-d.byteLength+65535>>>16),v(m.buffer),1}catch(t){}}x(J)||(W=J,J=e.locateFile?e.locateFile(W,f):f+W),A.push({func:function(){B()}});var L,H={a:function(t,e,n){y.copyWithin(t,e,e+n)},b:function(t){t>>>=0;var e=y.length;if(t>2147483648)return!1;for(var n,r,i=1;i<=4;i*=2){var o=e*(1+.2/i);if(o=Math.min(o,t+100663296),F(Math.min(2147483648,((n=Math.max(16777216,t,o))%(r=65536)>0&&(n+=r-n%r),n))))return!0}return!1},memory:m,table:_},B=(function(){var t={a:H};function n(t,n){var r=t.exports;e.asm=r,function(t){if(T--,e.monitorRunDependencies&&e.monitorRunDependencies(T),0==T&&(null!==M&&(clearInterval(M),M=null),E)){var n=E;E=null,n()}}()}function r(t){n(t.instance)}function i(e){return(l||!s&&!a||"function"!=typeof fetch?new Promise((function(t,e){t(j())})):fetch(J,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+J+"'";return t.arrayBuffer()})).catch((function(){return j()}))).then((function(e){return WebAssembly.instantiate(e,t)})).then(e,(function(t){h("failed to asynchronously prepare wasm: "+t),O(t)}))}if(T++,e.monitorRunDependencies&&e.monitorRunDependencies(T),e.instantiateWasm)try{return e.instantiateWasm(t,n)}catch(t){return h("Module.instantiateWasm callback failed with error: "+t),!1}!function(){if(l||"function"!=typeof WebAssembly.instantiateStreaming||x(J)||"function"!=typeof fetch)return i(r);fetch(J,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(r,(function(t){return h("wasm streaming compile failed: "+t),h("falling back to ArrayBuffer instantiation"),i(r)}))}))}()}(),e.___wasm_call_ctors=function(){return(B=e.___wasm_call_ctors=e.asm.c).apply(null,arguments)});function C(t){function n(){L||(L=!0,e.calledRun=!0,b||(P(A),P(R),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),S.unshift(t);var t;P(S)}()))}t=t||u,T>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),I.unshift(t);var t;P(I)}(),T>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),n()}),1)):n()))}if(e._rnnoise_init=function(){return(e._rnnoise_init=e.asm.d).apply(null,arguments)},e._rnnoise_create=function(){return(e._rnnoise_create=e.asm.e).apply(null,arguments)},e._malloc=function(){return(e._malloc=e.asm.f).apply(null,arguments)},e._rnnoise_destroy=function(){return(e._rnnoise_destroy=e.asm.g).apply(null,arguments)},e._free=function(){return(e._free=e.asm.h).apply(null,arguments)},e._rnnoise_process_frame=function(){return(e._rnnoise_process_frame=e.asm.i).apply(null,arguments)},E=function t(){L||C(),L||(E=t)},e.run=C,e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return C(),e.ready});e.a=r}).call(this,n(1))},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],f=!1,l=-1;function m(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&p())}function p(){if(!f){var t=a(m);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function d(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new h(t,e)),1!==c.length||f||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=d,i.addListener=d,i.once=d,i.off=d,i.removeListener=d,i.removeAllListeners=d,i.emit=d,i.prependListener=d,i.prependOnceListener=d,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";n.r(e),n.d(e,"RNNOISE_SAMPLE_LENGTH",(function(){return i})),n.d(e,"createRnnoiseProcessor",(function(){return u}));var r=n(0);const i=480,o=4*i;class s{constructor(t){var e,n,r;r=!1,(n="_destroyed")in(e=this)?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r;try{if(this._wasmInterface=t,this._wasmPcmInput=this._wasmInterface._malloc(o),!this._wasmPcmInput)throw Error("Failed to create wasm input memory buffer!");if(this._wasmPcmOutput=this._wasmInterface._malloc(o),!this._wasmPcmOutput)throw t._free(this._wasmPcmInput),Error("Failed to create wasm output memory buffer!");this._wasmPcmInputF32Index=this._wasmPcmInput/4,this._context=this._wasmInterface._rnnoise_create()}catch(t){throw this._releaseWasmResources(),t}}_copyPCMSampleToWasmBuffer(t){this._wasmInterface.HEAPF32.set(t,this._wasmPcmInputF32Index)}_convertTo16BitPCM(t){for(const[e,n]of t.entries())t[e]=32767*n}_releaseWasmResources(){this._wasmPcmInput&&(this._wasmInterface._free(this._wasmPcmInput),this._wasmPcmInput=null),this._wasmPcmOutput&&(this._wasmInterface._free(this._wasmPcmOutput),this._wasmPcmOutput=null),this._context&&(this._wasmInterface._rnnoise_destroy(this._context),this._context=null)}getSampleLength(){return i}getRequiredPCMFrequency(){return 44100}destroy(){this._destroyed||(this._releaseWasmResources(),this._destroyed=!0)}calculateAudioFrameVAD(t){if(this._destroyed)throw new Error("RnnoiseProcessor instance is destroyed, please create another one!");const e=t.length;if(e!==i)throw new Error("Rnnoise can only process PCM frames of 480 samples! Input sample was:"+e);return this._convertTo16BitPCM(t),this._copyPCMSampleToWasmBuffer(t),this._wasmInterface._rnnoise_process_frame(this._context,this._wasmPcmOutput,this._wasmPcmInput)}}let a;function u(){return a||(a=Object(r.a)()),a.then(t=>new s(t))}}]);
|
|
//# sourceMappingURL=rnnoise-processor.min.map
|