opus-codec 0.0.86 → 1.0.3

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.
Files changed (124) hide show
  1. package/es/actions/Client.d.ts +1 -1
  2. package/es/actions/Client.d.ts.map +1 -1
  3. package/es/actions/Client.js +6 -22
  4. package/es/actions/Client.js.map +1 -1
  5. package/es/actions/actions.d.ts +2 -2
  6. package/es/actions/actions.d.ts.map +1 -1
  7. package/es/actions/actions.js +1 -1
  8. package/es/actions/actions.js.map +1 -1
  9. package/es/actions/index.d.ts +1 -1
  10. package/es/actions/index.d.ts.map +1 -1
  11. package/es/actions/index.js +1 -1
  12. package/es/actions/index.js.map +1 -1
  13. package/es/opus/Decoder.d.ts +3 -2
  14. package/es/opus/Decoder.d.ts.map +1 -1
  15. package/es/opus/Decoder.js +9 -5
  16. package/es/opus/Decoder.js.map +1 -1
  17. package/es/opus/Encoder.d.ts +4 -3
  18. package/es/opus/Encoder.d.ts.map +1 -1
  19. package/es/opus/Encoder.js +14 -9
  20. package/es/opus/Encoder.js.map +1 -1
  21. package/es/opus/OpusGettersAndSetters.d.ts +4 -2
  22. package/es/opus/OpusGettersAndSetters.d.ts.map +1 -1
  23. package/es/opus/OpusGettersAndSetters.js +47 -41
  24. package/es/opus/OpusGettersAndSetters.js.map +1 -1
  25. package/es/opus/RingBuffer.d.ts +2 -7
  26. package/es/opus/RingBuffer.d.ts.map +1 -1
  27. package/es/opus/RingBuffer.js +1 -58
  28. package/es/opus/RingBuffer.js.map +1 -1
  29. package/es/opus/constants.d.ts +0 -11
  30. package/es/opus/constants.d.ts.map +1 -1
  31. package/es/opus/constants.js +0 -11
  32. package/es/opus/constants.js.map +1 -1
  33. package/es/opus/index.d.ts +3 -4
  34. package/es/opus/index.d.ts.map +1 -1
  35. package/es/opus/index.js +3 -4
  36. package/es/opus/index.js.map +1 -1
  37. package/es/runtime/Buffer.d.ts +4 -3
  38. package/es/runtime/Buffer.d.ts.map +1 -1
  39. package/es/runtime/Buffer.js +3 -0
  40. package/es/runtime/Buffer.js.map +1 -1
  41. package/es/runtime/Integer.d.ts +3 -2
  42. package/es/runtime/Integer.d.ts.map +1 -1
  43. package/es/runtime/Integer.js +9 -3
  44. package/es/runtime/Integer.js.map +1 -1
  45. package/es/runtime/ResourcesHolder.d.ts +2 -0
  46. package/es/runtime/ResourcesHolder.d.ts.map +1 -1
  47. package/es/runtime/ResourcesHolder.js +10 -2
  48. package/es/runtime/ResourcesHolder.js.map +1 -1
  49. package/es/runtime/Runtime.d.ts +5 -17
  50. package/es/runtime/Runtime.d.ts.map +1 -1
  51. package/es/runtime/Runtime.js +15 -10
  52. package/es/runtime/Runtime.js.map +1 -1
  53. package/es/runtime/index.d.ts +4 -5
  54. package/es/runtime/index.d.ts.map +1 -1
  55. package/es/runtime/index.js +4 -5
  56. package/es/runtime/index.js.map +1 -1
  57. package/native/index.d.ts +17 -49
  58. package/native/index.js +75 -15
  59. package/native/index.wasm +0 -0
  60. package/native/opus-ts-getters-and-setters.d.ts +39 -39
  61. package/opus/Decoder.d.ts +3 -2
  62. package/opus/Decoder.d.ts.map +1 -1
  63. package/opus/Decoder.js +15 -14
  64. package/opus/Decoder.js.map +1 -1
  65. package/opus/Encoder.d.ts +4 -3
  66. package/opus/Encoder.d.ts.map +1 -1
  67. package/opus/Encoder.js +19 -17
  68. package/opus/Encoder.js.map +1 -1
  69. package/opus/OpusGettersAndSetters.d.ts +4 -2
  70. package/opus/OpusGettersAndSetters.d.ts.map +1 -1
  71. package/opus/OpusGettersAndSetters.js +88 -89
  72. package/opus/OpusGettersAndSetters.js.map +1 -1
  73. package/opus/constants.d.ts +0 -11
  74. package/opus/constants.d.ts.map +1 -1
  75. package/opus/constants.js +1 -14
  76. package/opus/constants.js.map +1 -1
  77. package/opus/index.d.ts +3 -4
  78. package/opus/index.d.ts.map +1 -1
  79. package/opus/index.js +3 -14
  80. package/opus/index.js.map +1 -1
  81. package/package.json +30 -28
  82. package/runtime/Buffer.d.ts +4 -3
  83. package/runtime/Buffer.d.ts.map +1 -1
  84. package/runtime/Buffer.js +4 -4
  85. package/runtime/Buffer.js.map +1 -1
  86. package/runtime/Integer.d.ts +3 -2
  87. package/runtime/Integer.d.ts.map +1 -1
  88. package/runtime/Integer.js +10 -7
  89. package/runtime/Integer.js.map +1 -1
  90. package/runtime/ResourcesHolder.d.ts +2 -0
  91. package/runtime/ResourcesHolder.d.ts.map +1 -1
  92. package/runtime/ResourcesHolder.js +11 -6
  93. package/runtime/ResourcesHolder.js.map +1 -1
  94. package/runtime/Runtime.d.ts +5 -17
  95. package/runtime/Runtime.d.ts.map +1 -1
  96. package/runtime/Runtime.js +16 -14
  97. package/runtime/Runtime.js.map +1 -1
  98. package/runtime/index.d.ts +4 -5
  99. package/runtime/index.d.ts.map +1 -1
  100. package/runtime/index.js +4 -16
  101. package/runtime/index.js.map +1 -1
  102. package/es/runtime/RuntimeString.d.ts +0 -9
  103. package/es/runtime/RuntimeString.d.ts.map +0 -1
  104. package/es/runtime/RuntimeString.js +0 -42
  105. package/es/runtime/RuntimeString.js.map +0 -1
  106. package/native/index.wasm.map +0 -1
  107. package/native/libopusenc-cmake/src/COPYING +0 -29
  108. package/native/libopusenc-cmake/src/README.md +0 -11
  109. package/native/opus/COPYING +0 -44
  110. package/native/opus/README +0 -161
  111. package/native/opus/README.draft +0 -54
  112. package/native/speexdsp-cmake/src/COPYING +0 -35
  113. package/native/speexdsp-cmake/src/README +0 -3
  114. package/native/speexdsp-cmake/src/README.Trimedia +0 -103
  115. package/native/speexdsp-cmake/src/README.blackfin +0 -22
  116. package/native/speexdsp-cmake/src/README.win32 +0 -11
  117. package/opus/RingBuffer.d.ts +0 -8
  118. package/opus/RingBuffer.d.ts.map +0 -1
  119. package/opus/RingBuffer.js +0 -62
  120. package/opus/RingBuffer.js.map +0 -1
  121. package/runtime/RuntimeString.d.ts +0 -9
  122. package/runtime/RuntimeString.d.ts.map +0 -1
  123. package/runtime/RuntimeString.js +0 -45
  124. package/runtime/RuntimeString.js.map +0 -1
package/native/index.js CHANGED
@@ -1,21 +1,81 @@
1
+ async function wasmNoop(returnValue) {
2
+ return (...args) => {
3
+ console.log(args);
4
+ return returnValue; // Success
5
+ };
6
+ }
7
+
8
+ async function createModule({ wasmFileHref } = {}) {
9
+ const wasi_snapshot_preview1 = {};
10
+ for (const funcName of [
11
+ 'args_get',
12
+ 'args_sizes_get',
13
+ 'fd_close',
14
+ 'fd_seek',
15
+ 'fd_write',
16
+ 'proc_exit'
17
+ ]) {
18
+ wasi_snapshot_preview1[funcName] = function (args) {
19
+ console.log('[%s] called with %o', funcName, args);
20
+ return 0; // Success
21
+ };
22
+ }
23
+
24
+ const importObject = {
25
+ wasi_snapshot_preview1
26
+ };
27
+
28
+ let memory;
29
+ const shouldImportMemory = process.env['WASI_IMPORT_MEMORY'];
30
+
31
+ if (shouldImportMemory) {
32
+ memory = new WebAssembly.Memory({ initial: 256, maximum: 32768 });
33
+ importObject['env'] = {
34
+ memory
35
+ };
36
+ } else {
37
+ memory = null;
38
+ }
39
+
40
+ let pendingWebAssemblyInstantiateSource;
41
+ if (process.env['NODE_ENV'] !== 'production') {
42
+ const fs = await import('fs');
43
+ const path = await import('path');
44
+ const wasmPath = path.resolve(import.meta.dirname, 'index.wasm');
45
+ const wasmBinary = await fs.promises.readFile(wasmPath);
46
+ pendingWebAssemblyInstantiateSource = WebAssembly.instantiate(
47
+ wasmBinary,
48
+ importObject
49
+ );
50
+ } else {
51
+ if (typeof wasmFileHref !== 'string') {
52
+ const wasmBinaryUrl = await import('./index.wasm');
53
+ wasmFileHref = wasmBinaryUrl.default;
54
+ }
55
+
56
+ if (typeof wasmFileHref !== 'string') {
57
+ throw new Error('Invalid wasmFileHref');
58
+ }
1
59
 
2
- var Module = (() => {
3
- var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
4
- if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
5
- return (
6
- function(Module = {}) {
60
+ const response = await fetch(wasmFileHref);
61
+ pendingWebAssemblyInstantiateSource =
62
+ await WebAssembly.instantiateStreaming(response, importObject);
63
+ }
7
64
 
8
- var Module=typeof Module!="undefined"?Module:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise(function(resolve,reject){readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,function(err,data){if(err)onerror(err);else onload(data.buffer)})};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):undefined;function UTF8ArrayToString(heapOrArray,idx,maxBytesToRead){var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):""}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}}function removeRunDependency(id){runDependencies--;if(Module["monitorRunDependencies"]){Module["monitorRunDependencies"](runDependencies)}if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){if(Module["onAbort"]){Module["onAbort"](what)}what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";function isDataURI(filename){return filename.startsWith(dataURIPrefix)}function isFileURI(filename){return filename.startsWith("file://")}var wasmBinaryFile;wasmBinaryFile="index.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}function getBinary(file){try{if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}catch(err){abort(err)}}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(function(response){if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(function(){return getBinary(binaryFile)})}}return Promise.resolve().then(function(){return getBinary(binaryFile)})}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(function(binary){return WebAssembly.instantiate(binary,imports)}).then(function(instance){return instance}).then(receiver,function(reason){err("failed to asynchronously prepare wasm: "+reason);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(function(response){var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err("wasm streaming compile failed: "+reason);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}else{return instantiateArrayBuffer(binaryFile,imports,callback)}}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){var exports=instance.exports;Module["asm"]=exports;wasmMemory=Module["asm"]["g"];updateMemoryViews();wasmTable=Module["asm"]["ta"];addOnInit(Module["asm"]["h"]);removeRunDependency("wasm-instantiate");return exports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err("Module.instantiateWasm callback failed with error: "+e);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}function callRuntimeCallbacks(callbacks){while(callbacks.length>0){callbacks.shift()(Module)}}function _abort(){abort("")}function _emscripten_memcpy_big(dest,src,num){HEAPU8.copyWithin(dest,src,src+num)}function abortOnCannotGrowMemory(requestedSize){abort("OOM")}function _emscripten_resize_heap(requestedSize){var oldSize=HEAPU8.length;requestedSize=requestedSize>>>0;abortOnCannotGrowMemory(requestedSize)}var SYSCALLS={varargs:undefined,get:function(){SYSCALLS.varargs+=4;var ret=HEAP32[SYSCALLS.varargs-4>>2];return ret},getStr:function(ptr){var ret=UTF8ToString(ptr);return ret}};function _fd_close(fd){return 52}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){return 70}var printCharBuffers=[null,[],[]];function printChar(stream,curr){var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer,0));buffer.length=0}else{buffer.push(curr)}}function _fd_write(fd,iov,iovcnt,pnum){var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0}var wasmImports={"c":_abort,"e":_emscripten_memcpy_big,"f":_emscripten_resize_heap,"d":_fd_close,"b":_fd_seek,"a":_fd_write};var asm=createWasm();var ___wasm_call_ctors=function(){return(___wasm_call_ctors=Module["asm"]["h"]).apply(null,arguments)};var _opus_decoder_create=Module["_opus_decoder_create"]=function(){return(_opus_decoder_create=Module["_opus_decoder_create"]=Module["asm"]["i"]).apply(null,arguments)};var _opus_decode_float=Module["_opus_decode_float"]=function(){return(_opus_decode_float=Module["_opus_decode_float"]=Module["asm"]["j"]).apply(null,arguments)};var _opus_decoder_destroy=Module["_opus_decoder_destroy"]=function(){return(_opus_decoder_destroy=Module["_opus_decoder_destroy"]=Module["asm"]["k"]).apply(null,arguments)};var _opus_encoder_create=Module["_opus_encoder_create"]=function(){return(_opus_encoder_create=Module["_opus_encoder_create"]=Module["asm"]["l"]).apply(null,arguments)};var _opus_encode_float=Module["_opus_encode_float"]=function(){return(_opus_encode_float=Module["_opus_encode_float"]=Module["asm"]["m"]).apply(null,arguments)};var _opus_encoder_ctl=Module["_opus_encoder_ctl"]=function(){return(_opus_encoder_ctl=Module["_opus_encoder_ctl"]=Module["asm"]["n"]).apply(null,arguments)};var _opus_encoder_destroy=Module["_opus_encoder_destroy"]=function(){return(_opus_encoder_destroy=Module["_opus_encoder_destroy"]=Module["asm"]["o"]).apply(null,arguments)};var _ope_comments_create=Module["_ope_comments_create"]=function(){return(_ope_comments_create=Module["_ope_comments_create"]=Module["asm"]["p"]).apply(null,arguments)};var _ope_comments_copy=Module["_ope_comments_copy"]=function(){return(_ope_comments_copy=Module["_ope_comments_copy"]=Module["asm"]["q"]).apply(null,arguments)};var _ope_comments_destroy=Module["_ope_comments_destroy"]=function(){return(_ope_comments_destroy=Module["_ope_comments_destroy"]=Module["asm"]["r"]).apply(null,arguments)};var _ope_comments_add=Module["_ope_comments_add"]=function(){return(_ope_comments_add=Module["_ope_comments_add"]=Module["asm"]["s"]).apply(null,arguments)};var _ope_comments_add_string=Module["_ope_comments_add_string"]=function(){return(_ope_comments_add_string=Module["_ope_comments_add_string"]=Module["asm"]["t"]).apply(null,arguments)};var _ope_comments_add_picture_from_memory=Module["_ope_comments_add_picture_from_memory"]=function(){return(_ope_comments_add_picture_from_memory=Module["_ope_comments_add_picture_from_memory"]=Module["asm"]["u"]).apply(null,arguments)};var _ope_encoder_destroy=Module["_ope_encoder_destroy"]=function(){return(_ope_encoder_destroy=Module["_ope_encoder_destroy"]=Module["asm"]["v"]).apply(null,arguments)};var _ope_encoder_create_pull=Module["_ope_encoder_create_pull"]=function(){return(_ope_encoder_create_pull=Module["_ope_encoder_create_pull"]=Module["asm"]["w"]).apply(null,arguments)};var _ope_encoder_write_float=Module["_ope_encoder_write_float"]=function(){return(_ope_encoder_write_float=Module["_ope_encoder_write_float"]=Module["asm"]["x"]).apply(null,arguments)};var _ope_encoder_ctl=Module["_ope_encoder_ctl"]=function(){return(_ope_encoder_ctl=Module["_ope_encoder_ctl"]=Module["asm"]["y"]).apply(null,arguments)};var _ope_encoder_get_page=Module["_ope_encoder_get_page"]=function(){return(_ope_encoder_get_page=Module["_ope_encoder_get_page"]=Module["asm"]["z"]).apply(null,arguments)};var _ope_encoder_drain=Module["_ope_encoder_drain"]=function(){return(_ope_encoder_drain=Module["_ope_encoder_drain"]=Module["asm"]["A"]).apply(null,arguments)};var _ope_encoder_flush_header=Module["_ope_encoder_flush_header"]=function(){return(_ope_encoder_flush_header=Module["_ope_encoder_flush_header"]=Module["asm"]["B"]).apply(null,arguments)};var _ope_strerror=Module["_ope_strerror"]=function(){return(_ope_strerror=Module["_ope_strerror"]=Module["asm"]["C"]).apply(null,arguments)};var _size_of_int=Module["_size_of_int"]=function(){return(_size_of_int=Module["_size_of_int"]=Module["asm"]["D"]).apply(null,arguments)};var _size_of_size_t=Module["_size_of_size_t"]=function(){return(_size_of_size_t=Module["_size_of_size_t"]=Module["asm"]["E"]).apply(null,arguments)};var _size_of_void_ptr=Module["_size_of_void_ptr"]=function(){return(_size_of_void_ptr=Module["_size_of_void_ptr"]=Module["asm"]["F"]).apply(null,arguments)};var _opus_set_complexity=Module["_opus_set_complexity"]=function(){return(_opus_set_complexity=Module["_opus_set_complexity"]=Module["asm"]["G"]).apply(null,arguments)};var _opus_get_complexity=Module["_opus_get_complexity"]=function(){return(_opus_get_complexity=Module["_opus_get_complexity"]=Module["asm"]["H"]).apply(null,arguments)};var _opus_set_bitrate=Module["_opus_set_bitrate"]=function(){return(_opus_set_bitrate=Module["_opus_set_bitrate"]=Module["asm"]["I"]).apply(null,arguments)};var _opus_get_bitrate=Module["_opus_get_bitrate"]=function(){return(_opus_get_bitrate=Module["_opus_get_bitrate"]=Module["asm"]["J"]).apply(null,arguments)};var _opus_set_vbr=Module["_opus_set_vbr"]=function(){return(_opus_set_vbr=Module["_opus_set_vbr"]=Module["asm"]["K"]).apply(null,arguments)};var _opus_get_vbr=Module["_opus_get_vbr"]=function(){return(_opus_get_vbr=Module["_opus_get_vbr"]=Module["asm"]["L"]).apply(null,arguments)};var _opus_set_vbr_constraint=Module["_opus_set_vbr_constraint"]=function(){return(_opus_set_vbr_constraint=Module["_opus_set_vbr_constraint"]=Module["asm"]["M"]).apply(null,arguments)};var _opus_get_vbr_constraint=Module["_opus_get_vbr_constraint"]=function(){return(_opus_get_vbr_constraint=Module["_opus_get_vbr_constraint"]=Module["asm"]["N"]).apply(null,arguments)};var _opus_set_force_channels=Module["_opus_set_force_channels"]=function(){return(_opus_set_force_channels=Module["_opus_set_force_channels"]=Module["asm"]["O"]).apply(null,arguments)};var _opus_get_force_channels=Module["_opus_get_force_channels"]=function(){return(_opus_get_force_channels=Module["_opus_get_force_channels"]=Module["asm"]["P"]).apply(null,arguments)};var _opus_set_max_bandwidth=Module["_opus_set_max_bandwidth"]=function(){return(_opus_set_max_bandwidth=Module["_opus_set_max_bandwidth"]=Module["asm"]["Q"]).apply(null,arguments)};var _opus_get_max_bandwidth=Module["_opus_get_max_bandwidth"]=function(){return(_opus_get_max_bandwidth=Module["_opus_get_max_bandwidth"]=Module["asm"]["R"]).apply(null,arguments)};var _opus_set_bandwidth=Module["_opus_set_bandwidth"]=function(){return(_opus_set_bandwidth=Module["_opus_set_bandwidth"]=Module["asm"]["S"]).apply(null,arguments)};var _opus_set_signal=Module["_opus_set_signal"]=function(){return(_opus_set_signal=Module["_opus_set_signal"]=Module["asm"]["T"]).apply(null,arguments)};var _opus_get_signal=Module["_opus_get_signal"]=function(){return(_opus_get_signal=Module["_opus_get_signal"]=Module["asm"]["U"]).apply(null,arguments)};var _opus_set_application=Module["_opus_set_application"]=function(){return(_opus_set_application=Module["_opus_set_application"]=Module["asm"]["V"]).apply(null,arguments)};var _opus_get_application=Module["_opus_get_application"]=function(){return(_opus_get_application=Module["_opus_get_application"]=Module["asm"]["W"]).apply(null,arguments)};var _opus_get_lookahead=Module["_opus_get_lookahead"]=function(){return(_opus_get_lookahead=Module["_opus_get_lookahead"]=Module["asm"]["X"]).apply(null,arguments)};var _opus_set_inband_fec=Module["_opus_set_inband_fec"]=function(){return(_opus_set_inband_fec=Module["_opus_set_inband_fec"]=Module["asm"]["Y"]).apply(null,arguments)};var _opus_get_inband_fec=Module["_opus_get_inband_fec"]=function(){return(_opus_get_inband_fec=Module["_opus_get_inband_fec"]=Module["asm"]["Z"]).apply(null,arguments)};var _opus_set_packet_loss_perc=Module["_opus_set_packet_loss_perc"]=function(){return(_opus_set_packet_loss_perc=Module["_opus_set_packet_loss_perc"]=Module["asm"]["_"]).apply(null,arguments)};var _opus_get_packet_loss_perc=Module["_opus_get_packet_loss_perc"]=function(){return(_opus_get_packet_loss_perc=Module["_opus_get_packet_loss_perc"]=Module["asm"]["$"]).apply(null,arguments)};var _opus_set_dtx=Module["_opus_set_dtx"]=function(){return(_opus_set_dtx=Module["_opus_set_dtx"]=Module["asm"]["aa"]).apply(null,arguments)};var _opus_get_dtx=Module["_opus_get_dtx"]=function(){return(_opus_get_dtx=Module["_opus_get_dtx"]=Module["asm"]["ba"]).apply(null,arguments)};var _opus_set_lsb_depth=Module["_opus_set_lsb_depth"]=function(){return(_opus_set_lsb_depth=Module["_opus_set_lsb_depth"]=Module["asm"]["ca"]).apply(null,arguments)};var _opus_get_lsb_depth=Module["_opus_get_lsb_depth"]=function(){return(_opus_get_lsb_depth=Module["_opus_get_lsb_depth"]=Module["asm"]["da"]).apply(null,arguments)};var _opus_set_expert_frame_duration=Module["_opus_set_expert_frame_duration"]=function(){return(_opus_set_expert_frame_duration=Module["_opus_set_expert_frame_duration"]=Module["asm"]["ea"]).apply(null,arguments)};var _opus_get_expert_frame_duration=Module["_opus_get_expert_frame_duration"]=function(){return(_opus_get_expert_frame_duration=Module["_opus_get_expert_frame_duration"]=Module["asm"]["fa"]).apply(null,arguments)};var _opus_set_prediction_disabled=Module["_opus_set_prediction_disabled"]=function(){return(_opus_set_prediction_disabled=Module["_opus_set_prediction_disabled"]=Module["asm"]["ga"]).apply(null,arguments)};var _opus_get_prediction_disabled=Module["_opus_get_prediction_disabled"]=function(){return(_opus_get_prediction_disabled=Module["_opus_get_prediction_disabled"]=Module["asm"]["ha"]).apply(null,arguments)};var _opus_get_bandwidth=Module["_opus_get_bandwidth"]=function(){return(_opus_get_bandwidth=Module["_opus_get_bandwidth"]=Module["asm"]["ia"]).apply(null,arguments)};var _opus_get_sample_rate=Module["_opus_get_sample_rate"]=function(){return(_opus_get_sample_rate=Module["_opus_get_sample_rate"]=Module["asm"]["ja"]).apply(null,arguments)};var _opus_set_phase_inversion_disabled=Module["_opus_set_phase_inversion_disabled"]=function(){return(_opus_set_phase_inversion_disabled=Module["_opus_set_phase_inversion_disabled"]=Module["asm"]["ka"]).apply(null,arguments)};var _opus_get_phase_inversion_disabled=Module["_opus_get_phase_inversion_disabled"]=function(){return(_opus_get_phase_inversion_disabled=Module["_opus_get_phase_inversion_disabled"]=Module["asm"]["la"]).apply(null,arguments)};var _opus_get_in_dtx=Module["_opus_get_in_dtx"]=function(){return(_opus_get_in_dtx=Module["_opus_get_in_dtx"]=Module["asm"]["ma"]).apply(null,arguments)};var _opus_set_gain=Module["_opus_set_gain"]=function(){return(_opus_set_gain=Module["_opus_set_gain"]=Module["asm"]["na"]).apply(null,arguments)};var _opus_get_gain=Module["_opus_get_gain"]=function(){return(_opus_get_gain=Module["_opus_get_gain"]=Module["asm"]["oa"]).apply(null,arguments)};var _opus_get_last_packet_duration=Module["_opus_get_last_packet_duration"]=function(){return(_opus_get_last_packet_duration=Module["_opus_get_last_packet_duration"]=Module["asm"]["pa"]).apply(null,arguments)};var _opus_get_pitch=Module["_opus_get_pitch"]=function(){return(_opus_get_pitch=Module["_opus_get_pitch"]=Module["asm"]["qa"]).apply(null,arguments)};var ___errno_location=function(){return(___errno_location=Module["asm"]["__errno_location"]).apply(null,arguments)};var _malloc=Module["_malloc"]=function(){return(_malloc=Module["_malloc"]=Module["asm"]["ra"]).apply(null,arguments)};var _free=Module["_free"]=function(){return(_free=Module["_free"]=Module["asm"]["sa"]).apply(null,arguments)};var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();
65
+ const webAssemblyInstantiatedSource =
66
+ await pendingWebAssemblyInstantiateSource;
9
67
 
68
+ if (!shouldImportMemory) {
69
+ memory = webAssemblyInstantiatedSource.instance.exports.memory;
70
+ }
71
+ if (memory === null) {
72
+ throw new Error('Memory was expected to be imported but is null');
73
+ }
10
74
 
11
- return Module.ready
75
+ return {
76
+ ...webAssemblyInstantiatedSource.instance.exports,
77
+ memory
78
+ };
12
79
  }
13
80
 
14
- );
15
- })();
16
- if (typeof exports === 'object' && typeof module === 'object')
17
- module.exports = Module;
18
- else if (typeof define === 'function' && define['amd'])
19
- define([], function() { return Module; });
20
- else if (typeof exports === 'object')
21
- exports["Module"] = Module;
81
+ export default createModule;
package/native/index.wasm CHANGED
Binary file
@@ -1,41 +1,41 @@
1
1
  export type GeneratedOpusGettersAndSetters = {
2
- _opus_set_complexity(enc: number,value: number): number;
3
- _opus_get_complexity(enc: number,value: number): number;
4
- _opus_set_bitrate(enc: number,value: number): number;
5
- _opus_get_bitrate(enc: number,value: number): number;
6
- _opus_set_vbr(enc: number,value: number): number;
7
- _opus_get_vbr(enc: number,value: number): number;
8
- _opus_set_vbr_constraint(enc: number,value: number): number;
9
- _opus_get_vbr_constraint(enc: number,value: number): number;
10
- _opus_set_force_channels(enc: number,value: number): number;
11
- _opus_get_force_channels(enc: number,value: number): number;
12
- _opus_set_max_bandwidth(enc: number,value: number): number;
13
- _opus_get_max_bandwidth(enc: number,value: number): number;
14
- _opus_set_bandwidth(enc: number,value: number): number;
15
- _opus_set_signal(enc: number,value: number): number;
16
- _opus_get_signal(enc: number,value: number): number;
17
- _opus_set_application(enc: number,value: number): number;
18
- _opus_get_application(enc: number,value: number): number;
19
- _opus_get_lookahead(enc: number,value: number): number;
20
- _opus_set_inband_fec(enc: number,value: number): number;
21
- _opus_get_inband_fec(enc: number,value: number): number;
22
- _opus_set_packet_loss_perc(enc: number,value: number): number;
23
- _opus_get_packet_loss_perc(enc: number,value: number): number;
24
- _opus_set_dtx(enc: number,value: number): number;
25
- _opus_get_dtx(enc: number,value: number): number;
26
- _opus_set_lsb_depth(enc: number,value: number): number;
27
- _opus_get_lsb_depth(enc: number,value: number): number;
28
- _opus_set_expert_frame_duration(enc: number,value: number): number;
29
- _opus_get_expert_frame_duration(enc: number,value: number): number;
30
- _opus_set_prediction_disabled(enc: number,value: number): number;
31
- _opus_get_prediction_disabled(enc: number,value: number): number;
32
- _opus_get_bandwidth(enc: number,value: number): number;
33
- _opus_get_sample_rate(enc: number,value: number): number;
34
- _opus_set_phase_inversion_disabled(enc: number,value: number): number;
35
- _opus_get_phase_inversion_disabled(enc: number,value: number): number;
36
- _opus_get_in_dtx(enc: number,value: number): number;
37
- _opus_set_gain(enc: number,value: number): number;
38
- _opus_get_gain(enc: number,value: number): number;
39
- _opus_get_last_packet_duration(enc: number,value: number): number;
40
- _opus_get_pitch(enc: number,value: number): number;
2
+ opus_set_complexity(enc: number,value: number): number;
3
+ opus_get_complexity(enc: number,value: number): number;
4
+ opus_set_bitrate(enc: number,value: number): number;
5
+ opus_get_bitrate(enc: number,value: number): number;
6
+ opus_set_vbr(enc: number,value: number): number;
7
+ opus_get_vbr(enc: number,value: number): number;
8
+ opus_set_vbr_constraint(enc: number,value: number): number;
9
+ opus_get_vbr_constraint(enc: number,value: number): number;
10
+ opus_set_force_channels(enc: number,value: number): number;
11
+ opus_get_force_channels(enc: number,value: number): number;
12
+ opus_set_max_bandwidth(enc: number,value: number): number;
13
+ opus_get_max_bandwidth(enc: number,value: number): number;
14
+ opus_set_bandwidth(enc: number,value: number): number;
15
+ opus_set_signal(enc: number,value: number): number;
16
+ opus_get_signal(enc: number,value: number): number;
17
+ opus_set_application(enc: number,value: number): number;
18
+ opus_get_application(enc: number,value: number): number;
19
+ opus_get_lookahead(enc: number,value: number): number;
20
+ opus_set_inband_fec(enc: number,value: number): number;
21
+ opus_get_inband_fec(enc: number,value: number): number;
22
+ opus_set_packet_loss_perc(enc: number,value: number): number;
23
+ opus_get_packet_loss_perc(enc: number,value: number): number;
24
+ opus_set_dtx(enc: number,value: number): number;
25
+ opus_get_dtx(enc: number,value: number): number;
26
+ opus_set_lsb_depth(enc: number,value: number): number;
27
+ opus_get_lsb_depth(enc: number,value: number): number;
28
+ opus_set_expert_frame_duration(enc: number,value: number): number;
29
+ opus_get_expert_frame_duration(enc: number,value: number): number;
30
+ opus_set_prediction_disabled(enc: number,value: number): number;
31
+ opus_get_prediction_disabled(enc: number,value: number): number;
32
+ opus_get_bandwidth(enc: number,value: number): number;
33
+ opus_get_sample_rate(enc: number,value: number): number;
34
+ opus_set_phase_inversion_disabled(enc: number,value: number): number;
35
+ opus_get_phase_inversion_disabled(enc: number,value: number): number;
36
+ opus_get_in_dtx(enc: number,value: number): number;
37
+ opus_set_gain(enc: number,value: number): number;
38
+ opus_get_gain(enc: number,value: number): number;
39
+ opus_get_last_packet_duration(enc: number,value: number): number;
40
+ opus_get_pitch(enc: number,value: number): number;
41
41
  };
package/opus/Decoder.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { Runtime } from '../runtime';
1
+ import { Runtime } from '../runtime/index.js';
2
2
  export default class Decoder {
3
3
  #private;
4
4
  constructor(runtime: Runtime, sampleRate: number, channels: number, frameSize: number);
5
5
  decodeFloat(value: Uint8Array, decodeFec?: number): number;
6
- decoded(): Float32Array;
6
+ decoded(): Float32Array<ArrayBuffer>;
7
7
  destroy(): void;
8
+ [Symbol.dispose](): void;
8
9
  }
9
10
  //# sourceMappingURL=Decoder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Decoder.d.ts","sourceRoot":"","sources":["Decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoC,MAAM,YAAY,CAAC;AAEvE,MAAM,CAAC,OAAO,OAAO,OAAO;;gBAQpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;IAyBd,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,SAAI;IAwC5C,OAAO;IAQP,OAAO;CAKjB"}
1
+ {"version":3,"file":"Decoder.d.ts","sourceRoot":"","sources":["Decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoC,MAAM,qBAAqB,CAAC;AAEhF,MAAM,CAAC,OAAO,OAAO,OAAO;;gBASpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM;IAyBd,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,SAAI;IAwC5C,OAAO;IAQP,OAAO;IAKd,CAAC,MAAM,CAAC,OAAO,CAAC;CAGnB"}
package/opus/Decoder.js CHANGED
@@ -1,18 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const runtime_1 = require("../runtime");
4
- class Decoder {
1
+ import { Integer, ResourcesHolder, Buffer } from '../runtime/index.js';
2
+ export default class Decoder {
5
3
  #error;
6
4
  #decoder;
7
5
  #holder;
8
6
  #runtime;
9
7
  #pcm;
10
8
  #frameSize;
9
+ #data = null;
11
10
  constructor(runtime, sampleRate, channels, frameSize) {
12
11
  this.#frameSize = frameSize;
13
12
  this.#runtime = runtime;
14
- this.#holder = new runtime_1.ResourcesHolder();
15
- this.#error = new runtime_1.Integer(runtime);
13
+ this.#holder = new ResourcesHolder();
14
+ this.#error = new Integer(runtime);
16
15
  /**
17
16
  * holder
18
17
  */
@@ -22,17 +21,17 @@ class Decoder {
22
21
  */
23
22
  this.#decoder = runtime
24
23
  .originalRuntime()
25
- ._opus_decoder_create(sampleRate, channels, this.#error.offset());
24
+ .opus_decoder_create(sampleRate, channels, this.#error.offset());
26
25
  if (!this.#decoder || this.#error.value() < 0) {
27
26
  throw new Error('Failed to create decoder');
28
27
  }
29
- this.#pcm = new runtime_1.Buffer(runtime, this.#frameSize * channels * Float32Array.BYTES_PER_ELEMENT);
28
+ this.#pcm = new Buffer(runtime, this.#frameSize * channels * Float32Array.BYTES_PER_ELEMENT);
29
+ this.#holder.add(this.#pcm);
30
30
  }
31
- #data = null;
32
31
  decodeFloat(value, decodeFec = 0) {
33
32
  let data = this.#data;
34
33
  if (!data) {
35
- data = new runtime_1.Buffer(this.#runtime, value.byteLength);
34
+ data = new Buffer(this.#runtime, value.byteLength);
36
35
  }
37
36
  /**
38
37
  * reallocate in case current allocated buffer is smaller than the actual
@@ -40,7 +39,7 @@ class Decoder {
40
39
  */
41
40
  if (data.data().byteLength < value.byteLength) {
42
41
  data.destroy();
43
- data = new runtime_1.Buffer(this.#runtime, value.byteLength);
42
+ data = new Buffer(this.#runtime, value.byteLength);
44
43
  }
45
44
  /**
46
45
  * set data
@@ -56,7 +55,7 @@ class Decoder {
56
55
  */
57
56
  const decodedSamples = this.#runtime
58
57
  .originalRuntime()
59
- ._opus_decode_float(this.#decoder, data.offset(), value.byteLength, this.#pcm.offset(), this.#frameSize, decodeFec);
58
+ .opus_decode_float(this.#decoder, data.offset(), value.byteLength, this.#pcm.offset(), this.#frameSize, decodeFec);
60
59
  if (decodedSamples < 0) {
61
60
  throw new Error('Failed to decode float');
62
61
  }
@@ -67,10 +66,12 @@ class Decoder {
67
66
  return new Float32Array(pcm.buffer, pcm.byteOffset, pcm.byteLength / Float32Array.BYTES_PER_ELEMENT);
68
67
  }
69
68
  destroy() {
70
- this.#runtime.originalRuntime()._opus_decoder_destroy(this.#decoder);
69
+ this.#runtime.originalRuntime().opus_decoder_destroy(this.#decoder);
71
70
  this.#holder.destroy();
72
71
  this.#data?.destroy();
73
72
  }
73
+ [Symbol.dispose]() {
74
+ this.destroy();
75
+ }
74
76
  }
75
- exports.default = Decoder;
76
77
  //# sourceMappingURL=Decoder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Decoder.js","sourceRoot":"","sources":["Decoder.ts"],"names":[],"mappings":";;AAAA,wCAAuE;AAEvE,MAAqB,OAAO;IACf,MAAM,CAAC;IACP,QAAQ,CAAC;IACT,OAAO,CAAC;IACR,QAAQ,CAAC;IACT,IAAI,CAAC;IACL,UAAU,CAAC;IACpB,YACI,OAAgB,EAChB,UAAkB,EAClB,QAAgB,EAChB,SAAiB;QAEjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAO,CAAC,OAAO,CAAC,CAAC;QACnC;;WAEG;QACH,IAAI,CAAC,OAA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AC,KAAK,CAAC,CAAC;QACvB;;;WAGG;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB;;WAEG;QACH,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ;aAC/B,eAAe,EAAE;aACjB,iBAAiB,CACd,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EAAE,EACb,KAAK,CAAC,UAAU,EAChB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAClB,IAAI,CAAC,UAAU,EACf,SAAS,CACZ,CAAC;QACN,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,cAAc,CAAC;IAC1B,CAAC;IACM,OAAO;QACV,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,IAAI,YAAY,CACnB,GAAG,CAAC,MAAM,EACV,GAAG,CAAC,UAAU,EACd,GAAG,CAAC,UAAU,GAAG,YAAY,CAAC,iBAAiB,CAClD,CAAC;IACN,CAAC;IACM,OAAO;QACV,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACvB,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;IAC1B,CAAC;IACD,CAAC,MAAM,CAAC,OAAO,CAAC;QACZ,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;CACJ"}
package/opus/Encoder.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Runtime } from '../runtime';
2
- import { OpusGettersAndSetters } from './OpusGettersAndSetters';
1
+ import { Runtime } from '../runtime/index.js';
2
+ import { OpusGettersAndSetters } from './OpusGettersAndSetters.js';
3
3
  export default class Encoder extends OpusGettersAndSetters {
4
4
  #private;
5
5
  constructor(runtime: Runtime, sampleRate: number, channels: number, application: number,
@@ -11,7 +11,7 @@ export default class Encoder extends OpusGettersAndSetters {
11
11
  * how many bytes will we be receiving through encodeFloat() function
12
12
  */
13
13
  pcmBufferLength: number);
14
- encoded(): Uint8Array;
14
+ encoded(): Uint8Array<ArrayBuffer>;
15
15
  /**
16
16
  *
17
17
  * @param value
@@ -21,5 +21,6 @@ export default class Encoder extends OpusGettersAndSetters {
21
21
  */
22
22
  encodeFloat(value: Float32Array, frameSize: number, maxDataBytes: number): number;
23
23
  destroy(): void;
24
+ [Symbol.dispose](): void;
24
25
  }
25
26
  //# sourceMappingURL=Encoder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Encoder.d.ts","sourceRoot":"","sources":["Encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoC,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,qBAAqB;;gBAQlD,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM;IACnB;;OAEG;IACH,eAAe,EAAE,MAAM;IACvB;;OAEG;IACH,eAAe,EAAE,MAAM;IAyCpB,OAAO;IAGd;;;;;;OAMG;IACI,WAAW,CACd,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;IA8BjB,OAAO;CAIjB"}
1
+ {"version":3,"file":"Encoder.d.ts","sourceRoot":"","sources":["Encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoC,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,qBAAqB;;gBAQlD,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM;IACnB;;OAEG;IACH,eAAe,EAAE,MAAM;IACvB;;OAEG;IACH,eAAe,EAAE,MAAM;IA2CpB,OAAO;IAGd;;;;;;OAMG;IACI,WAAW,CACd,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;IA6BR,OAAO;IAKP,CAAC,MAAM,CAAC,OAAO,CAAC;CAGnC"}
package/opus/Encoder.js CHANGED
@@ -1,8 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const runtime_1 = require("../runtime");
4
- const OpusGettersAndSetters_1 = require("./OpusGettersAndSetters");
5
- class Encoder extends OpusGettersAndSetters_1.OpusGettersAndSetters {
1
+ import { Integer, ResourcesHolder, Buffer } from '../runtime/index.js';
2
+ import { OpusGettersAndSetters } from './OpusGettersAndSetters.js';
3
+ export default class Encoder extends OpusGettersAndSetters {
6
4
  #error;
7
5
  #runtime;
8
6
  #encoder;
@@ -18,22 +16,25 @@ class Encoder extends OpusGettersAndSetters_1.OpusGettersAndSetters {
18
16
  * how many bytes will we be receiving through encodeFloat() function
19
17
  */
20
18
  pcmBufferLength) {
21
- const error = new runtime_1.Integer(runtime);
19
+ if (!outBufferLength) {
20
+ throw new Error('Output buffer length must be more than 0');
21
+ }
22
+ const error = new Integer(runtime);
22
23
  const encoderId = runtime
23
24
  .originalRuntime()
24
- ._opus_encoder_create(sampleRate, channels, application, error.offset());
25
+ .opus_encoder_create(sampleRate, channels, application, error.offset());
25
26
  super(runtime, encoderId);
26
- this.#holder = new runtime_1.ResourcesHolder();
27
+ this.#holder = new ResourcesHolder();
27
28
  this.#error = error;
28
29
  this.#runtime = runtime;
29
30
  /**
30
31
  * pcm buffer
31
32
  */
32
- this.#pcm = new runtime_1.Buffer(runtime, pcmBufferLength);
33
+ this.#pcm = new Buffer(runtime, pcmBufferLength);
33
34
  /**
34
35
  * out buffer
35
36
  */
36
- this.#encoded = new runtime_1.Buffer(runtime, outBufferLength);
37
+ this.#encoded = new Buffer(runtime, outBufferLength);
37
38
  /**
38
39
  * add items to resources holder
39
40
  */
@@ -45,11 +46,9 @@ class Encoder extends OpusGettersAndSetters_1.OpusGettersAndSetters {
45
46
  */
46
47
  this.#encoder = encoderId;
47
48
  if (error.value() < 0) {
49
+ this.destroy();
48
50
  throw new Error('Failed to create encoder');
49
51
  }
50
- if (!outBufferLength) {
51
- throw new Error('outBufferLength must be more than 0');
52
- }
53
52
  }
54
53
  encoded() {
55
54
  return this.#encoded.data();
@@ -70,16 +69,19 @@ class Encoder extends OpusGettersAndSetters_1.OpusGettersAndSetters {
70
69
  .set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
71
70
  const result = this.#runtime
72
71
  .originalRuntime()
73
- ._opus_encode_float(this.#encoder, this.#pcm.offset(), frameSize, this.#encoded.offset(), maxDataBytes);
72
+ .opus_encode_float(this.#encoder, this.#pcm.offset(), frameSize, this.#encoded.offset(), maxDataBytes);
74
73
  if (result < 0) {
75
- throw new Error(`Failed to encode float`);
74
+ throw new Error(`Failed to encode float: ${result}`);
76
75
  }
77
76
  return result;
78
77
  }
79
78
  destroy() {
79
+ super.destroy();
80
80
  this.#holder.destroy();
81
- this.#runtime.originalRuntime()._opus_encoder_destroy(this.#encoder);
81
+ this.#runtime.originalRuntime().opus_encoder_destroy(this.#encoder);
82
+ }
83
+ [Symbol.dispose]() {
84
+ this.destroy();
82
85
  }
83
86
  }
84
- exports.default = Encoder;
85
87
  //# sourceMappingURL=Encoder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Encoder.js","sourceRoot":"","sources":["Encoder.ts"],"names":[],"mappings":";;AAAA,wCAAuE;AACvE,mEAAgE;AAEhE,MAAqB,OAAQ,SAAQ,6CAAqB;IAC7C,MAAM,CAAC;IACP,QAAQ,CAAC;IACT,QAAQ,CAAC;IACT,QAAQ,CAAC;IACT,IAAI,CAAC;IACL,OAAO,CAAC;IACjB,YACI,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J"}
@@ -1,5 +1,5 @@
1
- import { Runtime } from '../runtime';
2
- export declare class OpusGettersAndSetters {
1
+ import { Runtime, type IResource } from '../runtime/index.js';
2
+ export declare class OpusGettersAndSetters implements IResource {
3
3
  #private;
4
4
  constructor(runtime: Runtime, opusEncoderOffset: number);
5
5
  setComplexity(x: number): boolean;
@@ -41,5 +41,7 @@ export declare class OpusGettersAndSetters {
41
41
  getGain(): number;
42
42
  getLastPacketduration(): number;
43
43
  getPitch(): number;
44
+ destroy(): void;
45
+ [Symbol.dispose](): void;
44
46
  }
45
47
  //# sourceMappingURL=OpusGettersAndSetters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OpusGettersAndSetters.d.ts","sourceRoot":"","sources":["OpusGettersAndSetters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,YAAY,CAAC;AAE9C,qBAAa,qBAAqB;;gBAIX,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM;IAKvD,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAIjC,aAAa,IAAI,MAAM;IAKvB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAI9B,UAAU,IAAI,MAAM;IAKpB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAI1B,MAAM,IAAI,MAAM;IAKhB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAIpC,gBAAgB,IAAI,MAAM;IAK1B,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAIpC,gBAAgB,IAAI,MAAM;IAK1B,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAInC,eAAe,IAAI,MAAM;IAKzB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAIhC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAI7B,SAAS,IAAI,MAAM;IAKnB,cAAc,CAAC,CAAC,EAAE,MAAM,GAA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