opus-codec-worker 0.0.81 → 0.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/worker.js +1 -1
- package/worklet/worklet.js +1 -1
package/package.json
CHANGED
package/worker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e={514:(e,t,r)=>{"use strict";function n(e){return{type:a.OpusGetRequest,data:e,requestId:c()}}function s(e){return{type:a.OpusSetRequest,data:e,requestId:c()}}function i(e,t,r){return{type:a.CreateDecoder,data:{frameSize:r,sampleRate:e,channels:t},requestId:c()}}function o(e){return{type:a.DestroyEncoder,data:e,requestId:c()}}var a;function u(e){return{requestId:c(),data:e,type:a.InitializeWorker}}function _(e){return{type:a.DestroyDecoder,data:{decoderId:e},requestId:c()}}function d(e){return{type:a.DecodeFloat,data:e,requestId:c(),transfer:[e.encoded]}}function c(){return crypto.getRandomValues(new Int32Array(4)).join("-")}function l(e){return{data:e,requestId:c(),type:a.CreateEncoder}}function p(e){return{data:e,requestId:c(),type:a.EncodeFloat,transfer:null!==e.input?[e.input.pcm]:[]}}r.r(t),r.d(t,{RequestType:()=>a,createDecoder:()=>i,createEncoder:()=>l,decodeFloat:()=>d,destroyDecoder:()=>_,destroyEncoder:()=>o,encodeFloat:()=>p,getFromEncoder:()=>n,initializeWorker:()=>u,setToEncoder:()=>s}),function(e){e[e.CreateEncoder=0]="CreateEncoder",e[e.CreateDecoder=1]="CreateDecoder",e[e.EncodeFloat=2]="EncodeFloat",e[e.DecodeFloat=3]="DecodeFloat",e[e.DestroyEncoder=4]="DestroyEncoder",e[e.InitializeWorker=5]="InitializeWorker",e[e.DestroyDecoder=6]="DestroyDecoder",e[e.OpusGetRequest=7]="OpusGetRequest",e[e.OpusSetRequest=8]="OpusSetRequest"}(a||(a={}))},440:(e,t,r)=>{"use strict";var n;function s(e,t){return{encoderId:e,type:n.SetComplexity,value:t}}function i(e){return{encoderId:e,type:n.GetComplexity}}function o(e,t){return{encoderId:e,type:n.SetBitrate,value:t}}function a(e){return{encoderId:e,type:n.GetBitrate}}function u(e,t){return{encoderId:e,type:n.SetVbr,value:t}}function _(e){return{encoderId:e,type:n.GetVbr}}function d(e,t){return{encoderId:e,type:n.SetVbrConstraint,value:t}}function c(e){return{encoderId:e,type:n.GetVbrConstraint}}function l(e,t){return{encoderId:e,type:n.SetForceChannels,value:t}}function p(e){return{encoderId:e,type:n.GetForceChannels}}function f(e,t){return{encoderId:e,type:n.SetMaxBandwidth,value:t}}function h(e){return{encoderId:e,type:n.GetMaxBandwidth}}function S(e,t){return{encoderId:e,type:n.SetBandwidth,value:t}}function O(e,t){return{encoderId:e,type:n.SetSignal,value:t}}function E(e){return{encoderId:e,type:n.GetSignal}}function m(e,t){return{encoderId:e,type:n.SetApplication,value:t}}function P(e){return{encoderId:e,type:n.GetApplication}}function I(e){return{encoderId:e,type:n.GetLookahead}}function y(e,t){return{encoderId:e,type:n.SetInbandFec,value:t}}function g(e){return{encoderId:e,type:n.GetInbandFec}}function R(e,t){return{encoderId:e,type:n.SetPacketLossperc,value:t}}function T(e){return{encoderId:e,type:n.GetPacketLossperc}}function b(e,t){return{encoderId:e,type:n.SetDtx,value:t}}function v(e){return{encoderId:e,type:n.GetDtx}}function A(e,t){return{encoderId:e,type:n.SetLsbDepth,value:t}}function U(e){return{encoderId:e,type:n.GetLsbDepth}}function w(e,t){return{encoderId:e,type:n.SetExpertFrameduration,value:t}}function D(e){return{encoderId:e,type:n.GetExpertFrameduration}}function G(e,t){return{encoderId:e,type:n.SetPredictionDisabled,value:t}}function F(e){return{encoderId:e,type:n.GetPredictionDisabled}}function B(e){return{encoderId:e,type:n.GetBandwidth}}function L(e){return{encoderId:e,type:n.GetSampleRate}}function N(e,t){return{encoderId:e,type:n.SetPhaseInversiondisabled,value:t}}function q(e){return{encoderId:e,type:n.GetPhaseInversiondisabled}}function C(e){return{encoderId:e,type:n.GetInDtx}}function x(e,t){return{encoderId:e,type:n.SetGain,value:t}}function k(e){return{encoderId:e,type:n.GetGain}}function M(e){return{encoderId:e,type:n.GetLastPacketduration}}function K(e){return{encoderId:e,type:n.GetPitch}}r.r(t),r.d(t,{OPUS_GET_APPLICATION:()=>P,OPUS_GET_BANDWIDTH:()=>B,OPUS_GET_BITRATE:()=>a,OPUS_GET_COMPLEXITY:()=>i,OPUS_GET_DTX:()=>v,OPUS_GET_EXPERT_FRAME_DURATION:()=>D,OPUS_GET_FORCE_CHANNELS:()=>p,OPUS_GET_GAIN:()=>k,OPUS_GET_INBAND_FEC:()=>g,OPUS_GET_IN_DTX:()=>C,OPUS_GET_LAST_PACKET_DURATION:()=>M,OPUS_GET_LOOKAHEAD:()=>I,OPUS_GET_LSB_DEPTH:()=>U,OPUS_GET_MAX_BANDWIDTH:()=>h,OPUS_GET_PACKET_LOSS_PERC:()=>T,OPUS_GET_PHASE_INVERSION_DISABLED:()=>q,OPUS_GET_PITCH:()=>K,OPUS_GET_PREDICTION_DISABLED:()=>F,OPUS_GET_SAMPLE_RATE:()=>L,OPUS_GET_SIGNAL:()=>E,OPUS_GET_VBR:()=>_,OPUS_GET_VBR_CONSTRAINT:()=>c,OPUS_SET_APPLICATION:()=>m,OPUS_SET_BANDWIDTH:()=>S,OPUS_SET_BITRATE:()=>o,OPUS_SET_COMPLEXITY:()=>s,OPUS_SET_DTX:()=>b,OPUS_SET_EXPERT_FRAME_DURATION:()=>w,OPUS_SET_FORCE_CHANNELS:()=>l,OPUS_SET_GAIN:()=>x,OPUS_SET_INBAND_FEC:()=>y,OPUS_SET_LSB_DEPTH:()=>A,OPUS_SET_MAX_BANDWIDTH:()=>f,OPUS_SET_PACKET_LOSS_PERC:()=>R,OPUS_SET_PHASE_INVERSION_DISABLED:()=>N,OPUS_SET_PREDICTION_DISABLED:()=>G,OPUS_SET_SIGNAL:()=>O,OPUS_SET_VBR:()=>u,OPUS_SET_VBR_CONSTRAINT:()=>d,OpusRequest:()=>n}),function(e){e.SetComplexity="OPUS_SET_COMPLEXITY",e.GetComplexity="OPUS_GET_COMPLEXITY",e.SetBitrate="OPUS_SET_BITRATE",e.GetBitrate="OPUS_GET_BITRATE",e.SetVbr="OPUS_SET_VBR",e.GetVbr="OPUS_GET_VBR",e.SetVbrConstraint="OPUS_SET_VBR_CONSTRAINT",e.GetVbrConstraint="OPUS_GET_VBR_CONSTRAINT",e.SetForceChannels="OPUS_SET_FORCE_CHANNELS",e.GetForceChannels="OPUS_GET_FORCE_CHANNELS",e.SetMaxBandwidth="OPUS_SET_MAX_BANDWIDTH",e.GetMaxBandwidth="OPUS_GET_MAX_BANDWIDTH",e.SetBandwidth="OPUS_SET_BANDWIDTH",e.SetSignal="OPUS_SET_SIGNAL",e.GetSignal="OPUS_GET_SIGNAL",e.SetApplication="OPUS_SET_APPLICATION",e.GetApplication="OPUS_GET_APPLICATION",e.GetLookahead="OPUS_GET_LOOKAHEAD",e.SetInbandFec="OPUS_SET_INBAND_FEC",e.GetInbandFec="OPUS_GET_INBAND_FEC",e.SetPacketLossperc="OPUS_SET_PACKET_LOSS_PERC",e.GetPacketLossperc="OPUS_GET_PACKET_LOSS_PERC",e.SetDtx="OPUS_SET_DTX",e.GetDtx="OPUS_GET_DTX",e.SetLsbDepth="OPUS_SET_LSB_DEPTH",e.GetLsbDepth="OPUS_GET_LSB_DEPTH",e.SetExpertFrameduration="OPUS_SET_EXPERT_FRAME_DURATION",e.GetExpertFrameduration="OPUS_GET_EXPERT_FRAME_DURATION",e.SetPredictionDisabled="OPUS_SET_PREDICTION_DISABLED",e.GetPredictionDisabled="OPUS_GET_PREDICTION_DISABLED",e.GetBandwidth="OPUS_GET_BANDWIDTH",e.GetSampleRate="OPUS_GET_SAMPLE_RATE",e.SetPhaseInversiondisabled="OPUS_SET_PHASE_INVERSION_DISABLED",e.GetPhaseInversiondisabled="OPUS_GET_PHASE_INVERSION_DISABLED",e.GetInDtx="OPUS_GET_IN_DTX",e.SetGain="OPUS_SET_GAIN",e.GetGain="OPUS_GET_GAIN",e.GetLastPacketduration="OPUS_GET_LAST_PACKET_DURATION",e.GetPitch="OPUS_GET_PITCH"}(n||(n={}))},618:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Decoder:()=>_,Encoder:()=>u,RingBuffer:()=>d,constants:()=>o});var n=r(530),s=r(619),i=r(507);const o={OPUS_OK:0,OPUS_BAD_ARG:-1,OPUS_BUFFER_TOO_SMALL:-2,OPUS_INTERNAL_ERROR:-3,OPUS_INVALID_PACKET:-4,OPUS_UNIMPLEMENTED:-5,OPUS_INVALID_STATE:-6," OPUS_ALLOC_FAIL":-7,OPUS_AUTO:-1e3,OPUS_BITRATE_MAX:-1,OPUS_APPLICATION_VOIP:2048,OPUS_APPLICATION_AUDIO:2049,OPUS_APPLICATION_RESTRICTED_LOWDELAY:2051,OPUS_SIGNAL_VOICE:3001,OPUS_SIGNAL_MUSIC:3002,OPUS_BANDWIDTH_NARROWBAND:1101,OPUS_BANDWIDTH_MEDIUMBAND:1102,OPUS_BANDWIDTH_WIDEBAND:1103,OPUS_BANDWIDTH_SUPERWIDEBAND:1104,OPUS_BANDWIDTH_FULLBAND:1105,OPUS_FRAMESIZE_ARG:5e3,OPUS_FRAMESIZE_2_5_MS:5001,OPUS_FRAMESIZE_5_MS:5002,OPUS_FRAMESIZE_10_MS:5003,OPUS_FRAMESIZE_20_MS:5004,OPUS_FRAMESIZE_40_MS:5005,OPUS_FRAMESIZE_60_MS:5006,OPUS_FRAMESIZE_80_MS:5007,OPUS_FRAMESIZE_100_MS:5008,OPUS_FRAMESIZE_120_MS:5009};class a{#e;#t;#r;constructor(e,t){this.#t=e,this.#r=new n.Z(e),this.#e=t}setComplexity(e){return this.#t.originalRuntime()._opus_set_complexity(this.#e,e)===o.OPUS_OK}getComplexity(){if(this.#t.originalRuntime()._opus_get_complexity(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_COMPLEXITY");return this.#r.value()}setBitrate(e){return this.#t.originalRuntime()._opus_set_bitrate(this.#e,e)===o.OPUS_OK}getBitrate(){if(this.#t.originalRuntime()._opus_get_bitrate(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_BITRATE");return this.#r.value()}setVbr(e){return this.#t.originalRuntime()._opus_set_vbr(this.#e,e)===o.OPUS_OK}getVbr(){if(this.#t.originalRuntime()._opus_get_vbr(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR");return this.#r.value()}setVbrConstraint(e){return this.#t.originalRuntime()._opus_set_vbr_constraint(this.#e,e)===o.OPUS_OK}getVbrConstraint(){if(this.#t.originalRuntime()._opus_get_vbr_constraint(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR_CONSTRAINT");return this.#r.value()}setForceChannels(e){return this.#t.originalRuntime()._opus_set_force_channels(this.#e,e)===o.OPUS_OK}getForceChannels(){if(this.#t.originalRuntime()._opus_get_force_channels(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_FORCE_CHANNELS");return this.#r.value()}setMaxBandwidth(e){return this.#t.originalRuntime()._opus_set_max_bandwidth(this.#e,e)===o.OPUS_OK}getMaxBandwidth(){if(this.#t.originalRuntime()._opus_get_max_bandwidth(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_MAX_BANDWIDTH");return this.#r.value()}setBandwidth(e){return this.#t.originalRuntime()._opus_set_bandwidth(this.#e,e)===o.OPUS_OK}setSignal(e){return this.#t.originalRuntime()._opus_set_signal(this.#e,e)===o.OPUS_OK}getSignal(){if(this.#t.originalRuntime()._opus_get_signal(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_SIGNAL");return this.#r.value()}setApplication(e){return this.#t.originalRuntime()._opus_set_application(this.#e,e)===o.OPUS_OK}getApplication(){if(this.#t.originalRuntime()._opus_get_application(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_APPLICATION");return this.#r.value()}getLookahead(){if(this.#t.originalRuntime()._opus_get_lookahead(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_LOOKAHEAD");return this.#r.value()}setInbandFec(e){return this.#t.originalRuntime()._opus_set_inband_fec(this.#e,e)===o.OPUS_OK}getInbandFec(){if(this.#t.originalRuntime()._opus_get_inband_fec(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_INBAND_FEC");return this.#r.value()}setPacketLossperc(e){return this.#t.originalRuntime()._opus_set_packet_loss_perc(this.#e,e)===o.OPUS_OK}getPacketLossperc(){if(this.#t.originalRuntime()._opus_get_packet_loss_perc(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_PACKET_LOSS_PERC");return this.#r.value()}setDtx(e){return this.#t.originalRuntime()._opus_set_dtx(this.#e,e)===o.OPUS_OK}getDtx(){if(this.#t.originalRuntime()._opus_get_dtx(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_DTX");return this.#r.value()}setLsbDepth(e){return this.#t.originalRuntime()._opus_set_lsb_depth(this.#e,e)===o.OPUS_OK}getLsbDepth(){if(this.#t.originalRuntime()._opus_get_lsb_depth(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_LSB_DEPTH");return this.#r.value()}setExpertFrameduration(e){return this.#t.originalRuntime()._opus_set_expert_frame_duration(this.#e,e)===o.OPUS_OK}getExpertFrameduration(){if(this.#t.originalRuntime()._opus_get_expert_frame_duration(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_EXPERT_FRAME_DURATION");return this.#r.value()}setPredictionDisabled(e){return this.#t.originalRuntime()._opus_set_prediction_disabled(this.#e,e)===o.OPUS_OK}getPredictionDisabled(){if(this.#t.originalRuntime()._opus_get_prediction_disabled(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_PREDICTION_DISABLED");return this.#r.value()}getBandwidth(){if(this.#t.originalRuntime()._opus_get_bandwidth(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_BANDWIDTH");return this.#r.value()}getSampleRate(){if(this.#t.originalRuntime()._opus_get_sample_rate(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_SAMPLE_RATE");return this.#r.value()}setPhaseInversiondisabled(e){return this.#t.originalRuntime()._opus_set_phase_inversion_disabled(this.#e,e)===o.OPUS_OK}getPhaseInversiondisabled(){if(this.#t.originalRuntime()._opus_get_phase_inversion_disabled(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_PHASE_INVERSION_DISABLED");return this.#r.value()}getInDtx(){if(this.#t.originalRuntime()._opus_get_in_dtx(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_IN_DTX");return this.#r.value()}setGain(e){return this.#t.originalRuntime()._opus_set_gain(this.#e,e)===o.OPUS_OK}getGain(){if(this.#t.originalRuntime()._opus_get_gain(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_GAIN");return this.#r.value()}getLastPacketduration(){if(this.#t.originalRuntime()._opus_get_last_packet_duration(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_LAST_PACKET_DURATION");return this.#r.value()}getPitch(){if(this.#t.originalRuntime()._opus_get_pitch(this.#e,this.#r.offset())!=o.OPUS_OK)throw new Error("Failed to set OPUS_GET_PITCH");return this.#r.value()}}class u extends a{#n;#t;#s;#i;#o;#a;constructor(e,t,r,o,a,u){const _=new n.Z(e),d=e.originalRuntime()._opus_encoder_create(t,r,o,_.offset());if(super(e,d),this.#a=new s.Z,this.#n=_,this.#t=e,this.#o=new i.Z(e,u),this.#i=new i.Z(e,a),this.#a.add(this.#i),this.#a.add(this.#o),this.#a.add(this.#n),this.#s=d,_.value()<0)throw new Error("Failed to create encoder");if(!a)throw new Error("outBufferLength must be more than 0")}encoded(){return this.#i.data()}encodeFloat(e,t,r){if(r>this.#i.size())throw new Error(`encoded buffer length is ${this.#i.size()}, but maxDataBytes is ${r}`);this.#o.data().set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));const n=this.#t.originalRuntime()._opus_encode_float(this.#s,this.#o.offset(),t,this.#i.offset(),r);if(n<0)throw new Error("Failed to encode float");return n}destroy(){this.#a.destroy(),this.#t.originalRuntime()._opus_encoder_destroy(this.#s)}}class _{#n;#u;#a;#t;#o;#_;constructor(e,t,r,o){if(this.#_=o,this.#t=e,this.#a=new s.Z,this.#n=new n.Z(e),this.#a.add(this.#n),this.#u=e.originalRuntime()._opus_decoder_create(t,r,this.#n.offset()),!this.#u||this.#n.value()<0)throw new Error("Failed to create decoder");this.#o=new i.Z(e,this.#_*r*Float32Array.BYTES_PER_ELEMENT)}#d=null;decodeFloat(e,t=0){let r=this.#d;r||(r=new i.Z(this.#t,e.byteLength)),r.data().byteLength<e.byteLength&&(r.destroy(),r=new i.Z(this.#t,e.byteLength)),r.data().set(e),this.#d=r;const n=this.#t.originalRuntime()._opus_decode_float(this.#u,r.offset(),e.byteLength,this.#o.offset(),this.#_,t);if(n<0)throw new Error("Failed to decode float");return n}decoded(){const e=this.#o.data();return new Float32Array(e.buffer,e.byteOffset,e.byteLength/Float32Array.BYTES_PER_ELEMENT)}destroy(){this.#t.originalRuntime()._opus_decoder_destroy(this.#u),this.#a.destroy(),this.#d?.destroy()}}class d{#c;#l;#p;#_;constructor(e){this.#l=0,this.#p=0,this.#c=new ArrayBuffer(this.#f()),this.#_=e}#h(){return new Float32Array(this.#c)}write(e){this.#S(e.length),this.#h().set(e,this.#p),this.#p+=e.length}drain(){return this.#O(this.#p-this.#l)}read(){return this.#O(this.#_)}#O(e){if(!e)return null;if(this.#p-this.#l>=e){const t=this.#h().subarray(this.#l,this.#l+e);return this.#l+=e,this.#l>=this.#p&&(this.#p=0,this.#l=0),t}return null}#S(e){const t=e*Float32Array.BYTES_PER_ELEMENT;if(this.#h().length-this.#p<=e){const e=this.#c;this.#c=new ArrayBuffer(e.byteLength+t+this.#f()),this.#h().set(new Float32Array(e))}}#f(){return this.#_*Float32Array.BYTES_PER_ELEMENT*2}}},507:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{#E;#m;#t;constructor(e,t){this.#t=e,this.#m=t,this.#E=e.malloc(t)}offset(){return this.#E}data(){return this.#t.subarray(this.#E,this.#E+this.#m)}size(){return this.#m}destroy(){this.#t.free(this.#E),this.#E=0}}},530:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{#t;#E;constructor(e){this.#t=e,this.#E=e.malloc(e.originalRuntime()._size_of_int())}value(){if(4!==this.#t.originalRuntime()._size_of_int())throw new Error("invalid integer byte size");return this.#t.view().getInt32(this.#E,!0)}set(e){this.#t.view().setInt32(this.#E,e,!0)}size(){return this.#t.originalRuntime()._size_of_int()}offset(){return this.#E}destroy(){this.#t.free(this.#E),this.#E=0}}},619:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{#P=new Set;constructor(){}add(e){this.#P.add(e)}destroy(){for(const e of this.#P)e.destroy()}}},334:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Buffer:()=>i.Z,Integer:()=>n.Z,ResourcesHolder:()=>o.Z,Runtime:()=>s});var n=r(530);class s{#t;constructor(e){this.#t=e}originalRuntime(){return this.#t}subarray(e,t){return this.#t.HEAPU8.subarray(e,t)}free(e){this.#t._free(e)}view(){return new DataView(this.#t.HEAPU8.buffer)}malloc(e){const t=this.#t._malloc(e);if(!t)throw new Error(`failed to allocate ${e} bytes`);return t}}var i=r(507),o=r(619)},827:(e,t,r)=>{var n,s=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e={}){var t,s;(e=void 0!==e?e:{}).ready=new Promise((function(e,r){t=e,s=r}));var i,o,a=Object.assign({},e),u="object"==typeof window,_="function"==typeof importScripts,d="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,c="";if(d){var l=r(194),p=r(472);c=_?p.dirname(c)+"/":"//",i=(e,t)=>(e=function(e){return e.startsWith("file://")}(e)?new URL(e):p.normalize(e),l.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=i(e,!0);return t.buffer||(t=new Uint8Array(t)),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),e.inspect=function(){return"[Emscripten Module object]"}}else(u||_)&&(_?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),n&&(c=n),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",i=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},_&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}));var f,h=e.print||console.log.bind(console),S=e.printErr||console.warn.bind(console);Object.assign(e,a),a=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(f=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&A("no native wasm support detected");var O,E,m=!1,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function I(e,t,r){for(var n=t+r,s=t;e[s]&&!(s>=n);)++s;if(s-t>16&&e.buffer&&P)return P.decode(e.subarray(t,s));for(var i="";t<s;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var u=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|u:(7&o)<<18|a<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var _=o-65536;i+=String.fromCharCode(55296|_>>10,56320|1023&_)}}else i+=String.fromCharCode((31&o)<<6|a)}else i+=String.fromCharCode(o)}return i}var y=[],g=[],R=[],T=0,b=null,v=null;function A(t){e.onAbort&&e.onAbort(t),S(t="Aborted("+t+")"),m=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw s(r),r}var U,w;function D(e){return e.startsWith("data:application/octet-stream;base64,")}function G(e){try{if(e==U&&f)return new Uint8Array(f);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}catch(e){A(e)}}function F(e,t,r){return function(e){return f||!u&&!_||"function"!=typeof fetch?Promise.resolve().then((function(){return G(e)})):fetch(e,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((function(){return G(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(r,(function(e){S("failed to asynchronously prepare wasm: "+e),A(e)}))}function B(t){for(;t.length>0;)t.shift()(e)}D(U="index.wasm")||(w=U,U=e.locateFile?e.locateFile(w,c):c+w);var L,N=[null,[],[]],q={d:function(){A("")},f:function(e,t,r){O.copyWithin(e,t,t+r)},c:function(e){O.length,A("OOM")},e:function(e){return 52},b:function(e,t,r,n,s){return 70},a:function(e,t,r,n){for(var s,i,o,a=0,u=0;u<r;u++){var _=E[t>>2],d=E[t+4>>2];t+=8;for(var c=0;c<d;c++)s=e,i=O[_+c],o=void 0,o=N[s],0===i||10===i?((1===s?h:S)(I(o,0)),o.length=0):o.push(i);a+=d}return E[n>>2]=a,0}};function C(){function r(){L||(L=!0,e.calledRun=!0,m||(B(g),t(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(),R.unshift(t);var t;B(R)}()))}T>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),y.unshift(t);var t;B(y)}(),T>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(function(){var t,r,n,i,o={a:q};function a(t,r){var n,s,i=t.exports;return e.asm=i,n=e.asm.g.buffer,e.HEAP8=new Int8Array(n),e.HEAP16=new Int16Array(n),e.HEAP32=new Int32Array(n),e.HEAPU8=O=new Uint8Array(n),e.HEAPU16=new Uint16Array(n),e.HEAPU32=E=new Uint32Array(n),e.HEAPF32=new Float32Array(n),e.HEAPF64=new Float64Array(n),e.asm.ea,s=e.asm.h,g.unshift(s),function(t){if(T--,e.monitorRunDependencies&&e.monitorRunDependencies(T),0==T&&(null!==b&&(clearInterval(b),b=null),v)){var r=v;v=null,r()}}(),i}if(T++,e.monitorRunDependencies&&e.monitorRunDependencies(T),e.instantiateWasm)try{return e.instantiateWasm(o,a)}catch(e){S("Module.instantiateWasm callback failed with error: "+e),s(e)}(t=f,r=U,n=o,i=function(e){a(e.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||D(r)||d||"function"!=typeof fetch?F(r,n,i):fetch(r,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,n).then(i,(function(e){return S("wasm streaming compile failed: "+e),S("falling back to ArrayBuffer instantiation"),F(r,n,i)}))}))).catch(s)}(),e._opus_decoder_create=function(){return(e._opus_decoder_create=e.asm.i).apply(null,arguments)},e._opus_decode_float=function(){return(e._opus_decode_float=e.asm.j).apply(null,arguments)},e._opus_decoder_destroy=function(){return(e._opus_decoder_destroy=e.asm.k).apply(null,arguments)},e._opus_encoder_create=function(){return(e._opus_encoder_create=e.asm.l).apply(null,arguments)},e._opus_encode_float=function(){return(e._opus_encode_float=e.asm.m).apply(null,arguments)},e._opus_encoder_ctl=function(){return(e._opus_encoder_ctl=e.asm.n).apply(null,arguments)},e._opus_encoder_destroy=function(){return(e._opus_encoder_destroy=e.asm.o).apply(null,arguments)},e._size_of_int=function(){return(e._size_of_int=e.asm.p).apply(null,arguments)},e._size_of_void_ptr=function(){return(e._size_of_void_ptr=e.asm.q).apply(null,arguments)},e._opus_set_complexity=function(){return(e._opus_set_complexity=e.asm.r).apply(null,arguments)},e._opus_get_complexity=function(){return(e._opus_get_complexity=e.asm.s).apply(null,arguments)},e._opus_set_bitrate=function(){return(e._opus_set_bitrate=e.asm.t).apply(null,arguments)},e._opus_get_bitrate=function(){return(e._opus_get_bitrate=e.asm.u).apply(null,arguments)},e._opus_set_vbr=function(){return(e._opus_set_vbr=e.asm.v).apply(null,arguments)},e._opus_get_vbr=function(){return(e._opus_get_vbr=e.asm.w).apply(null,arguments)},e._opus_set_vbr_constraint=function(){return(e._opus_set_vbr_constraint=e.asm.x).apply(null,arguments)},e._opus_get_vbr_constraint=function(){return(e._opus_get_vbr_constraint=e.asm.y).apply(null,arguments)},e._opus_set_force_channels=function(){return(e._opus_set_force_channels=e.asm.z).apply(null,arguments)},e._opus_get_force_channels=function(){return(e._opus_get_force_channels=e.asm.A).apply(null,arguments)},e._opus_set_max_bandwidth=function(){return(e._opus_set_max_bandwidth=e.asm.B).apply(null,arguments)},e._opus_get_max_bandwidth=function(){return(e._opus_get_max_bandwidth=e.asm.C).apply(null,arguments)},e._opus_set_bandwidth=function(){return(e._opus_set_bandwidth=e.asm.D).apply(null,arguments)},e._opus_set_signal=function(){return(e._opus_set_signal=e.asm.E).apply(null,arguments)},e._opus_get_signal=function(){return(e._opus_get_signal=e.asm.F).apply(null,arguments)},e._opus_set_application=function(){return(e._opus_set_application=e.asm.G).apply(null,arguments)},e._opus_get_application=function(){return(e._opus_get_application=e.asm.H).apply(null,arguments)},e._opus_get_lookahead=function(){return(e._opus_get_lookahead=e.asm.I).apply(null,arguments)},e._opus_set_inband_fec=function(){return(e._opus_set_inband_fec=e.asm.J).apply(null,arguments)},e._opus_get_inband_fec=function(){return(e._opus_get_inband_fec=e.asm.K).apply(null,arguments)},e._opus_set_packet_loss_perc=function(){return(e._opus_set_packet_loss_perc=e.asm.L).apply(null,arguments)},e._opus_get_packet_loss_perc=function(){return(e._opus_get_packet_loss_perc=e.asm.M).apply(null,arguments)},e._opus_set_dtx=function(){return(e._opus_set_dtx=e.asm.N).apply(null,arguments)},e._opus_get_dtx=function(){return(e._opus_get_dtx=e.asm.O).apply(null,arguments)},e._opus_set_lsb_depth=function(){return(e._opus_set_lsb_depth=e.asm.P).apply(null,arguments)},e._opus_get_lsb_depth=function(){return(e._opus_get_lsb_depth=e.asm.Q).apply(null,arguments)},e._opus_set_expert_frame_duration=function(){return(e._opus_set_expert_frame_duration=e.asm.R).apply(null,arguments)},e._opus_get_expert_frame_duration=function(){return(e._opus_get_expert_frame_duration=e.asm.S).apply(null,arguments)},e._opus_set_prediction_disabled=function(){return(e._opus_set_prediction_disabled=e.asm.T).apply(null,arguments)},e._opus_get_prediction_disabled=function(){return(e._opus_get_prediction_disabled=e.asm.U).apply(null,arguments)},e._opus_get_bandwidth=function(){return(e._opus_get_bandwidth=e.asm.V).apply(null,arguments)},e._opus_get_sample_rate=function(){return(e._opus_get_sample_rate=e.asm.W).apply(null,arguments)},e._opus_set_phase_inversion_disabled=function(){return(e._opus_set_phase_inversion_disabled=e.asm.X).apply(null,arguments)},e._opus_get_phase_inversion_disabled=function(){return(e._opus_get_phase_inversion_disabled=e.asm.Y).apply(null,arguments)},e._opus_get_in_dtx=function(){return(e._opus_get_in_dtx=e.asm.Z).apply(null,arguments)},e._opus_set_gain=function(){return(e._opus_set_gain=e.asm._).apply(null,arguments)},e._opus_get_gain=function(){return(e._opus_get_gain=e.asm.$).apply(null,arguments)},e._opus_get_last_packet_duration=function(){return(e._opus_get_last_packet_duration=e.asm.aa).apply(null,arguments)},e._opus_get_pitch=function(){return(e._opus_get_pitch=e.asm.ba).apply(null,arguments)},e._malloc=function(){return(e._malloc=e.asm.ca).apply(null,arguments)},e._free=function(){return(e._free=e.asm.da).apply(null,arguments)},v=function e(){L||C(),L||(v=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return C(),e.ready});e.exports=s},977:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(618),i=r(514),o=n(r(827)),a=r(334),u=r(864);let _={queue:new Set};function d(){return crypto.getRandomValues(new Uint32Array(4)).join("-")}function c(e,t=[]){return postMessage(e,t)}const l=async e=>{if("queue"in _){switch(e.type){case i.RequestType.InitializeWorker:{const t=_.queue,r={runtime:new a.Runtime(await(0,o.default)({locateFile:()=>e.data.wasmFileHref})),encoders:new Map,decoders:new Map};_=r;for(const e of t)await l(e);t.clear(),c({requestId:e.requestId,value:null});break}default:_.queue.add(e)}return}const{runtime:t,encoders:r,decoders:n}=_;switch(e.type){case i.RequestType.CreateEncoder:{const n=new s.Encoder(t,e.data.sampleRate,e.data.channels,e.data.application,e.data.outBufferLength,e.data.pcmBufferLength),i=d();r.set(i,{sampleRate:e.data.sampleRate,ringBuffer:new s.RingBuffer(e.data.pcmBufferLength/Float32Array.BYTES_PER_ELEMENT),encoder:n}),c({requestId:e.requestId,value:i});break}case i.RequestType.CreateDecoder:{const r=new s.Decoder(t,e.data.sampleRate,e.data.channels,e.data.frameSize),i=d();n.set(i,r),c({requestId:e.requestId,value:i});break}case i.RequestType.DestroyEncoder:{const t=r.get(e.data);if(!t)throw new Error("Failed to get encoder");r.delete(e.data),t.encoder.destroy(),c(t?{requestId:e.requestId,value:null}:{requestId:e.requestId,failures:[`failed to find encoder with id: ${e.data}`]});break}case i.RequestType.DestroyDecoder:{const t=n.get(e.data.decoderId);n.delete(e.data.decoderId),t&&t.destroy(),c(t?{requestId:e.requestId,value:null}:{requestId:e.requestId,failures:[`failed to find decoder with id: ${e.data.decoderId}`]});break}case i.RequestType.EncodeFloat:{const t=r.get(e.data.encoderId);if(!t)throw new Error("Failed to get encoder");const n=null===e.data.input;e.data.input&&t.ringBuffer.write(e.data.input.pcm);const s=t.ringBuffer.read()??(n?t.ringBuffer.drain():null);if(null===s){c({requestId:e.requestId,value:{encoded:null}});break}const i=t.encoder.encodeFloat(s,s.length,e.data.maxDataBytes),o={buffer:new ArrayBuffer(i),duration:i/t.sampleRate};new Uint8Array(o.buffer).set(t.encoder.encoded().subarray(0,i)),c({requestId:e.requestId,value:{encoded:o}},[o.buffer]);break}case i.RequestType.DecodeFloat:{const t=n.get(e.data.decoderId);let r;if(t){const n=t.decodeFloat(new Uint8Array(e.data.encoded),e.data.decodeFec);r=t.decoded().slice(0,n)}else r=null;c(r?{requestId:e.requestId,value:{decoded:r.buffer}}:{requestId:e.requestId,failures:[`no decoder found for decoder id: ${e.data.decoderId}`]},r?[r.buffer]:[]);break}case i.RequestType.OpusSetRequest:{const t=r.get(e.data.encoderId);c(t?.encoder?{value:(0,u.setToEncoder)(t.encoder,e.data),requestId:e.requestId}:{requestId:e.requestId,failures:[`no encoder found for: ${e.data.encoderId}`]});break}case i.RequestType.OpusGetRequest:{const t=r.get(e.data.encoderId);c(t?.encoder?{value:(0,u.getFromEncoder)(t.encoder,e.data),requestId:e.requestId}:{requestId:e.requestId,failures:[`no encoder found for: ${e.data.encoderId}`]});break}}};onmessage=e=>{const t=e.data;l(t).catch((e=>{console.error("failed to process request: %o",{request:t,reason:e})}))}},864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFromEncoder=t.setToEncoder=void 0;const n=r(440);t.setToEncoder=function(e,t){let r;switch(t.type){case n.OpusRequest.SetComplexity:r=e.setComplexity(t.value);break;case n.OpusRequest.SetBitrate:r=e.setBitrate(t.value);break;case n.OpusRequest.SetVbr:r=e.setVbr(t.value);break;case n.OpusRequest.SetVbrConstraint:r=e.setVbrConstraint(t.value);break;case n.OpusRequest.SetForceChannels:r=e.setForceChannels(t.value);break;case n.OpusRequest.SetMaxBandwidth:r=e.setMaxBandwidth(t.value);break;case n.OpusRequest.SetBandwidth:r=e.setBandwidth(t.value);break;case n.OpusRequest.SetSignal:r=e.setSignal(t.value);break;case n.OpusRequest.SetApplication:r=e.setApplication(t.value);break;case n.OpusRequest.SetInbandFec:r=e.setInbandFec(t.value);break;case n.OpusRequest.SetPacketLossperc:r=e.setPacketLossperc(t.value);break;case n.OpusRequest.SetDtx:r=e.setDtx(t.value);break;case n.OpusRequest.SetLsbDepth:r=e.setLsbDepth(t.value);break;case n.OpusRequest.SetExpertFrameduration:r=e.setExpertFrameduration(t.value);break;case n.OpusRequest.SetPredictionDisabled:r=e.setPredictionDisabled(t.value);break;case n.OpusRequest.SetPhaseInversiondisabled:r=e.setPhaseInversiondisabled(t.value);break;case n.OpusRequest.SetGain:r=e.setGain(t.value)}return r},t.getFromEncoder=function(e,t){let r;switch(t.type){case n.OpusRequest.GetComplexity:r=e.getComplexity();break;case n.OpusRequest.GetBitrate:r=e.getBitrate();break;case n.OpusRequest.GetVbr:r=e.getVbr();break;case n.OpusRequest.GetVbrConstraint:r=e.getVbrConstraint();break;case n.OpusRequest.GetForceChannels:r=e.getForceChannels();break;case n.OpusRequest.GetMaxBandwidth:r=e.getMaxBandwidth();break;case n.OpusRequest.GetSignal:r=e.getSignal();break;case n.OpusRequest.GetApplication:r=e.getApplication();break;case n.OpusRequest.GetLookahead:r=e.getLookahead();break;case n.OpusRequest.GetInbandFec:r=e.getInbandFec();break;case n.OpusRequest.GetPacketLossperc:r=e.getPacketLossperc();break;case n.OpusRequest.GetDtx:r=e.getDtx();break;case n.OpusRequest.GetLsbDepth:r=e.getLsbDepth();break;case n.OpusRequest.GetExpertFrameduration:r=e.getExpertFrameduration();break;case n.OpusRequest.GetPredictionDisabled:r=e.getPredictionDisabled();break;case n.OpusRequest.GetBandwidth:r=e.getBandwidth();break;case n.OpusRequest.GetSampleRate:r=e.getSampleRate();break;case n.OpusRequest.GetPhaseInversiondisabled:r=e.getPhaseInversiondisabled();break;case n.OpusRequest.GetInDtx:r=e.getInDtx();break;case n.OpusRequest.GetGain:r=e.getGain();break;case n.OpusRequest.GetLastPacketduration:r=e.getLastPacketduration();break;case n.OpusRequest.GetPitch:r=e.getPitch()}return r}},194:()=>{},472:()=>{}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(977)})();
|
|
1
|
+
(()=>{var e={514:(e,t,r)=>{"use strict";function n(e){return{type:a.OpusGetRequest,data:e,requestId:c()}}function s(e){return{type:a.OpusSetRequest,data:e,requestId:c()}}function o(e,t,r){return{type:a.CreateDecoder,data:{frameSize:r,sampleRate:e,channels:t},requestId:c()}}function i(e){return{type:a.DestroyEncoder,data:e,requestId:c()}}var a;function u(e){return{requestId:c(),data:e,type:a.InitializeWorker}}function _(e){return{type:a.DestroyDecoder,data:{decoderId:e},requestId:c()}}function d(e){return{type:a.DecodeFloat,data:e,requestId:c(),transfer:[e.encoded]}}function c(){return crypto.getRandomValues(new Int32Array(4)).join("-")}function l(e){return{data:e,requestId:c(),type:a.CreateEncoder}}function p(e){return{data:e,requestId:c(),type:a.EncodeFloat,transfer:null!==e.input?[e.input.pcm]:[]}}r.r(t),r.d(t,{RequestType:()=>a,createDecoder:()=>o,createEncoder:()=>l,decodeFloat:()=>d,destroyDecoder:()=>_,destroyEncoder:()=>i,encodeFloat:()=>p,getFromEncoder:()=>n,initializeWorker:()=>u,setToEncoder:()=>s}),function(e){e[e.CreateEncoder=0]="CreateEncoder",e[e.CreateDecoder=1]="CreateDecoder",e[e.EncodeFloat=2]="EncodeFloat",e[e.DecodeFloat=3]="DecodeFloat",e[e.DestroyEncoder=4]="DestroyEncoder",e[e.InitializeWorker=5]="InitializeWorker",e[e.DestroyDecoder=6]="DestroyDecoder",e[e.OpusGetRequest=7]="OpusGetRequest",e[e.OpusSetRequest=8]="OpusSetRequest"}(a||(a={}))},440:(e,t,r)=>{"use strict";var n;function s(e,t){return{encoderId:e,type:n.SetComplexity,value:t}}function o(e){return{encoderId:e,type:n.GetComplexity}}function i(e,t){return{encoderId:e,type:n.SetBitrate,value:t}}function a(e){return{encoderId:e,type:n.GetBitrate}}function u(e,t){return{encoderId:e,type:n.SetVbr,value:t}}function _(e){return{encoderId:e,type:n.GetVbr}}function d(e,t){return{encoderId:e,type:n.SetVbrConstraint,value:t}}function c(e){return{encoderId:e,type:n.GetVbrConstraint}}function l(e,t){return{encoderId:e,type:n.SetForceChannels,value:t}}function p(e){return{encoderId:e,type:n.GetForceChannels}}function f(e,t){return{encoderId:e,type:n.SetMaxBandwidth,value:t}}function h(e){return{encoderId:e,type:n.GetMaxBandwidth}}function O(e,t){return{encoderId:e,type:n.SetBandwidth,value:t}}function E(e,t){return{encoderId:e,type:n.SetSignal,value:t}}function S(e){return{encoderId:e,type:n.GetSignal}}function m(e,t){return{encoderId:e,type:n.SetApplication,value:t}}function P(e){return{encoderId:e,type:n.GetApplication}}function y(e){return{encoderId:e,type:n.GetLookahead}}function I(e,t){return{encoderId:e,type:n.SetInbandFec,value:t}}function g(e){return{encoderId:e,type:n.GetInbandFec}}function T(e,t){return{encoderId:e,type:n.SetPacketLossperc,value:t}}function R(e){return{encoderId:e,type:n.GetPacketLossperc}}function b(e,t){return{encoderId:e,type:n.SetDtx,value:t}}function v(e){return{encoderId:e,type:n.GetDtx}}function A(e,t){return{encoderId:e,type:n.SetLsbDepth,value:t}}function U(e){return{encoderId:e,type:n.GetLsbDepth}}function w(e,t){return{encoderId:e,type:n.SetExpertFrameduration,value:t}}function D(e){return{encoderId:e,type:n.GetExpertFrameduration}}function G(e,t){return{encoderId:e,type:n.SetPredictionDisabled,value:t}}function L(e){return{encoderId:e,type:n.GetPredictionDisabled}}function F(e){return{encoderId:e,type:n.GetBandwidth}}function B(e){return{encoderId:e,type:n.GetSampleRate}}function N(e,t){return{encoderId:e,type:n.SetPhaseInversiondisabled,value:t}}function C(e){return{encoderId:e,type:n.GetPhaseInversiondisabled}}function q(e){return{encoderId:e,type:n.GetInDtx}}function x(e,t){return{encoderId:e,type:n.SetGain,value:t}}function k(e){return{encoderId:e,type:n.GetGain}}function M(e){return{encoderId:e,type:n.GetLastPacketduration}}function K(e){return{encoderId:e,type:n.GetPitch}}r.r(t),r.d(t,{OPUS_GET_APPLICATION:()=>P,OPUS_GET_BANDWIDTH:()=>F,OPUS_GET_BITRATE:()=>a,OPUS_GET_COMPLEXITY:()=>o,OPUS_GET_DTX:()=>v,OPUS_GET_EXPERT_FRAME_DURATION:()=>D,OPUS_GET_FORCE_CHANNELS:()=>p,OPUS_GET_GAIN:()=>k,OPUS_GET_INBAND_FEC:()=>g,OPUS_GET_IN_DTX:()=>q,OPUS_GET_LAST_PACKET_DURATION:()=>M,OPUS_GET_LOOKAHEAD:()=>y,OPUS_GET_LSB_DEPTH:()=>U,OPUS_GET_MAX_BANDWIDTH:()=>h,OPUS_GET_PACKET_LOSS_PERC:()=>R,OPUS_GET_PHASE_INVERSION_DISABLED:()=>C,OPUS_GET_PITCH:()=>K,OPUS_GET_PREDICTION_DISABLED:()=>L,OPUS_GET_SAMPLE_RATE:()=>B,OPUS_GET_SIGNAL:()=>S,OPUS_GET_VBR:()=>_,OPUS_GET_VBR_CONSTRAINT:()=>c,OPUS_SET_APPLICATION:()=>m,OPUS_SET_BANDWIDTH:()=>O,OPUS_SET_BITRATE:()=>i,OPUS_SET_COMPLEXITY:()=>s,OPUS_SET_DTX:()=>b,OPUS_SET_EXPERT_FRAME_DURATION:()=>w,OPUS_SET_FORCE_CHANNELS:()=>l,OPUS_SET_GAIN:()=>x,OPUS_SET_INBAND_FEC:()=>I,OPUS_SET_LSB_DEPTH:()=>A,OPUS_SET_MAX_BANDWIDTH:()=>f,OPUS_SET_PACKET_LOSS_PERC:()=>T,OPUS_SET_PHASE_INVERSION_DISABLED:()=>N,OPUS_SET_PREDICTION_DISABLED:()=>G,OPUS_SET_SIGNAL:()=>E,OPUS_SET_VBR:()=>u,OPUS_SET_VBR_CONSTRAINT:()=>d,OpusRequest:()=>n}),function(e){e.SetComplexity="OPUS_SET_COMPLEXITY",e.GetComplexity="OPUS_GET_COMPLEXITY",e.SetBitrate="OPUS_SET_BITRATE",e.GetBitrate="OPUS_GET_BITRATE",e.SetVbr="OPUS_SET_VBR",e.GetVbr="OPUS_GET_VBR",e.SetVbrConstraint="OPUS_SET_VBR_CONSTRAINT",e.GetVbrConstraint="OPUS_GET_VBR_CONSTRAINT",e.SetForceChannels="OPUS_SET_FORCE_CHANNELS",e.GetForceChannels="OPUS_GET_FORCE_CHANNELS",e.SetMaxBandwidth="OPUS_SET_MAX_BANDWIDTH",e.GetMaxBandwidth="OPUS_GET_MAX_BANDWIDTH",e.SetBandwidth="OPUS_SET_BANDWIDTH",e.SetSignal="OPUS_SET_SIGNAL",e.GetSignal="OPUS_GET_SIGNAL",e.SetApplication="OPUS_SET_APPLICATION",e.GetApplication="OPUS_GET_APPLICATION",e.GetLookahead="OPUS_GET_LOOKAHEAD",e.SetInbandFec="OPUS_SET_INBAND_FEC",e.GetInbandFec="OPUS_GET_INBAND_FEC",e.SetPacketLossperc="OPUS_SET_PACKET_LOSS_PERC",e.GetPacketLossperc="OPUS_GET_PACKET_LOSS_PERC",e.SetDtx="OPUS_SET_DTX",e.GetDtx="OPUS_GET_DTX",e.SetLsbDepth="OPUS_SET_LSB_DEPTH",e.GetLsbDepth="OPUS_GET_LSB_DEPTH",e.SetExpertFrameduration="OPUS_SET_EXPERT_FRAME_DURATION",e.GetExpertFrameduration="OPUS_GET_EXPERT_FRAME_DURATION",e.SetPredictionDisabled="OPUS_SET_PREDICTION_DISABLED",e.GetPredictionDisabled="OPUS_GET_PREDICTION_DISABLED",e.GetBandwidth="OPUS_GET_BANDWIDTH",e.GetSampleRate="OPUS_GET_SAMPLE_RATE",e.SetPhaseInversiondisabled="OPUS_SET_PHASE_INVERSION_DISABLED",e.GetPhaseInversiondisabled="OPUS_GET_PHASE_INVERSION_DISABLED",e.GetInDtx="OPUS_GET_IN_DTX",e.SetGain="OPUS_SET_GAIN",e.GetGain="OPUS_GET_GAIN",e.GetLastPacketduration="OPUS_GET_LAST_PACKET_DURATION",e.GetPitch="OPUS_GET_PITCH"}(n||(n={}))},618:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Decoder:()=>_,Encoder:()=>u,RingBuffer:()=>d,constants:()=>i});var n=r(530),s=r(619),o=r(507);const i={OPE_OK:0,OPE_BAD_ARG:-11,OPE_INTERNAL_ERROR:-13,OPE_UNIMPLEMENTED:-15,OPE_ALLOC_FAIL:-17,OPE_CANNOT_OPEN:-30,OPE_TOO_LATE:-31,OPE_INVALID_PICTURE:-32,OPE_INVALID_ICON:-33,OPE_WRITE_FAIL:-34,OPE_CLOSE_FAIL:-35,OPUS_OK:0,OPUS_BAD_ARG:-1,OPUS_BUFFER_TOO_SMALL:-2,OPUS_INTERNAL_ERROR:-3,OPUS_INVALID_PACKET:-4,OPUS_UNIMPLEMENTED:-5,OPUS_INVALID_STATE:-6,OPUS_ALLOC_FAIL:-7,OPUS_AUTO:-1e3,OPUS_BITRATE_MAX:-1,OPUS_APPLICATION_VOIP:2048,OPUS_APPLICATION_AUDIO:2049,OPUS_APPLICATION_RESTRICTED_LOWDELAY:2051,OPUS_SIGNAL_VOICE:3001,OPUS_SIGNAL_MUSIC:3002,OPUS_BANDWIDTH_NARROWBAND:1101,OPUS_BANDWIDTH_MEDIUMBAND:1102,OPUS_BANDWIDTH_WIDEBAND:1103,OPUS_BANDWIDTH_SUPERWIDEBAND:1104,OPUS_BANDWIDTH_FULLBAND:1105,OPUS_FRAMESIZE_ARG:5e3,OPUS_FRAMESIZE_2_5_MS:5001,OPUS_FRAMESIZE_5_MS:5002,OPUS_FRAMESIZE_10_MS:5003,OPUS_FRAMESIZE_20_MS:5004,OPUS_FRAMESIZE_40_MS:5005,OPUS_FRAMESIZE_60_MS:5006,OPUS_FRAMESIZE_80_MS:5007,OPUS_FRAMESIZE_100_MS:5008,OPUS_FRAMESIZE_120_MS:5009};class a{#e;#t;#r;constructor(e,t){this.#t=e,this.#r=new n.Z(e),this.#e=t}setComplexity(e){return this.#t.originalRuntime()._opus_set_complexity(this.#e,e)===i.OPUS_OK}getComplexity(){if(this.#t.originalRuntime()._opus_get_complexity(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_COMPLEXITY");return this.#r.value()}setBitrate(e){return this.#t.originalRuntime()._opus_set_bitrate(this.#e,e)===i.OPUS_OK}getBitrate(){if(this.#t.originalRuntime()._opus_get_bitrate(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_BITRATE");return this.#r.value()}setVbr(e){return this.#t.originalRuntime()._opus_set_vbr(this.#e,e)===i.OPUS_OK}getVbr(){if(this.#t.originalRuntime()._opus_get_vbr(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR");return this.#r.value()}setVbrConstraint(e){return this.#t.originalRuntime()._opus_set_vbr_constraint(this.#e,e)===i.OPUS_OK}getVbrConstraint(){if(this.#t.originalRuntime()._opus_get_vbr_constraint(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR_CONSTRAINT");return this.#r.value()}setForceChannels(e){return this.#t.originalRuntime()._opus_set_force_channels(this.#e,e)===i.OPUS_OK}getForceChannels(){if(this.#t.originalRuntime()._opus_get_force_channels(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_FORCE_CHANNELS");return this.#r.value()}setMaxBandwidth(e){return this.#t.originalRuntime()._opus_set_max_bandwidth(this.#e,e)===i.OPUS_OK}getMaxBandwidth(){if(this.#t.originalRuntime()._opus_get_max_bandwidth(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_MAX_BANDWIDTH");return this.#r.value()}setBandwidth(e){return this.#t.originalRuntime()._opus_set_bandwidth(this.#e,e)===i.OPUS_OK}setSignal(e){return this.#t.originalRuntime()._opus_set_signal(this.#e,e)===i.OPUS_OK}getSignal(){if(this.#t.originalRuntime()._opus_get_signal(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_SIGNAL");return this.#r.value()}setApplication(e){return this.#t.originalRuntime()._opus_set_application(this.#e,e)===i.OPUS_OK}getApplication(){if(this.#t.originalRuntime()._opus_get_application(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_APPLICATION");return this.#r.value()}getLookahead(){if(this.#t.originalRuntime()._opus_get_lookahead(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_LOOKAHEAD");return this.#r.value()}setInbandFec(e){return this.#t.originalRuntime()._opus_set_inband_fec(this.#e,e)===i.OPUS_OK}getInbandFec(){if(this.#t.originalRuntime()._opus_get_inband_fec(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_INBAND_FEC");return this.#r.value()}setPacketLossperc(e){return this.#t.originalRuntime()._opus_set_packet_loss_perc(this.#e,e)===i.OPUS_OK}getPacketLossperc(){if(this.#t.originalRuntime()._opus_get_packet_loss_perc(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_PACKET_LOSS_PERC");return this.#r.value()}setDtx(e){return this.#t.originalRuntime()._opus_set_dtx(this.#e,e)===i.OPUS_OK}getDtx(){if(this.#t.originalRuntime()._opus_get_dtx(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_DTX");return this.#r.value()}setLsbDepth(e){return this.#t.originalRuntime()._opus_set_lsb_depth(this.#e,e)===i.OPUS_OK}getLsbDepth(){if(this.#t.originalRuntime()._opus_get_lsb_depth(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_LSB_DEPTH");return this.#r.value()}setExpertFrameduration(e){return this.#t.originalRuntime()._opus_set_expert_frame_duration(this.#e,e)===i.OPUS_OK}getExpertFrameduration(){if(this.#t.originalRuntime()._opus_get_expert_frame_duration(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_EXPERT_FRAME_DURATION");return this.#r.value()}setPredictionDisabled(e){return this.#t.originalRuntime()._opus_set_prediction_disabled(this.#e,e)===i.OPUS_OK}getPredictionDisabled(){if(this.#t.originalRuntime()._opus_get_prediction_disabled(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_PREDICTION_DISABLED");return this.#r.value()}getBandwidth(){if(this.#t.originalRuntime()._opus_get_bandwidth(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_BANDWIDTH");return this.#r.value()}getSampleRate(){if(this.#t.originalRuntime()._opus_get_sample_rate(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_SAMPLE_RATE");return this.#r.value()}setPhaseInversiondisabled(e){return this.#t.originalRuntime()._opus_set_phase_inversion_disabled(this.#e,e)===i.OPUS_OK}getPhaseInversiondisabled(){if(this.#t.originalRuntime()._opus_get_phase_inversion_disabled(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_PHASE_INVERSION_DISABLED");return this.#r.value()}getInDtx(){if(this.#t.originalRuntime()._opus_get_in_dtx(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_IN_DTX");return this.#r.value()}setGain(e){return this.#t.originalRuntime()._opus_set_gain(this.#e,e)===i.OPUS_OK}getGain(){if(this.#t.originalRuntime()._opus_get_gain(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_GAIN");return this.#r.value()}getLastPacketduration(){if(this.#t.originalRuntime()._opus_get_last_packet_duration(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_LAST_PACKET_DURATION");return this.#r.value()}getPitch(){if(this.#t.originalRuntime()._opus_get_pitch(this.#e,this.#r.offset())!=i.OPUS_OK)throw new Error("Failed to set OPUS_GET_PITCH");return this.#r.value()}}class u extends a{#n;#t;#s;#o;#i;#a;constructor(e,t,r,i,a,u){const _=new n.Z(e),d=e.originalRuntime()._opus_encoder_create(t,r,i,_.offset());if(super(e,d),this.#a=new s.Z,this.#n=_,this.#t=e,this.#i=new o.Z(e,u),this.#o=new o.Z(e,a),this.#a.add(this.#o),this.#a.add(this.#i),this.#a.add(this.#n),this.#s=d,_.value()<0)throw new Error("Failed to create encoder");if(!a)throw new Error("outBufferLength must be more than 0")}encoded(){return this.#o.data()}encodeFloat(e,t,r){if(r>this.#o.size())throw new Error(`encoded buffer length is ${this.#o.size()}, but maxDataBytes is ${r}`);this.#i.data().set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));const n=this.#t.originalRuntime()._opus_encode_float(this.#s,this.#i.offset(),t,this.#o.offset(),r);if(n<0)throw new Error("Failed to encode float");return n}destroy(){this.#a.destroy(),this.#t.originalRuntime()._opus_encoder_destroy(this.#s)}}class _{#n;#u;#a;#t;#i;#_;constructor(e,t,r,i){if(this.#_=i,this.#t=e,this.#a=new s.Z,this.#n=new n.Z(e),this.#a.add(this.#n),this.#u=e.originalRuntime()._opus_decoder_create(t,r,this.#n.offset()),!this.#u||this.#n.value()<0)throw new Error("Failed to create decoder");this.#i=new o.Z(e,this.#_*r*Float32Array.BYTES_PER_ELEMENT)}#d=null;decodeFloat(e,t=0){let r=this.#d;r||(r=new o.Z(this.#t,e.byteLength)),r.data().byteLength<e.byteLength&&(r.destroy(),r=new o.Z(this.#t,e.byteLength)),r.data().set(e),this.#d=r;const n=this.#t.originalRuntime()._opus_decode_float(this.#u,r.offset(),e.byteLength,this.#i.offset(),this.#_,t);if(n<0)throw new Error("Failed to decode float");return n}decoded(){const e=this.#i.data();return new Float32Array(e.buffer,e.byteOffset,e.byteLength/Float32Array.BYTES_PER_ELEMENT)}destroy(){this.#t.originalRuntime()._opus_decoder_destroy(this.#u),this.#a.destroy(),this.#d?.destroy()}}class d{#c;#l;#p;#_;constructor(e){this.#l=0,this.#p=0,this.#c=new ArrayBuffer(this.#f()),this.#_=e}#h(){return new Float32Array(this.#c)}write(e){this.#O(e.length),this.#h().set(e,this.#p),this.#p+=e.length}drain(){const e=this.#p-this.#l;return this.#E(e>=this.#_?this.#_:e)}read(){return this.#E(this.#_)}#E(e){if(!e)return null;if(this.#p-this.#l>=e){const t=this.#h().subarray(this.#l,this.#l+e);return this.#l+=e,this.#l>=this.#p&&(this.#p=0,this.#l=0),t}return null}#O(e){const t=e*Float32Array.BYTES_PER_ELEMENT;if(this.#h().length-this.#p<=e){const e=this.#c;this.#c=new ArrayBuffer(e.byteLength+t+this.#f()),this.#h().set(new Float32Array(e))}}#f(){return this.#_*Float32Array.BYTES_PER_ELEMENT*2}}},507:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{#S;#m;#t;constructor(e,t){this.#t=e,this.#m=t,this.#S=e.malloc(t)}offset(){return this.#S}data(){return this.#t.subarray(this.#S,this.#S+this.#m)}size(){return this.#m}destroy(){this.#t.free(this.#S),this.#S=0}}},530:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{#t;#S;constructor(e){this.#t=e,this.#S=e.malloc(e.originalRuntime()._size_of_int())}value(){if(4!==this.#t.originalRuntime()._size_of_int())throw new Error("invalid integer byte size");return this.#t.view().getInt32(this.#S,!0)}set(e){this.#t.view().setInt32(this.#S,e,!0)}size(){return this.#t.originalRuntime()._size_of_int()}offset(){return this.#S}destroy(){this.#t.free(this.#S),this.#S=0}}},619:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{#P=new Set;constructor(){}add(e){this.#P.add(e)}destroy(){for(const e of this.#P)e.destroy()}}},55:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Buffer:()=>o.Z,Integer:()=>n.Z,ResourcesHolder:()=>a.Z,Runtime:()=>s,RuntimeString:()=>i});var n=r(530);class s{#t;TextDecoder;TextEncoder;constructor(e,{TextDecoder:t,TextEncoder:r}){this.TextDecoder=t,this.TextEncoder=r,this.#t=e}originalRuntime(){return this.#t}subarray(e,t){return this.#t.HEAPU8.subarray(e,t)}free(e){this.#t._free(e)}view(){return new DataView(this.#t.HEAPU8.buffer)}malloc(e){const t=this.#t._malloc(e);if(!t)throw new Error(`failed to allocate ${e} bytes`);return t}}var o=r(507);class i{#t;#r;constructor(e){this.#t=e,this.#r=null}set(e){(null===this.#r||this.#r.size-1<e.byteLength)&&(null!==this.#r&&(this.#t.free(this.#r.offset),this.#r=null),this.#r={offset:this.#t.malloc(e.byteLength),size:2*(e.byteLength+1)});const t=this.#t.originalRuntime().HEAPU8.subarray(this.#r.offset,this.#r.offset+e.byteLength+1);return t.set(e),t[t.byteLength-1]=0,this.#r.offset}offset(){return this.#r?.offset??null}read(){if(null===this.#r)return null;const e=this.#t.originalRuntime().HEAPU8.subarray(this.#r.offset);let t=0;for(;t<e.byteLength&&0!==e[t];)t++;return e.subarray(0,t)}}var a=r(619)},827:(e,t,r)=>{var n,s=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(e={}){var t,s;(e=void 0!==e?e:{}).ready=new Promise((function(e,r){t=e,s=r}));var o,i,a=Object.assign({},e),u="object"==typeof window,_="function"==typeof importScripts,d="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,c="";if(d){var l=r(194),p=r(472);c=_?p.dirname(c)+"/":"//",o=(e,t)=>(e=function(e){return e.startsWith("file://")}(e)?new URL(e):p.normalize(e),l.readFileSync(e,t?void 0:"utf8")),i=e=>{var t=o(e,!0);return t.buffer||(t=new Uint8Array(t)),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),e.inspect=function(){return"[Emscripten Module object]"}}else(u||_)&&(_?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),n&&(c=n),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},_&&(i=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}));var f,h=e.print||console.log.bind(console),O=e.printErr||console.warn.bind(console);Object.assign(e,a),a=null,e.arguments&&e.arguments,e.thisProgram&&e.thisProgram,e.quit&&e.quit,e.wasmBinary&&(f=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&A("no native wasm support detected");var E,S,m=!1,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function y(e,t,r){for(var n=t+r,s=t;e[s]&&!(s>=n);)++s;if(s-t>16&&e.buffer&&P)return P.decode(e.subarray(t,s));for(var o="";t<s;){var i=e[t++];if(128&i){var a=63&e[t++];if(192!=(224&i)){var u=63&e[t++];if((i=224==(240&i)?(15&i)<<12|a<<6|u:(7&i)<<18|a<<12|u<<6|63&e[t++])<65536)o+=String.fromCharCode(i);else{var _=i-65536;o+=String.fromCharCode(55296|_>>10,56320|1023&_)}}else o+=String.fromCharCode((31&i)<<6|a)}else o+=String.fromCharCode(i)}return o}var I=[],g=[],T=[],R=0,b=null,v=null;function A(t){e.onAbort&&e.onAbort(t),O(t="Aborted("+t+")"),m=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw s(r),r}var U,w;function D(e){return e.startsWith("data:application/octet-stream;base64,")}function G(e){try{if(e==U&&f)return new Uint8Array(f);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}catch(e){A(e)}}function L(e,t,r){return function(e){return f||!u&&!_||"function"!=typeof fetch?Promise.resolve().then((function(){return G(e)})):fetch(e,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((function(){return G(e)}))}(e).then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(r,(function(e){O("failed to asynchronously prepare wasm: "+e),A(e)}))}function F(t){for(;t.length>0;)t.shift()(e)}D(U="index.wasm")||(w=U,U=e.locateFile?e.locateFile(w,c):c+w);var B,N=[null,[],[]],C={c:function(){A("")},e:function(e,t,r){E.copyWithin(e,t,t+r)},f:function(e){E.length,A("OOM")},d:function(e){return 52},b:function(e,t,r,n,s){return 70},a:function(e,t,r,n){for(var s,o,i,a=0,u=0;u<r;u++){var _=S[t>>2],d=S[t+4>>2];t+=8;for(var c=0;c<d;c++)s=e,o=E[_+c],i=void 0,i=N[s],0===o||10===o?((1===s?h:O)(y(i,0)),i.length=0):i.push(o);a+=d}return S[n>>2]=a,0}};function q(){function r(){B||(B=!0,e.calledRun=!0,m||(F(g),t(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(),T.unshift(t);var t;F(T)}()))}R>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;F(I)}(),R>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(function(){var t,r,n,o,i={a:C};function a(t,r){var n,s,o=t.exports;return e.asm=o,n=e.asm.g.buffer,e.HEAP8=new Int8Array(n),e.HEAP16=new Int16Array(n),e.HEAP32=new Int32Array(n),e.HEAPU8=E=new Uint8Array(n),e.HEAPU16=new Uint16Array(n),e.HEAPU32=S=new Uint32Array(n),e.HEAPF32=new Float32Array(n),e.HEAPF64=new Float64Array(n),e.asm.ta,s=e.asm.h,g.unshift(s),function(t){if(R--,e.monitorRunDependencies&&e.monitorRunDependencies(R),0==R&&(null!==b&&(clearInterval(b),b=null),v)){var r=v;v=null,r()}}(),o}if(R++,e.monitorRunDependencies&&e.monitorRunDependencies(R),e.instantiateWasm)try{return e.instantiateWasm(i,a)}catch(e){O("Module.instantiateWasm callback failed with error: "+e),s(e)}(t=f,r=U,n=i,o=function(e){a(e.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||D(r)||d||"function"!=typeof fetch?L(r,n,o):fetch(r,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,n).then(o,(function(e){return O("wasm streaming compile failed: "+e),O("falling back to ArrayBuffer instantiation"),L(r,n,o)}))}))).catch(s)}(),e._opus_decoder_create=function(){return(e._opus_decoder_create=e.asm.i).apply(null,arguments)},e._opus_decode_float=function(){return(e._opus_decode_float=e.asm.j).apply(null,arguments)},e._opus_decoder_destroy=function(){return(e._opus_decoder_destroy=e.asm.k).apply(null,arguments)},e._opus_encoder_create=function(){return(e._opus_encoder_create=e.asm.l).apply(null,arguments)},e._opus_encode_float=function(){return(e._opus_encode_float=e.asm.m).apply(null,arguments)},e._opus_encoder_ctl=function(){return(e._opus_encoder_ctl=e.asm.n).apply(null,arguments)},e._opus_encoder_destroy=function(){return(e._opus_encoder_destroy=e.asm.o).apply(null,arguments)},e._ope_comments_create=function(){return(e._ope_comments_create=e.asm.p).apply(null,arguments)},e._ope_comments_copy=function(){return(e._ope_comments_copy=e.asm.q).apply(null,arguments)},e._ope_comments_destroy=function(){return(e._ope_comments_destroy=e.asm.r).apply(null,arguments)},e._ope_comments_add=function(){return(e._ope_comments_add=e.asm.s).apply(null,arguments)},e._ope_comments_add_string=function(){return(e._ope_comments_add_string=e.asm.t).apply(null,arguments)},e._ope_comments_add_picture_from_memory=function(){return(e._ope_comments_add_picture_from_memory=e.asm.u).apply(null,arguments)},e._ope_encoder_destroy=function(){return(e._ope_encoder_destroy=e.asm.v).apply(null,arguments)},e._ope_encoder_create_pull=function(){return(e._ope_encoder_create_pull=e.asm.w).apply(null,arguments)},e._ope_encoder_write_float=function(){return(e._ope_encoder_write_float=e.asm.x).apply(null,arguments)},e._ope_encoder_ctl=function(){return(e._ope_encoder_ctl=e.asm.y).apply(null,arguments)},e._ope_encoder_get_page=function(){return(e._ope_encoder_get_page=e.asm.z).apply(null,arguments)},e._ope_encoder_drain=function(){return(e._ope_encoder_drain=e.asm.A).apply(null,arguments)},e._ope_encoder_flush_header=function(){return(e._ope_encoder_flush_header=e.asm.B).apply(null,arguments)},e._ope_strerror=function(){return(e._ope_strerror=e.asm.C).apply(null,arguments)},e._size_of_int=function(){return(e._size_of_int=e.asm.D).apply(null,arguments)},e._size_of_size_t=function(){return(e._size_of_size_t=e.asm.E).apply(null,arguments)},e._size_of_void_ptr=function(){return(e._size_of_void_ptr=e.asm.F).apply(null,arguments)},e._opus_set_complexity=function(){return(e._opus_set_complexity=e.asm.G).apply(null,arguments)},e._opus_get_complexity=function(){return(e._opus_get_complexity=e.asm.H).apply(null,arguments)},e._opus_set_bitrate=function(){return(e._opus_set_bitrate=e.asm.I).apply(null,arguments)},e._opus_get_bitrate=function(){return(e._opus_get_bitrate=e.asm.J).apply(null,arguments)},e._opus_set_vbr=function(){return(e._opus_set_vbr=e.asm.K).apply(null,arguments)},e._opus_get_vbr=function(){return(e._opus_get_vbr=e.asm.L).apply(null,arguments)},e._opus_set_vbr_constraint=function(){return(e._opus_set_vbr_constraint=e.asm.M).apply(null,arguments)},e._opus_get_vbr_constraint=function(){return(e._opus_get_vbr_constraint=e.asm.N).apply(null,arguments)},e._opus_set_force_channels=function(){return(e._opus_set_force_channels=e.asm.O).apply(null,arguments)},e._opus_get_force_channels=function(){return(e._opus_get_force_channels=e.asm.P).apply(null,arguments)},e._opus_set_max_bandwidth=function(){return(e._opus_set_max_bandwidth=e.asm.Q).apply(null,arguments)},e._opus_get_max_bandwidth=function(){return(e._opus_get_max_bandwidth=e.asm.R).apply(null,arguments)},e._opus_set_bandwidth=function(){return(e._opus_set_bandwidth=e.asm.S).apply(null,arguments)},e._opus_set_signal=function(){return(e._opus_set_signal=e.asm.T).apply(null,arguments)},e._opus_get_signal=function(){return(e._opus_get_signal=e.asm.U).apply(null,arguments)},e._opus_set_application=function(){return(e._opus_set_application=e.asm.V).apply(null,arguments)},e._opus_get_application=function(){return(e._opus_get_application=e.asm.W).apply(null,arguments)},e._opus_get_lookahead=function(){return(e._opus_get_lookahead=e.asm.X).apply(null,arguments)},e._opus_set_inband_fec=function(){return(e._opus_set_inband_fec=e.asm.Y).apply(null,arguments)},e._opus_get_inband_fec=function(){return(e._opus_get_inband_fec=e.asm.Z).apply(null,arguments)},e._opus_set_packet_loss_perc=function(){return(e._opus_set_packet_loss_perc=e.asm._).apply(null,arguments)},e._opus_get_packet_loss_perc=function(){return(e._opus_get_packet_loss_perc=e.asm.$).apply(null,arguments)},e._opus_set_dtx=function(){return(e._opus_set_dtx=e.asm.aa).apply(null,arguments)},e._opus_get_dtx=function(){return(e._opus_get_dtx=e.asm.ba).apply(null,arguments)},e._opus_set_lsb_depth=function(){return(e._opus_set_lsb_depth=e.asm.ca).apply(null,arguments)},e._opus_get_lsb_depth=function(){return(e._opus_get_lsb_depth=e.asm.da).apply(null,arguments)},e._opus_set_expert_frame_duration=function(){return(e._opus_set_expert_frame_duration=e.asm.ea).apply(null,arguments)},e._opus_get_expert_frame_duration=function(){return(e._opus_get_expert_frame_duration=e.asm.fa).apply(null,arguments)},e._opus_set_prediction_disabled=function(){return(e._opus_set_prediction_disabled=e.asm.ga).apply(null,arguments)},e._opus_get_prediction_disabled=function(){return(e._opus_get_prediction_disabled=e.asm.ha).apply(null,arguments)},e._opus_get_bandwidth=function(){return(e._opus_get_bandwidth=e.asm.ia).apply(null,arguments)},e._opus_get_sample_rate=function(){return(e._opus_get_sample_rate=e.asm.ja).apply(null,arguments)},e._opus_set_phase_inversion_disabled=function(){return(e._opus_set_phase_inversion_disabled=e.asm.ka).apply(null,arguments)},e._opus_get_phase_inversion_disabled=function(){return(e._opus_get_phase_inversion_disabled=e.asm.la).apply(null,arguments)},e._opus_get_in_dtx=function(){return(e._opus_get_in_dtx=e.asm.ma).apply(null,arguments)},e._opus_set_gain=function(){return(e._opus_set_gain=e.asm.na).apply(null,arguments)},e._opus_get_gain=function(){return(e._opus_get_gain=e.asm.oa).apply(null,arguments)},e._opus_get_last_packet_duration=function(){return(e._opus_get_last_packet_duration=e.asm.pa).apply(null,arguments)},e._opus_get_pitch=function(){return(e._opus_get_pitch=e.asm.qa).apply(null,arguments)},e._malloc=function(){return(e._malloc=e.asm.ra).apply(null,arguments)},e._free=function(){return(e._free=e.asm.sa).apply(null,arguments)},v=function e(){B||q(),B||(v=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return q(),e.ready});e.exports=s},977:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(618),o=r(514),i=n(r(827)),a=r(55),u=r(864);let _={queue:new Set};function d(){return crypto.getRandomValues(new Uint32Array(4)).join("-")}function c(e,t=[]){return postMessage(e,t)}const l=async e=>{if("queue"in _){switch(e.type){case o.RequestType.InitializeWorker:{const t={runtime:new a.Runtime(await(0,i.default)({locateFile:()=>e.data.wasmFileHref}),{TextDecoder,TextEncoder}),encoders:new Map,decoders:new Map},r=new Set(_.queue);_.queue.clear(),_=t;for(const e of r)await l(e);c({requestId:e.requestId,value:null});break}default:_.queue.add(e)}return}const{runtime:t,encoders:r,decoders:n}=_;switch(e.type){case o.RequestType.CreateEncoder:{const n=new s.Encoder(t,e.data.sampleRate,e.data.channels,e.data.application,e.data.outBufferLength,e.data.pcmBufferLength),o=d();r.set(o,{sampleRate:e.data.sampleRate,ringBuffer:new s.RingBuffer(e.data.pcmBufferLength/Float32Array.BYTES_PER_ELEMENT),encoder:n}),c({requestId:e.requestId,value:o});break}case o.RequestType.CreateDecoder:{const r=new s.Decoder(t,e.data.sampleRate,e.data.channels,e.data.frameSize),o=d();n.set(o,r),c({requestId:e.requestId,value:o});break}case o.RequestType.DestroyEncoder:{const t=r.get(e.data);if(!t)throw new Error("Failed to get encoder");r.delete(e.data),t.encoder.destroy(),c(t?{requestId:e.requestId,value:null}:{requestId:e.requestId,failures:[`failed to find encoder with id: ${e.data}`]});break}case o.RequestType.DestroyDecoder:{const t=n.get(e.data.decoderId);n.delete(e.data.decoderId),t&&t.destroy(),c(t?{requestId:e.requestId,value:null}:{requestId:e.requestId,failures:[`failed to find decoder with id: ${e.data.decoderId}`]});break}case o.RequestType.EncodeFloat:{const t=r.get(e.data.encoderId);if(!t)throw new Error("Failed to get encoder");const n=null===e.data.input;e.data.input&&t.ringBuffer.write(e.data.input.pcm);const s=t.ringBuffer.read()??(n?t.ringBuffer.drain():null);if(null===s){c({requestId:e.requestId,value:{encoded:null}});break}const o=t.encoder.encodeFloat(s,s.length,e.data.maxDataBytes),i={buffer:new ArrayBuffer(o),duration:o/t.sampleRate};new Uint8Array(i.buffer).set(t.encoder.encoded().subarray(0,o)),c({requestId:e.requestId,value:{encoded:i}},[i.buffer]);break}case o.RequestType.DecodeFloat:{const t=n.get(e.data.decoderId);let r;if(t){const n=t.decodeFloat(new Uint8Array(e.data.encoded),e.data.decodeFec);r=t.decoded().slice(0,n)}else r=null;c(r?{requestId:e.requestId,value:{decoded:r.buffer}}:{requestId:e.requestId,failures:[`no decoder found for decoder id: ${e.data.decoderId}`]},r?[r.buffer]:[]);break}case o.RequestType.OpusSetRequest:{const t=r.get(e.data.encoderId);c(t?.encoder?{value:(0,u.setToEncoder)(t.encoder,e.data),requestId:e.requestId}:{requestId:e.requestId,failures:[`no encoder found for: ${e.data.encoderId}`]});break}case o.RequestType.OpusGetRequest:{const t=r.get(e.data.encoderId);c(t?.encoder?{value:(0,u.getFromEncoder)(t.encoder,e.data),requestId:e.requestId}:{requestId:e.requestId,failures:[`no encoder found for: ${e.data.encoderId}`]});break}}};onmessage=e=>{const t=e.data;l(t).catch((e=>{console.error("failed to process request: %o",{request:t,reason:e})}))}},864:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFromEncoder=t.setToEncoder=void 0;const n=r(440);t.setToEncoder=function(e,t){let r;switch(t.type){case n.OpusRequest.SetComplexity:r=e.setComplexity(t.value);break;case n.OpusRequest.SetBitrate:r=e.setBitrate(t.value);break;case n.OpusRequest.SetVbr:r=e.setVbr(t.value);break;case n.OpusRequest.SetVbrConstraint:r=e.setVbrConstraint(t.value);break;case n.OpusRequest.SetForceChannels:r=e.setForceChannels(t.value);break;case n.OpusRequest.SetMaxBandwidth:r=e.setMaxBandwidth(t.value);break;case n.OpusRequest.SetBandwidth:r=e.setBandwidth(t.value);break;case n.OpusRequest.SetSignal:r=e.setSignal(t.value);break;case n.OpusRequest.SetApplication:r=e.setApplication(t.value);break;case n.OpusRequest.SetInbandFec:r=e.setInbandFec(t.value);break;case n.OpusRequest.SetPacketLossperc:r=e.setPacketLossperc(t.value);break;case n.OpusRequest.SetDtx:r=e.setDtx(t.value);break;case n.OpusRequest.SetLsbDepth:r=e.setLsbDepth(t.value);break;case n.OpusRequest.SetExpertFrameduration:r=e.setExpertFrameduration(t.value);break;case n.OpusRequest.SetPredictionDisabled:r=e.setPredictionDisabled(t.value);break;case n.OpusRequest.SetPhaseInversiondisabled:r=e.setPhaseInversiondisabled(t.value);break;case n.OpusRequest.SetGain:r=e.setGain(t.value)}return r},t.getFromEncoder=function(e,t){let r;switch(t.type){case n.OpusRequest.GetComplexity:r=e.getComplexity();break;case n.OpusRequest.GetBitrate:r=e.getBitrate();break;case n.OpusRequest.GetVbr:r=e.getVbr();break;case n.OpusRequest.GetVbrConstraint:r=e.getVbrConstraint();break;case n.OpusRequest.GetForceChannels:r=e.getForceChannels();break;case n.OpusRequest.GetMaxBandwidth:r=e.getMaxBandwidth();break;case n.OpusRequest.GetSignal:r=e.getSignal();break;case n.OpusRequest.GetApplication:r=e.getApplication();break;case n.OpusRequest.GetLookahead:r=e.getLookahead();break;case n.OpusRequest.GetInbandFec:r=e.getInbandFec();break;case n.OpusRequest.GetPacketLossperc:r=e.getPacketLossperc();break;case n.OpusRequest.GetDtx:r=e.getDtx();break;case n.OpusRequest.GetLsbDepth:r=e.getLsbDepth();break;case n.OpusRequest.GetExpertFrameduration:r=e.getExpertFrameduration();break;case n.OpusRequest.GetPredictionDisabled:r=e.getPredictionDisabled();break;case n.OpusRequest.GetBandwidth:r=e.getBandwidth();break;case n.OpusRequest.GetSampleRate:r=e.getSampleRate();break;case n.OpusRequest.GetPhaseInversiondisabled:r=e.getPhaseInversiondisabled();break;case n.OpusRequest.GetInDtx:r=e.getInDtx();break;case n.OpusRequest.GetGain:r=e.getGain();break;case n.OpusRequest.GetLastPacketduration:r=e.getLastPacketduration();break;case n.OpusRequest.GetPitch:r=e.getPitch()}return r}},194:()=>{},472:()=>{}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(977)})();
|
package/worklet/worklet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e={572:(e,t,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t,r){var s=r.value;if("function"!=typeof s)throw new TypeError("@boundMethod decorator can only be applied to methods not: ".concat(i(s)));var o=!1;return{configurable:!0,get:function(){if(o||this===e.prototype||this.hasOwnProperty(t)||"function"!=typeof s)return s;var r=s.bind(this);return o=!0,Object.defineProperty(this,t,{configurable:!0,get:function(){return r},set:function(e){s=e,delete this[t]}}),o=!1,r},set:function(e){s=e}}}function o(e){var t;return"undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?t=Reflect.ownKeys(e.prototype):(t=Object.getOwnPropertyNames(e.prototype),"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e.prototype)))),t.forEach((function(t){if("constructor"!==t){var r=Object.getOwnPropertyDescriptor(e.prototype,t);"function"==typeof r.value&&Object.defineProperty(e.prototype,t,s(e,t,r))}})),e}function n(){return 1===arguments.length?o.apply(void 0,arguments):s.apply(void 0,arguments)}r.r(t),r.d(t,{boundClass:()=>o,boundMethod:()=>s,default:()=>n})},163:(e,t,r)=>{r.r(t),r.d(t,{Decoder:()=>f,Encoder:()=>a,RingBuffer:()=>_,constants:()=>n});class i{#e;#t;constructor(e){this.#e=e,this.#t=e.malloc(e.originalRuntime()._size_of_int())}value(){if(4!==this.#e.originalRuntime()._size_of_int())throw new Error("invalid integer byte size");return this.#e.view().getInt32(this.#t,!0)}set(e){this.#e.view().setInt32(this.#t,e,!0)}size(){return this.#e.originalRuntime()._size_of_int()}offset(){return this.#t}destroy(){this.#e.free(this.#t),this.#t=0}}class s{#r=new Set;constructor(){}add(e){this.#r.add(e)}destroy(){for(const e of this.#r)e.destroy()}}class o{#t;#i;#e;constructor(e,t){this.#e=e,this.#i=t,this.#t=e.malloc(t)}offset(){return this.#t}data(){return this.#e.subarray(this.#t,this.#t+this.#i)}size(){return this.#i}destroy(){this.#e.free(this.#t),this.#t=0}}const n={OPUS_OK:0,OPUS_BAD_ARG:-1,OPUS_BUFFER_TOO_SMALL:-2,OPUS_INTERNAL_ERROR:-3,OPUS_INVALID_PACKET:-4,OPUS_UNIMPLEMENTED:-5,OPUS_INVALID_STATE:-6," OPUS_ALLOC_FAIL":-7,OPUS_AUTO:-1e3,OPUS_BITRATE_MAX:-1,OPUS_APPLICATION_VOIP:2048,OPUS_APPLICATION_AUDIO:2049,OPUS_APPLICATION_RESTRICTED_LOWDELAY:2051,OPUS_SIGNAL_VOICE:3001,OPUS_SIGNAL_MUSIC:3002,OPUS_BANDWIDTH_NARROWBAND:1101,OPUS_BANDWIDTH_MEDIUMBAND:1102,OPUS_BANDWIDTH_WIDEBAND:1103,OPUS_BANDWIDTH_SUPERWIDEBAND:1104,OPUS_BANDWIDTH_FULLBAND:1105,OPUS_FRAMESIZE_ARG:5e3,OPUS_FRAMESIZE_2_5_MS:5001,OPUS_FRAMESIZE_5_MS:5002,OPUS_FRAMESIZE_10_MS:5003,OPUS_FRAMESIZE_20_MS:5004,OPUS_FRAMESIZE_40_MS:5005,OPUS_FRAMESIZE_60_MS:5006,OPUS_FRAMESIZE_80_MS:5007,OPUS_FRAMESIZE_100_MS:5008,OPUS_FRAMESIZE_120_MS:5009};class u{#s;#e;#o;constructor(e,t){this.#e=e,this.#o=new i(e),this.#s=t}setComplexity(e){return this.#e.originalRuntime()._opus_set_complexity(this.#s,e)===n.OPUS_OK}getComplexity(){if(this.#e.originalRuntime()._opus_get_complexity(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_COMPLEXITY");return this.#o.value()}setBitrate(e){return this.#e.originalRuntime()._opus_set_bitrate(this.#s,e)===n.OPUS_OK}getBitrate(){if(this.#e.originalRuntime()._opus_get_bitrate(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_BITRATE");return this.#o.value()}setVbr(e){return this.#e.originalRuntime()._opus_set_vbr(this.#s,e)===n.OPUS_OK}getVbr(){if(this.#e.originalRuntime()._opus_get_vbr(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR");return this.#o.value()}setVbrConstraint(e){return this.#e.originalRuntime()._opus_set_vbr_constraint(this.#s,e)===n.OPUS_OK}getVbrConstraint(){if(this.#e.originalRuntime()._opus_get_vbr_constraint(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR_CONSTRAINT");return this.#o.value()}setForceChannels(e){return this.#e.originalRuntime()._opus_set_force_channels(this.#s,e)===n.OPUS_OK}getForceChannels(){if(this.#e.originalRuntime()._opus_get_force_channels(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_FORCE_CHANNELS");return this.#o.value()}setMaxBandwidth(e){return this.#e.originalRuntime()._opus_set_max_bandwidth(this.#s,e)===n.OPUS_OK}getMaxBandwidth(){if(this.#e.originalRuntime()._opus_get_max_bandwidth(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_MAX_BANDWIDTH");return this.#o.value()}setBandwidth(e){return this.#e.originalRuntime()._opus_set_bandwidth(this.#s,e)===n.OPUS_OK}setSignal(e){return this.#e.originalRuntime()._opus_set_signal(this.#s,e)===n.OPUS_OK}getSignal(){if(this.#e.originalRuntime()._opus_get_signal(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_SIGNAL");return this.#o.value()}setApplication(e){return this.#e.originalRuntime()._opus_set_application(this.#s,e)===n.OPUS_OK}getApplication(){if(this.#e.originalRuntime()._opus_get_application(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_APPLICATION");return this.#o.value()}getLookahead(){if(this.#e.originalRuntime()._opus_get_lookahead(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_LOOKAHEAD");return this.#o.value()}setInbandFec(e){return this.#e.originalRuntime()._opus_set_inband_fec(this.#s,e)===n.OPUS_OK}getInbandFec(){if(this.#e.originalRuntime()._opus_get_inband_fec(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_INBAND_FEC");return this.#o.value()}setPacketLossperc(e){return this.#e.originalRuntime()._opus_set_packet_loss_perc(this.#s,e)===n.OPUS_OK}getPacketLossperc(){if(this.#e.originalRuntime()._opus_get_packet_loss_perc(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PACKET_LOSS_PERC");return this.#o.value()}setDtx(e){return this.#e.originalRuntime()._opus_set_dtx(this.#s,e)===n.OPUS_OK}getDtx(){if(this.#e.originalRuntime()._opus_get_dtx(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_DTX");return this.#o.value()}setLsbDepth(e){return this.#e.originalRuntime()._opus_set_lsb_depth(this.#s,e)===n.OPUS_OK}getLsbDepth(){if(this.#e.originalRuntime()._opus_get_lsb_depth(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_LSB_DEPTH");return this.#o.value()}setExpertFrameduration(e){return this.#e.originalRuntime()._opus_set_expert_frame_duration(this.#s,e)===n.OPUS_OK}getExpertFrameduration(){if(this.#e.originalRuntime()._opus_get_expert_frame_duration(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_EXPERT_FRAME_DURATION");return this.#o.value()}setPredictionDisabled(e){return this.#e.originalRuntime()._opus_set_prediction_disabled(this.#s,e)===n.OPUS_OK}getPredictionDisabled(){if(this.#e.originalRuntime()._opus_get_prediction_disabled(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PREDICTION_DISABLED");return this.#o.value()}getBandwidth(){if(this.#e.originalRuntime()._opus_get_bandwidth(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_BANDWIDTH");return this.#o.value()}getSampleRate(){if(this.#e.originalRuntime()._opus_get_sample_rate(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_SAMPLE_RATE");return this.#o.value()}setPhaseInversiondisabled(e){return this.#e.originalRuntime()._opus_set_phase_inversion_disabled(this.#s,e)===n.OPUS_OK}getPhaseInversiondisabled(){if(this.#e.originalRuntime()._opus_get_phase_inversion_disabled(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PHASE_INVERSION_DISABLED");return this.#o.value()}getInDtx(){if(this.#e.originalRuntime()._opus_get_in_dtx(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_IN_DTX");return this.#o.value()}setGain(e){return this.#e.originalRuntime()._opus_set_gain(this.#s,e)===n.OPUS_OK}getGain(){if(this.#e.originalRuntime()._opus_get_gain(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_GAIN");return this.#o.value()}getLastPacketduration(){if(this.#e.originalRuntime()._opus_get_last_packet_duration(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_LAST_PACKET_DURATION");return this.#o.value()}getPitch(){if(this.#e.originalRuntime()._opus_get_pitch(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PITCH");return this.#o.value()}}class a extends u{#n;#e;#u;#a;#f;#_;constructor(e,t,r,n,u,a){const f=new i(e),_=e.originalRuntime()._opus_encoder_create(t,r,n,f.offset());if(super(e,_),this.#_=new s,this.#n=f,this.#e=e,this.#f=new o(e,a),this.#a=new o(e,u),this.#_.add(this.#a),this.#_.add(this.#f),this.#_.add(this.#n),this.#u=_,f.value()<0)throw new Error("Failed to create encoder");if(!u)throw new Error("outBufferLength must be more than 0")}encoded(){return this.#a.data()}encodeFloat(e,t,r){if(r>this.#a.size())throw new Error(`encoded buffer length is ${this.#a.size()}, but maxDataBytes is ${r}`);this.#f.data().set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));const i=this.#e.originalRuntime()._opus_encode_float(this.#u,this.#f.offset(),t,this.#a.offset(),r);if(i<0)throw new Error("Failed to encode float");return i}destroy(){this.#_.destroy(),this.#e.originalRuntime()._opus_encoder_destroy(this.#u)}}class f{#n;#h;#_;#e;#f;#l;constructor(e,t,r,n){if(this.#l=n,this.#e=e,this.#_=new s,this.#n=new i(e),this.#_.add(this.#n),this.#h=e.originalRuntime()._opus_decoder_create(t,r,this.#n.offset()),!this.#h||this.#n.value()<0)throw new Error("Failed to create decoder");this.#f=new o(e,this.#l*r*Float32Array.BYTES_PER_ELEMENT)}#d=null;decodeFloat(e,t=0){let r=this.#d;r||(r=new o(this.#e,e.byteLength)),r.data().byteLength<e.byteLength&&(r.destroy(),r=new o(this.#e,e.byteLength)),r.data().set(e),this.#d=r;const i=this.#e.originalRuntime()._opus_decode_float(this.#h,r.offset(),e.byteLength,this.#f.offset(),this.#l,t);if(i<0)throw new Error("Failed to decode float");return i}decoded(){const e=this.#f.data();return new Float32Array(e.buffer,e.byteOffset,e.byteLength/Float32Array.BYTES_PER_ELEMENT)}destroy(){this.#e.originalRuntime()._opus_decoder_destroy(this.#h),this.#_.destroy(),this.#d?.destroy()}}class _{#c;#O;#p;#l;constructor(e){this.#O=0,this.#p=0,this.#c=new ArrayBuffer(this.#E()),this.#l=e}#m(){return new Float32Array(this.#c)}write(e){this.#S(e.length),this.#m().set(e,this.#p),this.#p+=e.length}drain(){return this.#g(this.#p-this.#O)}read(){return this.#g(this.#l)}#g(e){if(!e)return null;if(this.#p-this.#O>=e){const t=this.#m().subarray(this.#O,this.#O+e);return this.#O+=e,this.#O>=this.#p&&(this.#p=0,this.#O=0),t}return null}#S(e){const t=e*Float32Array.BYTES_PER_ELEMENT;if(this.#m().length-this.#p<=e){const e=this.#c;this.#c=new ArrayBuffer(e.byteLength+t+this.#E()),this.#m().set(new Float32Array(e))}}#E(){return this.#l*Float32Array.BYTES_PER_ELEMENT*2}}},188:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var s,o=arguments.length,n=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,i);else for(var u=e.length-1;u>=0;u--)(s=e[u])&&(n=(o<3?s(n):o>3?s(t,r,n):s(t,r))||n);return o>3&&n&&Object.defineProperty(t,r,n),n};Object.defineProperty(t,"__esModule",{value:!0});const s=r(572),o=r(163);class n extends AudioWorkletProcessor{#P=null;#w=!0;static get parameterDescriptors(){return[{name:"frameSize"},{name:"debug"}]}constructor(...e){super(e),this.port.addEventListener("message",this.onMessage),this.port.start()}process(e,t,r){const i=r.frameSize[0],s=!!r.debug[0];this.#P||(this.#P=new o.RingBuffer(i)),e.length||console.error("no data available in input list: %o",e);for(const t of e){if(!t.length){console.error("channel available, but no data: %o",t);break}this.#P.write(t[0]);const e=this.#P.read();e&&(s&&console.log("read %d samples out from ring buffer",e.length),this.port.postMessage({samples:e}));break}if(!this.#w){let e;do{e=this.#P.drain(),null!==e&&this.port.postMessage({samples:e})}while(null!==e)}return this.#w}onMessage(e){e.data&&e.data.stop&&(this.#w=!1)}}i([s.boundMethod],n.prototype,"onMessage",null),registerProcessor("default-audio-processor",n)}},t={};function r(i){var s=t[i];if(void 0!==s)return s.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(188)})();
|
|
1
|
+
(()=>{"use strict";var e={572:(e,t,r)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t,r){var s=r.value;if("function"!=typeof s)throw new TypeError("@boundMethod decorator can only be applied to methods not: ".concat(i(s)));var o=!1;return{configurable:!0,get:function(){if(o||this===e.prototype||this.hasOwnProperty(t)||"function"!=typeof s)return s;var r=s.bind(this);return o=!0,Object.defineProperty(this,t,{configurable:!0,get:function(){return r},set:function(e){s=e,delete this[t]}}),o=!1,r},set:function(e){s=e}}}function o(e){var t;return"undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?t=Reflect.ownKeys(e.prototype):(t=Object.getOwnPropertyNames(e.prototype),"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(e.prototype)))),t.forEach((function(t){if("constructor"!==t){var r=Object.getOwnPropertyDescriptor(e.prototype,t);"function"==typeof r.value&&Object.defineProperty(e.prototype,t,s(e,t,r))}})),e}function n(){return 1===arguments.length?o.apply(void 0,arguments):s.apply(void 0,arguments)}r.r(t),r.d(t,{boundClass:()=>o,boundMethod:()=>s,default:()=>n})},163:(e,t,r)=>{r.r(t),r.d(t,{Decoder:()=>f,Encoder:()=>a,RingBuffer:()=>_,constants:()=>n});class i{#e;#t;constructor(e){this.#e=e,this.#t=e.malloc(e.originalRuntime()._size_of_int())}value(){if(4!==this.#e.originalRuntime()._size_of_int())throw new Error("invalid integer byte size");return this.#e.view().getInt32(this.#t,!0)}set(e){this.#e.view().setInt32(this.#t,e,!0)}size(){return this.#e.originalRuntime()._size_of_int()}offset(){return this.#t}destroy(){this.#e.free(this.#t),this.#t=0}}class s{#r=new Set;constructor(){}add(e){this.#r.add(e)}destroy(){for(const e of this.#r)e.destroy()}}class o{#t;#i;#e;constructor(e,t){this.#e=e,this.#i=t,this.#t=e.malloc(t)}offset(){return this.#t}data(){return this.#e.subarray(this.#t,this.#t+this.#i)}size(){return this.#i}destroy(){this.#e.free(this.#t),this.#t=0}}const n={OPE_OK:0,OPE_BAD_ARG:-11,OPE_INTERNAL_ERROR:-13,OPE_UNIMPLEMENTED:-15,OPE_ALLOC_FAIL:-17,OPE_CANNOT_OPEN:-30,OPE_TOO_LATE:-31,OPE_INVALID_PICTURE:-32,OPE_INVALID_ICON:-33,OPE_WRITE_FAIL:-34,OPE_CLOSE_FAIL:-35,OPUS_OK:0,OPUS_BAD_ARG:-1,OPUS_BUFFER_TOO_SMALL:-2,OPUS_INTERNAL_ERROR:-3,OPUS_INVALID_PACKET:-4,OPUS_UNIMPLEMENTED:-5,OPUS_INVALID_STATE:-6,OPUS_ALLOC_FAIL:-7,OPUS_AUTO:-1e3,OPUS_BITRATE_MAX:-1,OPUS_APPLICATION_VOIP:2048,OPUS_APPLICATION_AUDIO:2049,OPUS_APPLICATION_RESTRICTED_LOWDELAY:2051,OPUS_SIGNAL_VOICE:3001,OPUS_SIGNAL_MUSIC:3002,OPUS_BANDWIDTH_NARROWBAND:1101,OPUS_BANDWIDTH_MEDIUMBAND:1102,OPUS_BANDWIDTH_WIDEBAND:1103,OPUS_BANDWIDTH_SUPERWIDEBAND:1104,OPUS_BANDWIDTH_FULLBAND:1105,OPUS_FRAMESIZE_ARG:5e3,OPUS_FRAMESIZE_2_5_MS:5001,OPUS_FRAMESIZE_5_MS:5002,OPUS_FRAMESIZE_10_MS:5003,OPUS_FRAMESIZE_20_MS:5004,OPUS_FRAMESIZE_40_MS:5005,OPUS_FRAMESIZE_60_MS:5006,OPUS_FRAMESIZE_80_MS:5007,OPUS_FRAMESIZE_100_MS:5008,OPUS_FRAMESIZE_120_MS:5009};class u{#s;#e;#o;constructor(e,t){this.#e=e,this.#o=new i(e),this.#s=t}setComplexity(e){return this.#e.originalRuntime()._opus_set_complexity(this.#s,e)===n.OPUS_OK}getComplexity(){if(this.#e.originalRuntime()._opus_get_complexity(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_COMPLEXITY");return this.#o.value()}setBitrate(e){return this.#e.originalRuntime()._opus_set_bitrate(this.#s,e)===n.OPUS_OK}getBitrate(){if(this.#e.originalRuntime()._opus_get_bitrate(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_BITRATE");return this.#o.value()}setVbr(e){return this.#e.originalRuntime()._opus_set_vbr(this.#s,e)===n.OPUS_OK}getVbr(){if(this.#e.originalRuntime()._opus_get_vbr(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR");return this.#o.value()}setVbrConstraint(e){return this.#e.originalRuntime()._opus_set_vbr_constraint(this.#s,e)===n.OPUS_OK}getVbrConstraint(){if(this.#e.originalRuntime()._opus_get_vbr_constraint(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_VBR_CONSTRAINT");return this.#o.value()}setForceChannels(e){return this.#e.originalRuntime()._opus_set_force_channels(this.#s,e)===n.OPUS_OK}getForceChannels(){if(this.#e.originalRuntime()._opus_get_force_channels(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_FORCE_CHANNELS");return this.#o.value()}setMaxBandwidth(e){return this.#e.originalRuntime()._opus_set_max_bandwidth(this.#s,e)===n.OPUS_OK}getMaxBandwidth(){if(this.#e.originalRuntime()._opus_get_max_bandwidth(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_MAX_BANDWIDTH");return this.#o.value()}setBandwidth(e){return this.#e.originalRuntime()._opus_set_bandwidth(this.#s,e)===n.OPUS_OK}setSignal(e){return this.#e.originalRuntime()._opus_set_signal(this.#s,e)===n.OPUS_OK}getSignal(){if(this.#e.originalRuntime()._opus_get_signal(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_SIGNAL");return this.#o.value()}setApplication(e){return this.#e.originalRuntime()._opus_set_application(this.#s,e)===n.OPUS_OK}getApplication(){if(this.#e.originalRuntime()._opus_get_application(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_APPLICATION");return this.#o.value()}getLookahead(){if(this.#e.originalRuntime()._opus_get_lookahead(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_LOOKAHEAD");return this.#o.value()}setInbandFec(e){return this.#e.originalRuntime()._opus_set_inband_fec(this.#s,e)===n.OPUS_OK}getInbandFec(){if(this.#e.originalRuntime()._opus_get_inband_fec(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_INBAND_FEC");return this.#o.value()}setPacketLossperc(e){return this.#e.originalRuntime()._opus_set_packet_loss_perc(this.#s,e)===n.OPUS_OK}getPacketLossperc(){if(this.#e.originalRuntime()._opus_get_packet_loss_perc(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PACKET_LOSS_PERC");return this.#o.value()}setDtx(e){return this.#e.originalRuntime()._opus_set_dtx(this.#s,e)===n.OPUS_OK}getDtx(){if(this.#e.originalRuntime()._opus_get_dtx(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_DTX");return this.#o.value()}setLsbDepth(e){return this.#e.originalRuntime()._opus_set_lsb_depth(this.#s,e)===n.OPUS_OK}getLsbDepth(){if(this.#e.originalRuntime()._opus_get_lsb_depth(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_LSB_DEPTH");return this.#o.value()}setExpertFrameduration(e){return this.#e.originalRuntime()._opus_set_expert_frame_duration(this.#s,e)===n.OPUS_OK}getExpertFrameduration(){if(this.#e.originalRuntime()._opus_get_expert_frame_duration(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_EXPERT_FRAME_DURATION");return this.#o.value()}setPredictionDisabled(e){return this.#e.originalRuntime()._opus_set_prediction_disabled(this.#s,e)===n.OPUS_OK}getPredictionDisabled(){if(this.#e.originalRuntime()._opus_get_prediction_disabled(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PREDICTION_DISABLED");return this.#o.value()}getBandwidth(){if(this.#e.originalRuntime()._opus_get_bandwidth(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_BANDWIDTH");return this.#o.value()}getSampleRate(){if(this.#e.originalRuntime()._opus_get_sample_rate(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_SAMPLE_RATE");return this.#o.value()}setPhaseInversiondisabled(e){return this.#e.originalRuntime()._opus_set_phase_inversion_disabled(this.#s,e)===n.OPUS_OK}getPhaseInversiondisabled(){if(this.#e.originalRuntime()._opus_get_phase_inversion_disabled(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PHASE_INVERSION_DISABLED");return this.#o.value()}getInDtx(){if(this.#e.originalRuntime()._opus_get_in_dtx(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_IN_DTX");return this.#o.value()}setGain(e){return this.#e.originalRuntime()._opus_set_gain(this.#s,e)===n.OPUS_OK}getGain(){if(this.#e.originalRuntime()._opus_get_gain(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_GAIN");return this.#o.value()}getLastPacketduration(){if(this.#e.originalRuntime()._opus_get_last_packet_duration(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_LAST_PACKET_DURATION");return this.#o.value()}getPitch(){if(this.#e.originalRuntime()._opus_get_pitch(this.#s,this.#o.offset())!=n.OPUS_OK)throw new Error("Failed to set OPUS_GET_PITCH");return this.#o.value()}}class a extends u{#n;#e;#u;#a;#f;#_;constructor(e,t,r,n,u,a){const f=new i(e),_=e.originalRuntime()._opus_encoder_create(t,r,n,f.offset());if(super(e,_),this.#_=new s,this.#n=f,this.#e=e,this.#f=new o(e,a),this.#a=new o(e,u),this.#_.add(this.#a),this.#_.add(this.#f),this.#_.add(this.#n),this.#u=_,f.value()<0)throw new Error("Failed to create encoder");if(!u)throw new Error("outBufferLength must be more than 0")}encoded(){return this.#a.data()}encodeFloat(e,t,r){if(r>this.#a.size())throw new Error(`encoded buffer length is ${this.#a.size()}, but maxDataBytes is ${r}`);this.#f.data().set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));const i=this.#e.originalRuntime()._opus_encode_float(this.#u,this.#f.offset(),t,this.#a.offset(),r);if(i<0)throw new Error("Failed to encode float");return i}destroy(){this.#_.destroy(),this.#e.originalRuntime()._opus_encoder_destroy(this.#u)}}class f{#n;#h;#_;#e;#f;#l;constructor(e,t,r,n){if(this.#l=n,this.#e=e,this.#_=new s,this.#n=new i(e),this.#_.add(this.#n),this.#h=e.originalRuntime()._opus_decoder_create(t,r,this.#n.offset()),!this.#h||this.#n.value()<0)throw new Error("Failed to create decoder");this.#f=new o(e,this.#l*r*Float32Array.BYTES_PER_ELEMENT)}#d=null;decodeFloat(e,t=0){let r=this.#d;r||(r=new o(this.#e,e.byteLength)),r.data().byteLength<e.byteLength&&(r.destroy(),r=new o(this.#e,e.byteLength)),r.data().set(e),this.#d=r;const i=this.#e.originalRuntime()._opus_decode_float(this.#h,r.offset(),e.byteLength,this.#f.offset(),this.#l,t);if(i<0)throw new Error("Failed to decode float");return i}decoded(){const e=this.#f.data();return new Float32Array(e.buffer,e.byteOffset,e.byteLength/Float32Array.BYTES_PER_ELEMENT)}destroy(){this.#e.originalRuntime()._opus_decoder_destroy(this.#h),this.#_.destroy(),this.#d?.destroy()}}class _{#O;#c;#p;#l;constructor(e){this.#c=0,this.#p=0,this.#O=new ArrayBuffer(this.#E()),this.#l=e}#m(){return new Float32Array(this.#O)}write(e){this.#S(e.length),this.#m().set(e,this.#p),this.#p+=e.length}drain(){const e=this.#p-this.#c;return this.#P(e>=this.#l?this.#l:e)}read(){return this.#P(this.#l)}#P(e){if(!e)return null;if(this.#p-this.#c>=e){const t=this.#m().subarray(this.#c,this.#c+e);return this.#c+=e,this.#c>=this.#p&&(this.#p=0,this.#c=0),t}return null}#S(e){const t=e*Float32Array.BYTES_PER_ELEMENT;if(this.#m().length-this.#p<=e){const e=this.#O;this.#O=new ArrayBuffer(e.byteLength+t+this.#E()),this.#m().set(new Float32Array(e))}}#E(){return this.#l*Float32Array.BYTES_PER_ELEMENT*2}}},188:function(e,t,r){var i=this&&this.__decorate||function(e,t,r,i){var s,o=arguments.length,n=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,i);else for(var u=e.length-1;u>=0;u--)(s=e[u])&&(n=(o<3?s(n):o>3?s(t,r,n):s(t,r))||n);return o>3&&n&&Object.defineProperty(t,r,n),n};Object.defineProperty(t,"__esModule",{value:!0});const s=r(572),o=r(163);class n extends AudioWorkletProcessor{#g=null;#w=!0;static get parameterDescriptors(){return[{name:"frameSize"},{name:"debug"}]}constructor(...e){super(e),this.port.addEventListener("message",this.onMessage),this.port.start()}process(e,t,r){const i=r.frameSize[0],s=!!r.debug[0];this.#g||(this.#g=new o.RingBuffer(i)),e.length||console.error("no data available in input list: %o",e);for(const t of e){if(!t.length){console.error("channel available, but no data: %o",t);break}this.#g.write(t[0]);const e=this.#g.read();e&&(s&&console.log("read %d samples out from ring buffer",e.length),this.port.postMessage({samples:e}));break}if(!this.#w){let e;do{e=this.#g.drain(),null!==e&&this.port.postMessage({samples:e})}while(null!==e)}return this.#w}onMessage(e){e.data&&e.data.stop&&(this.#w=!1)}}i([s.boundMethod],n.prototype,"onMessage",null),registerProcessor("default-audio-processor",n)}},t={};function r(i){var s=t[i];if(void 0!==s)return s.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,r),o.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(188)})();
|