limiter-audio-worklet 1.1.52 → 1.1.56

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.
@@ -1,2 +1,2 @@
1
- export declare const worklet = "(()=>{\"use strict\";class t{constructor(t){if(this._buffer=t,this._firstIndex=0,this._isEmpty=!0,this._lastIndex=0,0===this._buffer.length)throw new Error(\"The given buffer is too small.\")}get size(){return this._isEmpty?0:this._lastIndex<this._firstIndex?this._buffer.length-this._firstIndex+this._lastIndex+1:this._lastIndex-this._firstIndex+1}first(){return this._throwIfEmpty(),this._buffer[this._firstIndex]}last(){return this._throwIfEmpty(),this._buffer[this._lastIndex]}pop(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._lastIndex=this._decrementIndex(this._lastIndex)}shift(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._firstIndex=this._incrementIndex(this._firstIndex)}unshift(t){if(this._isEmpty)this._buffer[this._firstIndex]=t,this._isEmpty=!1;else{const e=this._decrementIndex(this._firstIndex);if(e===this._lastIndex)throw new Error(\"Deque is full.\");this._buffer[e]=t,this._firstIndex=e}}_decrementIndex(t){return 0===t?this._buffer.length-1:t-1}_incrementIndex(t){return(t+1)%this._buffer.length}_throwIfEmpty(){if(this._isEmpty)throw new Error(\"Deque is empty.\")}}const e=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,e.length)),r===t.length?0:r;const n=r-t.length,i=t.length-s;return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,i)),e.set(new Float32Array(t.buffer,t.byteOffset,n),i),n},s=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return t.set(e,s),r===t.length?0:r;const n=r-t.length,i=t.length-s;return t.set(new Float32Array(e.buffer,e.byteOffset,i),s),t.set(new Float32Array(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,n)),n},r=Math.exp(-1/(.5*sampleRate)),n=(t,e,s,n)=>{let i=t[127];for(let h=0;h<128;h+=1){const f=(s+h)%e.length,o=Math.abs(e[f]);let l,u;if(null!==n){for(;n.size>0&&o>=Math.abs(e[n.first()]);)n.shift();(0===n.size||o<Math.abs(e[n.first()]))&&n.unshift(f);const t=(s+h+128)%e.length;n.last()===t&&n.pop();const r=n.last();l=Math.abs(e[r]),u=r<f?f-r+1:f+e.length-r+1}else l=o,u=1;const a=i-l;i<l?i-=a/u:i=l+r*a,t[h]=i}};class i extends AudioWorkletProcessor{constructor({channelCount:e,channelCountMode:s,numberOfInputs:r,numberOfOutputs:n,outputChannelCount:i,processorOptions:h}){const f=\"object\"==typeof h&&null!==h&&\"attack\"in h?h.attack:0;if(\"number\"!=typeof f)throw new Error('The attack needs to be of type \"number\".');if(f<0)throw new Error(\"The attack can't be negative.\");if(\"explicit\"!==s)throw new Error('The channelCountMode needs to be \"explicit\".');if(1!==r)throw new Error(\"The numberOfInputs must be 1.\");if(1!==n)throw new Error(\"The numberOfOutputs must be 1.\");if(void 0===i||e!==i[0])throw new Error(\"The channelCount must be the same as the outputChannelCount of the first output.\");super();const o=sampleRate*f,l=Math.round(o),u=l+128;this._constantMemoryDeques=0===l?null:Array.from({length:e},(()=>new t(new Uint16Array(l+1)))),this._delayBuffers=Array.from({length:e},(()=>new Float32Array(u))),this._envelopeBuffers=Array.from({length:e},(()=>new Float32Array(128))),this._writeOffset=0}process([t],[r]){const i=t.length,h=this._writeOffset;for(let f=0;f<i;f+=1){const i=null===this._constantMemoryDeques?null:this._constantMemoryDeques[f],o=this._delayBuffers[f],l=this._envelopeBuffers[f],u=t[f],a=r[f];this._writeOffset=s(o,u,h),n(l,o,h,i),e(o,a,this._writeOffset);for(let t=0;t<128;t+=1){const e=Math.min(1,.7943282347242815/l[t]);a[t]*=e}}return!0}}i.parameterDescriptors=[],registerProcessor(\"limiter-audio-worklet-processor\",i)})();";
1
+ export declare const worklet = "(()=>{\"use strict\";class t{constructor(t){if(this._buffer=t,this._firstIndex=0,this._isEmpty=!0,this._lastIndex=0,0===this._buffer.length)throw new Error(\"The given buffer is too small.\")}get size(){return this._isEmpty?0:this._lastIndex<this._firstIndex?this._buffer.length-this._firstIndex+this._lastIndex+1:this._lastIndex-this._firstIndex+1}first(){return this._throwIfEmpty(),this._buffer[this._firstIndex]}last(){return this._throwIfEmpty(),this._buffer[this._lastIndex]}pop(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._lastIndex=this._decrementIndex(this._lastIndex)}shift(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._firstIndex=this._incrementIndex(this._firstIndex)}unshift(t){if(this._isEmpty)this._buffer[this._firstIndex]=t,this._isEmpty=!1;else{const e=this._decrementIndex(this._firstIndex);if(e===this._lastIndex)throw new Error(\"Deque is full.\");this._buffer[e]=t,this._firstIndex=e}}_decrementIndex(t){return 0===t?this._buffer.length-1:t-1}_incrementIndex(t){return(t+1)%this._buffer.length}_throwIfEmpty(){if(this._isEmpty)throw new Error(\"Deque is empty.\")}}const e=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,e.length)),r===t.length?0:r;const n=r-t.length,i=t.length-s;return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,i)),e.set(new Float32Array(t.buffer,t.byteOffset,n),i),n},s=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return t.set(e,s),r===t.length?0:r;const n=r-t.length,i=t.length-s;return t.set(new Float32Array(e.buffer,e.byteOffset,i),s),t.set(new Float32Array(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,n)),n},r=Math.exp(-1/(.5*sampleRate)),n=(t,e,s,n)=>{let i=t[127];for(let h=0;h<128;h+=1){const f=(s+h)%e.length,o=Math.abs(e[f]);let l,u;if(null!==n){for(;n.size>0&&o>=Math.abs(e[n.first()]);)n.shift();(0===n.size||o<Math.abs(e[n.first()]))&&n.unshift(f);const t=(s+h+128)%e.length;n.last()===t&&n.pop();const r=n.last();l=Math.abs(e[r]),u=r<f?f-r+1:f+e.length-r+1}else l=o,u=1;const a=i-l;i<l?i-=a/u:i=l+r*a,t[h]=i}};class i extends AudioWorkletProcessor{constructor(e){let{channelCount:s,channelCountMode:r,numberOfInputs:n,numberOfOutputs:i,outputChannelCount:h,processorOptions:f}=e;const o=\"object\"==typeof f&&null!==f&&\"attack\"in f?f.attack:0;if(\"number\"!=typeof o)throw new Error('The attack needs to be of type \"number\".');if(o<0)throw new Error(\"The attack can't be negative.\");if(\"explicit\"!==r)throw new Error('The channelCountMode needs to be \"explicit\".');if(1!==n)throw new Error(\"The numberOfInputs must be 1.\");if(1!==i)throw new Error(\"The numberOfOutputs must be 1.\");if(void 0===h||s!==h[0])throw new Error(\"The channelCount must be the same as the outputChannelCount of the first output.\");super();const l=sampleRate*o,u=Math.round(l),a=u+128;this._constantMemoryDeques=0===u?null:Array.from({length:s},(()=>new t(new Uint16Array(u+1)))),this._delayBuffers=Array.from({length:s},(()=>new Float32Array(a))),this._envelopeBuffers=Array.from({length:s},(()=>new Float32Array(128))),this._writeOffset=0}process(t,r){let[i]=t,[h]=r;const f=i.length,o=this._writeOffset;for(let t=0;t<f;t+=1){const r=null===this._constantMemoryDeques?null:this._constantMemoryDeques[t],f=this._delayBuffers[t],l=this._envelopeBuffers[t],u=i[t],a=h[t];this._writeOffset=s(f,u,o),n(l,f,o,r),e(f,a,this._writeOffset);for(let t=0;t<128;t+=1){const e=Math.min(1,.7943282347242815/l[t]);a[t]*=e}}return!0}}i.parameterDescriptors=[],registerProcessor(\"limiter-audio-worklet-processor\",i)})();";
2
2
  //# sourceMappingURL=worklet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worklet.d.ts","sourceRoot":"","sources":["../../../src/worklet/worklet.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,qhHAAu/G,CAAC"}
1
+ {"version":3,"file":"worklet.d.ts","sourceRoot":"","sources":["../../../src/worklet/worklet.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,uiHAAygH,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // This is the minified and stringified code of the limiter-audio-worklet-processor package.
2
- export const worklet = `(()=>{"use strict";class t{constructor(t){if(this._buffer=t,this._firstIndex=0,this._isEmpty=!0,this._lastIndex=0,0===this._buffer.length)throw new Error("The given buffer is too small.")}get size(){return this._isEmpty?0:this._lastIndex<this._firstIndex?this._buffer.length-this._firstIndex+this._lastIndex+1:this._lastIndex-this._firstIndex+1}first(){return this._throwIfEmpty(),this._buffer[this._firstIndex]}last(){return this._throwIfEmpty(),this._buffer[this._lastIndex]}pop(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._lastIndex=this._decrementIndex(this._lastIndex)}shift(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._firstIndex=this._incrementIndex(this._firstIndex)}unshift(t){if(this._isEmpty)this._buffer[this._firstIndex]=t,this._isEmpty=!1;else{const e=this._decrementIndex(this._firstIndex);if(e===this._lastIndex)throw new Error("Deque is full.");this._buffer[e]=t,this._firstIndex=e}}_decrementIndex(t){return 0===t?this._buffer.length-1:t-1}_incrementIndex(t){return(t+1)%this._buffer.length}_throwIfEmpty(){if(this._isEmpty)throw new Error("Deque is empty.")}}const e=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,e.length)),r===t.length?0:r;const n=r-t.length,i=t.length-s;return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,i)),e.set(new Float32Array(t.buffer,t.byteOffset,n),i),n},s=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return t.set(e,s),r===t.length?0:r;const n=r-t.length,i=t.length-s;return t.set(new Float32Array(e.buffer,e.byteOffset,i),s),t.set(new Float32Array(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,n)),n},r=Math.exp(-1/(.5*sampleRate)),n=(t,e,s,n)=>{let i=t[127];for(let h=0;h<128;h+=1){const f=(s+h)%e.length,o=Math.abs(e[f]);let l,u;if(null!==n){for(;n.size>0&&o>=Math.abs(e[n.first()]);)n.shift();(0===n.size||o<Math.abs(e[n.first()]))&&n.unshift(f);const t=(s+h+128)%e.length;n.last()===t&&n.pop();const r=n.last();l=Math.abs(e[r]),u=r<f?f-r+1:f+e.length-r+1}else l=o,u=1;const a=i-l;i<l?i-=a/u:i=l+r*a,t[h]=i}};class i extends AudioWorkletProcessor{constructor({channelCount:e,channelCountMode:s,numberOfInputs:r,numberOfOutputs:n,outputChannelCount:i,processorOptions:h}){const f="object"==typeof h&&null!==h&&"attack"in h?h.attack:0;if("number"!=typeof f)throw new Error('The attack needs to be of type "number".');if(f<0)throw new Error("The attack can't be negative.");if("explicit"!==s)throw new Error('The channelCountMode needs to be "explicit".');if(1!==r)throw new Error("The numberOfInputs must be 1.");if(1!==n)throw new Error("The numberOfOutputs must be 1.");if(void 0===i||e!==i[0])throw new Error("The channelCount must be the same as the outputChannelCount of the first output.");super();const o=sampleRate*f,l=Math.round(o),u=l+128;this._constantMemoryDeques=0===l?null:Array.from({length:e},(()=>new t(new Uint16Array(l+1)))),this._delayBuffers=Array.from({length:e},(()=>new Float32Array(u))),this._envelopeBuffers=Array.from({length:e},(()=>new Float32Array(128))),this._writeOffset=0}process([t],[r]){const i=t.length,h=this._writeOffset;for(let f=0;f<i;f+=1){const i=null===this._constantMemoryDeques?null:this._constantMemoryDeques[f],o=this._delayBuffers[f],l=this._envelopeBuffers[f],u=t[f],a=r[f];this._writeOffset=s(o,u,h),n(l,o,h,i),e(o,a,this._writeOffset);for(let t=0;t<128;t+=1){const e=Math.min(1,.7943282347242815/l[t]);a[t]*=e}}return!0}}i.parameterDescriptors=[],registerProcessor("limiter-audio-worklet-processor",i)})();`; // tslint:disable-line:max-line-length
2
+ export const worklet = `(()=>{"use strict";class t{constructor(t){if(this._buffer=t,this._firstIndex=0,this._isEmpty=!0,this._lastIndex=0,0===this._buffer.length)throw new Error("The given buffer is too small.")}get size(){return this._isEmpty?0:this._lastIndex<this._firstIndex?this._buffer.length-this._firstIndex+this._lastIndex+1:this._lastIndex-this._firstIndex+1}first(){return this._throwIfEmpty(),this._buffer[this._firstIndex]}last(){return this._throwIfEmpty(),this._buffer[this._lastIndex]}pop(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._lastIndex=this._decrementIndex(this._lastIndex)}shift(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._firstIndex=this._incrementIndex(this._firstIndex)}unshift(t){if(this._isEmpty)this._buffer[this._firstIndex]=t,this._isEmpty=!1;else{const e=this._decrementIndex(this._firstIndex);if(e===this._lastIndex)throw new Error("Deque is full.");this._buffer[e]=t,this._firstIndex=e}}_decrementIndex(t){return 0===t?this._buffer.length-1:t-1}_incrementIndex(t){return(t+1)%this._buffer.length}_throwIfEmpty(){if(this._isEmpty)throw new Error("Deque is empty.")}}const e=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,e.length)),r===t.length?0:r;const n=r-t.length,i=t.length-s;return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,i)),e.set(new Float32Array(t.buffer,t.byteOffset,n),i),n},s=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return t.set(e,s),r===t.length?0:r;const n=r-t.length,i=t.length-s;return t.set(new Float32Array(e.buffer,e.byteOffset,i),s),t.set(new Float32Array(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,n)),n},r=Math.exp(-1/(.5*sampleRate)),n=(t,e,s,n)=>{let i=t[127];for(let h=0;h<128;h+=1){const f=(s+h)%e.length,o=Math.abs(e[f]);let l,u;if(null!==n){for(;n.size>0&&o>=Math.abs(e[n.first()]);)n.shift();(0===n.size||o<Math.abs(e[n.first()]))&&n.unshift(f);const t=(s+h+128)%e.length;n.last()===t&&n.pop();const r=n.last();l=Math.abs(e[r]),u=r<f?f-r+1:f+e.length-r+1}else l=o,u=1;const a=i-l;i<l?i-=a/u:i=l+r*a,t[h]=i}};class i extends AudioWorkletProcessor{constructor(e){let{channelCount:s,channelCountMode:r,numberOfInputs:n,numberOfOutputs:i,outputChannelCount:h,processorOptions:f}=e;const o="object"==typeof f&&null!==f&&"attack"in f?f.attack:0;if("number"!=typeof o)throw new Error('The attack needs to be of type "number".');if(o<0)throw new Error("The attack can't be negative.");if("explicit"!==r)throw new Error('The channelCountMode needs to be "explicit".');if(1!==n)throw new Error("The numberOfInputs must be 1.");if(1!==i)throw new Error("The numberOfOutputs must be 1.");if(void 0===h||s!==h[0])throw new Error("The channelCount must be the same as the outputChannelCount of the first output.");super();const l=sampleRate*o,u=Math.round(l),a=u+128;this._constantMemoryDeques=0===u?null:Array.from({length:s},(()=>new t(new Uint16Array(u+1)))),this._delayBuffers=Array.from({length:s},(()=>new Float32Array(a))),this._envelopeBuffers=Array.from({length:s},(()=>new Float32Array(128))),this._writeOffset=0}process(t,r){let[i]=t,[h]=r;const f=i.length,o=this._writeOffset;for(let t=0;t<f;t+=1){const r=null===this._constantMemoryDeques?null:this._constantMemoryDeques[t],f=this._delayBuffers[t],l=this._envelopeBuffers[t],u=i[t],a=h[t];this._writeOffset=s(f,u,o),n(l,f,o,r),e(f,a,this._writeOffset);for(let t=0;t<128;t+=1){const e=Math.min(1,.7943282347242815/l[t]);a[t]*=e}}return!0}}i.parameterDescriptors=[],registerProcessor("limiter-audio-worklet-processor",i)})();`; // tslint:disable-line:max-line-length
3
3
  //# sourceMappingURL=worklet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worklet.js","sourceRoot":"","sources":["../../../src/worklet/worklet.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,CAAC,MAAM,OAAO,GAAG,o/GAAo/G,CAAC,CAAC,sCAAsC"}
1
+ {"version":3,"file":"worklet.js","sourceRoot":"","sources":["../../../src/worklet/worklet.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,MAAM,CAAC,MAAM,OAAO,GAAG,sgHAAsgH,CAAC,CAAC,sCAAsC"}
package/package.json CHANGED
@@ -9,57 +9,57 @@
9
9
  }
10
10
  },
11
11
  "dependencies": {
12
- "@babel/runtime": "^7.15.4",
13
- "limiter-audio-worklet-processor": "^1.1.32",
14
- "standardized-audio-context": "^25.3.11",
12
+ "@babel/runtime": "^7.16.3",
13
+ "limiter-audio-worklet-processor": "^1.1.34",
14
+ "standardized-audio-context": "^25.3.16",
15
15
  "tslib": "^2.3.1"
16
16
  },
17
17
  "description": "This module provides a loader for the LimiterAudioWorkletProcessor and the corresponding LimiterAudioWorkletNode.",
18
18
  "devDependencies": {
19
- "@babel/core": "^7.15.5",
20
- "@babel/plugin-external-helpers": "^7.14.5",
21
- "@babel/plugin-transform-runtime": "^7.15.0",
22
- "@babel/preset-env": "^7.15.6",
23
- "@commitlint/cli": "^13.1.0",
24
- "@commitlint/config-angular": "^13.1.0",
19
+ "@babel/core": "^7.16.0",
20
+ "@babel/plugin-external-helpers": "^7.16.0",
21
+ "@babel/plugin-transform-runtime": "^7.16.4",
22
+ "@babel/preset-env": "^7.16.4",
23
+ "@commitlint/cli": "^15.0.0",
24
+ "@commitlint/config-angular": "^15.0.0",
25
25
  "@rollup/plugin-babel": "^5.3.0",
26
26
  "@rollup/plugin-replace": "^3.0.0",
27
- "babel-loader": "^8.2.2",
27
+ "babel-loader": "^8.2.3",
28
28
  "chai": "^4.3.4",
29
29
  "commitizen": "^4.2.4",
30
30
  "cz-conventional-changelog": "^3.3.0",
31
31
  "eslint": "^7.32.0",
32
- "eslint-config-holy-grail": "^50.1.9",
32
+ "eslint-config-holy-grail": "^50.1.20",
33
33
  "grunt": "^1.4.1",
34
34
  "grunt-cli": "^1.4.3",
35
35
  "grunt-contrib-clean": "^2.0.0",
36
36
  "grunt-replace": "^2.0.2",
37
37
  "grunt-sh": "^0.2.0",
38
- "grunt-webpack": "^4.0.3",
39
- "husky": "^7.0.2",
40
- "karma": "^6.3.4",
38
+ "grunt-webpack": "^5.0.0",
39
+ "husky": "^7.0.4",
40
+ "karma": "^6.3.9",
41
41
  "karma-chrome-launcher": "^3.1.0",
42
- "karma-firefox-launcher": "^2.1.1",
42
+ "karma-firefox-launcher": "^2.1.2",
43
43
  "karma-mocha": "^2.0.1",
44
44
  "karma-safari-launcher": "^1.0.0",
45
45
  "karma-sauce-launcher": "^4.3.6",
46
46
  "karma-sinon-chai": "^2.0.2",
47
47
  "karma-webpack": "^5.0.0",
48
48
  "load-grunt-config": "^4.0.1",
49
- "memfs": "^3.3.0",
50
- "mocha": "^9.1.1",
51
- "prettier": "^2.4.1",
52
- "pretty-quick": "^3.1.1",
53
- "rollup": "^2.57.0",
49
+ "memfs": "^3.4.0",
50
+ "mocha": "^9.1.3",
51
+ "prettier": "^2.5.0",
52
+ "pretty-quick": "^3.1.2",
53
+ "rollup": "^2.60.2",
54
54
  "sinon": "^11.1.2",
55
55
  "sinon-chai": "^3.7.0",
56
- "terser-webpack-plugin": "^5.2.4",
56
+ "terser-webpack-plugin": "^5.2.5",
57
57
  "ts-loader": "^9.2.6",
58
- "tsconfig-holy-grail": "^11.1.13",
58
+ "tsconfig-holy-grail": "^11.1.19",
59
59
  "tslint": "^6.1.3",
60
60
  "tslint-config-holy-grail": "^53.2.25",
61
- "typescript": "^4.4.3",
62
- "webpack": "^5.53.0"
61
+ "typescript": "^4.5.2",
62
+ "webpack": "^5.64.4"
63
63
  },
64
64
  "files": [
65
65
  "build/es2019/",
@@ -81,5 +81,5 @@
81
81
  "test": "grunt lint && grunt test"
82
82
  },
83
83
  "types": "build/es2019/module.d.ts",
84
- "version": "1.1.52"
84
+ "version": "1.1.56"
85
85
  }
@@ -1,2 +1,2 @@
1
1
  // This is the minified and stringified code of the limiter-audio-worklet-processor package.
2
- export const worklet = `(()=>{"use strict";class t{constructor(t){if(this._buffer=t,this._firstIndex=0,this._isEmpty=!0,this._lastIndex=0,0===this._buffer.length)throw new Error("The given buffer is too small.")}get size(){return this._isEmpty?0:this._lastIndex<this._firstIndex?this._buffer.length-this._firstIndex+this._lastIndex+1:this._lastIndex-this._firstIndex+1}first(){return this._throwIfEmpty(),this._buffer[this._firstIndex]}last(){return this._throwIfEmpty(),this._buffer[this._lastIndex]}pop(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._lastIndex=this._decrementIndex(this._lastIndex)}shift(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._firstIndex=this._incrementIndex(this._firstIndex)}unshift(t){if(this._isEmpty)this._buffer[this._firstIndex]=t,this._isEmpty=!1;else{const e=this._decrementIndex(this._firstIndex);if(e===this._lastIndex)throw new Error("Deque is full.");this._buffer[e]=t,this._firstIndex=e}}_decrementIndex(t){return 0===t?this._buffer.length-1:t-1}_incrementIndex(t){return(t+1)%this._buffer.length}_throwIfEmpty(){if(this._isEmpty)throw new Error("Deque is empty.")}}const e=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,e.length)),r===t.length?0:r;const n=r-t.length,i=t.length-s;return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,i)),e.set(new Float32Array(t.buffer,t.byteOffset,n),i),n},s=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return t.set(e,s),r===t.length?0:r;const n=r-t.length,i=t.length-s;return t.set(new Float32Array(e.buffer,e.byteOffset,i),s),t.set(new Float32Array(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,n)),n},r=Math.exp(-1/(.5*sampleRate)),n=(t,e,s,n)=>{let i=t[127];for(let h=0;h<128;h+=1){const f=(s+h)%e.length,o=Math.abs(e[f]);let l,u;if(null!==n){for(;n.size>0&&o>=Math.abs(e[n.first()]);)n.shift();(0===n.size||o<Math.abs(e[n.first()]))&&n.unshift(f);const t=(s+h+128)%e.length;n.last()===t&&n.pop();const r=n.last();l=Math.abs(e[r]),u=r<f?f-r+1:f+e.length-r+1}else l=o,u=1;const a=i-l;i<l?i-=a/u:i=l+r*a,t[h]=i}};class i extends AudioWorkletProcessor{constructor({channelCount:e,channelCountMode:s,numberOfInputs:r,numberOfOutputs:n,outputChannelCount:i,processorOptions:h}){const f="object"==typeof h&&null!==h&&"attack"in h?h.attack:0;if("number"!=typeof f)throw new Error('The attack needs to be of type "number".');if(f<0)throw new Error("The attack can't be negative.");if("explicit"!==s)throw new Error('The channelCountMode needs to be "explicit".');if(1!==r)throw new Error("The numberOfInputs must be 1.");if(1!==n)throw new Error("The numberOfOutputs must be 1.");if(void 0===i||e!==i[0])throw new Error("The channelCount must be the same as the outputChannelCount of the first output.");super();const o=sampleRate*f,l=Math.round(o),u=l+128;this._constantMemoryDeques=0===l?null:Array.from({length:e},(()=>new t(new Uint16Array(l+1)))),this._delayBuffers=Array.from({length:e},(()=>new Float32Array(u))),this._envelopeBuffers=Array.from({length:e},(()=>new Float32Array(128))),this._writeOffset=0}process([t],[r]){const i=t.length,h=this._writeOffset;for(let f=0;f<i;f+=1){const i=null===this._constantMemoryDeques?null:this._constantMemoryDeques[f],o=this._delayBuffers[f],l=this._envelopeBuffers[f],u=t[f],a=r[f];this._writeOffset=s(o,u,h),n(l,o,h,i),e(o,a,this._writeOffset);for(let t=0;t<128;t+=1){const e=Math.min(1,.7943282347242815/l[t]);a[t]*=e}}return!0}}i.parameterDescriptors=[],registerProcessor("limiter-audio-worklet-processor",i)})();`; // tslint:disable-line:max-line-length
2
+ export const worklet = `(()=>{"use strict";class t{constructor(t){if(this._buffer=t,this._firstIndex=0,this._isEmpty=!0,this._lastIndex=0,0===this._buffer.length)throw new Error("The given buffer is too small.")}get size(){return this._isEmpty?0:this._lastIndex<this._firstIndex?this._buffer.length-this._firstIndex+this._lastIndex+1:this._lastIndex-this._firstIndex+1}first(){return this._throwIfEmpty(),this._buffer[this._firstIndex]}last(){return this._throwIfEmpty(),this._buffer[this._lastIndex]}pop(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._lastIndex=this._decrementIndex(this._lastIndex)}shift(){this._throwIfEmpty(),this._firstIndex===this._lastIndex?this._isEmpty=!0:this._firstIndex=this._incrementIndex(this._firstIndex)}unshift(t){if(this._isEmpty)this._buffer[this._firstIndex]=t,this._isEmpty=!1;else{const e=this._decrementIndex(this._firstIndex);if(e===this._lastIndex)throw new Error("Deque is full.");this._buffer[e]=t,this._firstIndex=e}}_decrementIndex(t){return 0===t?this._buffer.length-1:t-1}_incrementIndex(t){return(t+1)%this._buffer.length}_throwIfEmpty(){if(this._isEmpty)throw new Error("Deque is empty.")}}const e=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,e.length)),r===t.length?0:r;const n=r-t.length,i=t.length-s;return e.set(new Float32Array(t.buffer,t.byteOffset+s*e.BYTES_PER_ELEMENT,i)),e.set(new Float32Array(t.buffer,t.byteOffset,n),i),n},s=(t,e,s)=>{const r=s+e.length;if(r<=t.length)return t.set(e,s),r===t.length?0:r;const n=r-t.length,i=t.length-s;return t.set(new Float32Array(e.buffer,e.byteOffset,i),s),t.set(new Float32Array(e.buffer,e.byteOffset+i*e.BYTES_PER_ELEMENT,n)),n},r=Math.exp(-1/(.5*sampleRate)),n=(t,e,s,n)=>{let i=t[127];for(let h=0;h<128;h+=1){const f=(s+h)%e.length,o=Math.abs(e[f]);let l,u;if(null!==n){for(;n.size>0&&o>=Math.abs(e[n.first()]);)n.shift();(0===n.size||o<Math.abs(e[n.first()]))&&n.unshift(f);const t=(s+h+128)%e.length;n.last()===t&&n.pop();const r=n.last();l=Math.abs(e[r]),u=r<f?f-r+1:f+e.length-r+1}else l=o,u=1;const a=i-l;i<l?i-=a/u:i=l+r*a,t[h]=i}};class i extends AudioWorkletProcessor{constructor(e){let{channelCount:s,channelCountMode:r,numberOfInputs:n,numberOfOutputs:i,outputChannelCount:h,processorOptions:f}=e;const o="object"==typeof f&&null!==f&&"attack"in f?f.attack:0;if("number"!=typeof o)throw new Error('The attack needs to be of type "number".');if(o<0)throw new Error("The attack can't be negative.");if("explicit"!==r)throw new Error('The channelCountMode needs to be "explicit".');if(1!==n)throw new Error("The numberOfInputs must be 1.");if(1!==i)throw new Error("The numberOfOutputs must be 1.");if(void 0===h||s!==h[0])throw new Error("The channelCount must be the same as the outputChannelCount of the first output.");super();const l=sampleRate*o,u=Math.round(l),a=u+128;this._constantMemoryDeques=0===u?null:Array.from({length:s},(()=>new t(new Uint16Array(u+1)))),this._delayBuffers=Array.from({length:s},(()=>new Float32Array(a))),this._envelopeBuffers=Array.from({length:s},(()=>new Float32Array(128))),this._writeOffset=0}process(t,r){let[i]=t,[h]=r;const f=i.length,o=this._writeOffset;for(let t=0;t<f;t+=1){const r=null===this._constantMemoryDeques?null:this._constantMemoryDeques[t],f=this._delayBuffers[t],l=this._envelopeBuffers[t],u=i[t],a=h[t];this._writeOffset=s(f,u,o),n(l,f,o,r),e(f,a,this._writeOffset);for(let t=0;t<128;t+=1){const e=Math.min(1,.7943282347242815/l[t]);a[t]*=e}}return!0}}i.parameterDescriptors=[],registerProcessor("limiter-audio-worklet-processor",i)})();`; // tslint:disable-line:max-line-length