playout-audio-worklet 1.0.0 → 1.0.1
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/build/es2019/module.d.ts +1 -1
- package/build/es2019/module.d.ts.map +1 -1
- package/build/es2019/module.js +7 -5
- package/build/es2019/module.js.map +1 -1
- package/build/es2019/types/any-audio-worklet-node-options.d.ts +3 -0
- package/build/es2019/types/any-audio-worklet-node-options.d.ts.map +1 -0
- package/build/es2019/types/any-audio-worklet-node-options.js +2 -0
- package/build/es2019/types/any-audio-worklet-node-options.js.map +1 -0
- package/build/es2019/types/fixed-options.d.ts +1 -1
- package/build/es2019/types/fixed-options.d.ts.map +1 -1
- package/build/es2019/types/index.d.ts +2 -0
- package/build/es2019/types/index.d.ts.map +1 -1
- package/build/es2019/types/index.js +2 -0
- package/build/es2019/types/index.js.map +1 -1
- package/build/es2019/types/native-playout-audio-worklet-node-options.d.ts +1 -1
- package/build/es2019/types/native-playout-audio-worklet-node-options.d.ts.map +1 -1
- package/build/es2019/types/playout-audio-worklet-node-options.d.ts +1 -1
- package/build/es2019/types/playout-audio-worklet-node-options.d.ts.map +1 -1
- package/build/es5/bundle.js +17 -15
- package/package.json +1 -1
- package/src/module.ts +17 -7
- package/src/types/any-audio-worklet-node-options.ts +5 -0
- package/src/types/fixed-options.ts +1 -1
- package/src/types/index.ts +2 -0
- package/src/types/native-playout-audio-worklet-node-options.ts +1 -1
- package/src/types/playout-audio-worklet-node-options.ts +1 -1
package/build/es2019/module.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ import { TAnyPlayoutAudioWorkletNodeOptions, TNativePlayoutAudioWorkletNode } fr
|
|
|
4
4
|
export * from './interfaces/index';
|
|
5
5
|
export * from './types/index';
|
|
6
6
|
export declare const addPlayoutAudioWorkletModule: (addAudioWorkletModule: (url: string) => Promise<void>) => Promise<void>;
|
|
7
|
-
export declare function createPlayoutAudioWorkletNode<T extends TContext | TNativeContext>(audioWorkletNodeConstructor: T extends TContext ? TAudioWorkletNodeConstructor : TNativeAudioWorkletNodeConstructor, context: T, options
|
|
7
|
+
export declare function createPlayoutAudioWorkletNode<T extends TContext | TNativeContext>(audioWorkletNodeConstructor: T extends TContext ? TAudioWorkletNodeConstructor : TNativeAudioWorkletNodeConstructor, context: T, { numberOfChannels, readPointerView, startView, stopView, storageView, writePointerView, ...options }: TAnyPlayoutAudioWorkletNodeOptions<T>): T extends TContext ? IPlayoutAudioWorkletNode<T> : TNativePlayoutAudioWorkletNode;
|
|
8
8
|
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,4BAA4B,EAC5B,QAAQ,EAER,kCAAkC,EAClC,cAAc,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,4BAA4B,EAC5B,QAAQ,EAER,kCAAkC,EAClC,cAAc,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAA+B,kCAAkC,EAAiB,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAOzI,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAI9B,eAAO,MAAM,4BAA4B,GAAU,uBAAuB,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,kBAQvG,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,QAAQ,GAAG,cAAc,EAC7E,2BAA2B,EAAE,CAAC,SAAS,QAAQ,GAAG,4BAA4B,GAAG,kCAAkC,EACnH,OAAO,EAAE,CAAC,EACV,EACI,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,GAAG,OAAO,EACb,EAAE,kCAAkC,CAAC,CAAC,CAAC,GACzC,CAAC,SAAS,QAAQ,GAAG,wBAAwB,CAAC,CAAC,CAAC,GAAG,8BAA8B,CAsCnF"}
|
package/build/es2019/module.js
CHANGED
|
@@ -15,20 +15,22 @@ export const addPlayoutAudioWorkletModule = async (addAudioWorkletModule) => {
|
|
|
15
15
|
URL.revokeObjectURL(url);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
export function createPlayoutAudioWorkletNode(audioWorkletNodeConstructor, context, options
|
|
19
|
-
const
|
|
20
|
-
const audioWorkletNode = new audioWorkletNodeConstructor(context, 'playout-audio-worklet-processor', {
|
|
21
|
-
...options,
|
|
18
|
+
export function createPlayoutAudioWorkletNode(audioWorkletNodeConstructor, context, { numberOfChannels, readPointerView, startView, stopView, storageView, writePointerView, ...options }) {
|
|
19
|
+
const fixedOptions = {
|
|
22
20
|
numberOfInputs: 0,
|
|
23
21
|
numberOfOutputs: 1,
|
|
24
22
|
outputChannelCount: [numberOfChannels],
|
|
25
|
-
|
|
23
|
+
processorOptions: {
|
|
26
24
|
readPointerView,
|
|
27
25
|
startView,
|
|
28
26
|
stopView,
|
|
29
27
|
storageView,
|
|
30
28
|
writePointerView
|
|
31
29
|
}
|
|
30
|
+
};
|
|
31
|
+
const audioWorkletNode = new audioWorkletNodeConstructor(context, 'playout-audio-worklet-processor', {
|
|
32
|
+
...options,
|
|
33
|
+
...fixedOptions
|
|
32
34
|
});
|
|
33
35
|
const listener = () => {
|
|
34
36
|
audioWorkletNode.port.removeEventListener('message', listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAE9B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,uCAAuC,EAAE,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAAE,qBAAqD,EAAE,EAAE;IACxG,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtC,IAAI,CAAC;QACD,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;YAAS,CAAC;QACP,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,6BAA6B,CACzC,2BAAmH,EACnH,OAAU,EACV,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAE9B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,uCAAuC,EAAE,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAAE,qBAAqD,EAAE,EAAE;IACxG,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAEtC,IAAI,CAAC;QACD,MAAM,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;YAAS,CAAC;QACP,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,6BAA6B,CACzC,2BAAmH,EACnH,OAAU,EACV,EACI,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,GAAG,OAAO,EAC0B;IAKxC,MAAM,YAAY,GAAkE;QAChF,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,CAAC;QAClB,kBAAkB,EAAY,CAAC,gBAAgB,CAAC;QAChD,gBAAgB,EAAE;YACd,eAAe;YACf,SAAS;YACT,QAAQ;YACR,WAAW;YACX,gBAAgB;SACnB;KACJ,CAAC;IACF,MAAM,gBAAgB,GAAyB,IAAU,2BAA4B,CAAC,OAAO,EAAE,iCAAiC,EAAE;QAC9H,GAAG,OAAO;QACV,GAAG,YAAY;KAClB,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,GAAG,EAAE;QAClB,gBAAgB,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC/D,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,gBAAgB,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC;IAEF,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5D,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IAE9B,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,EAAE;QACtC,IAAI,EAAE;YACF,GAAG;gBACC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;YAChF,CAAC;SACJ;KACJ,CAAC,CAAC;IAEH,OAAoC,gBAAgB,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IAudioWorkletNodeOptions, TAnyContext, TContext, TNativeAudioWorkletNodeOptions } from 'standardized-audio-context';
|
|
2
|
+
export type TAnyAudioWorkletNodeOptions<T extends TAnyContext> = T extends TContext ? IAudioWorkletNodeOptions : TNativeAudioWorkletNodeOptions;
|
|
3
|
+
//# sourceMappingURL=any-audio-worklet-node-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any-audio-worklet-node-options.d.ts","sourceRoot":"","sources":["../../../src/types/any-audio-worklet-node-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,QAAQ,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAE7H,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,QAAQ,GAC7E,wBAAwB,GACxB,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"any-audio-worklet-node-options.js","sourceRoot":"","sources":["../../../src/types/any-audio-worklet-node-options.ts"],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type TFixedOptions = 'numberOfInputs' | 'numberOfOutputs';
|
|
1
|
+
export type TFixedOptions = 'numberOfInputs' | 'numberOfOutputs' | 'outputChannelCount' | 'processorOptions';
|
|
2
2
|
//# sourceMappingURL=fixed-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixed-options.d.ts","sourceRoot":"","sources":["../../../src/types/fixed-options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"fixed-options.d.ts","sourceRoot":"","sources":["../../../src/types/fixed-options.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,kBAAkB,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from './any-audio-worklet-node-options';
|
|
1
2
|
export * from './any-playout-audio-worklet-node-options';
|
|
3
|
+
export * from './fixed-options';
|
|
2
4
|
export * from './native-playout-audio-worklet-node';
|
|
3
5
|
export * from './native-playout-audio-worklet-node-options';
|
|
4
6
|
export * from './playout-audio-worklet-node-options';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iBAAiB,CAAC;AAChC,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sCAAsC,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from './any-audio-worklet-node-options';
|
|
1
2
|
export * from './any-playout-audio-worklet-node-options';
|
|
3
|
+
export * from './fixed-options';
|
|
2
4
|
export * from './native-playout-audio-worklet-node';
|
|
3
5
|
export * from './native-playout-audio-worklet-node-options';
|
|
4
6
|
export * from './playout-audio-worklet-node-options';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iBAAiB,CAAC;AAChC,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,sCAAsC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TNativeAudioWorkletNodeOptions } from 'standardized-audio-context';
|
|
2
2
|
import { TFixedOptions } from './fixed-options';
|
|
3
|
-
export type TNativePlayoutAudioWorkletNodeOptions = Omit<TNativeAudioWorkletNodeOptions, TFixedOptions
|
|
3
|
+
export type TNativePlayoutAudioWorkletNodeOptions = Partial<Omit<TNativeAudioWorkletNodeOptions, TFixedOptions>> & {
|
|
4
4
|
numberOfChannels: number;
|
|
5
5
|
readPointerView: Uint8Array | Uint16Array | Uint32Array;
|
|
6
6
|
startView: Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-playout-audio-worklet-node-options.d.ts","sourceRoot":"","sources":["../../../src/types/native-playout-audio-worklet-node-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,qCAAqC,GAAG,IAAI,CAAC,8BAA8B,EAAE,aAAa,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"native-playout-audio-worklet-node-options.d.ts","sourceRoot":"","sources":["../../../src/types/native-playout-audio-worklet-node-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,qCAAqC,GAAG,OAAO,CAAC,IAAI,CAAC,8BAA8B,EAAE,aAAa,CAAC,CAAC,GAAG;IAC/G,gBAAgB,EAAE,MAAM,CAAC;IAEzB,eAAe,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;IAExD,SAAS,EAAE,UAAU,CAAC;IAEtB,QAAQ,EAAE,UAAU,CAAC;IAErB,WAAW,EAAE,YAAY,CAAC;IAE1B,gBAAgB,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;CAC5D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAudioWorkletNodeOptions } from 'standardized-audio-context';
|
|
2
2
|
import { TFixedOptions } from './fixed-options';
|
|
3
|
-
export type TPlayoutAudioWorkletNodeOptions = Omit<IAudioWorkletNodeOptions, TFixedOptions
|
|
3
|
+
export type TPlayoutAudioWorkletNodeOptions = Partial<Omit<IAudioWorkletNodeOptions, TFixedOptions>> & {
|
|
4
4
|
numberOfChannels: number;
|
|
5
5
|
readPointerView: Uint8Array | Uint16Array | Uint32Array;
|
|
6
6
|
startView: Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playout-audio-worklet-node-options.d.ts","sourceRoot":"","sources":["../../../src/types/playout-audio-worklet-node-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAAC,wBAAwB,EAAE,aAAa,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"playout-audio-worklet-node-options.d.ts","sourceRoot":"","sources":["../../../src/types/playout-audio-worklet-node-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC,GAAG;IACnG,gBAAgB,EAAE,MAAM,CAAC;IAEzB,eAAe,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;IAExD,SAAS,EAAE,UAAU,CAAC;IAEtB,QAAQ,EAAE,UAAU,CAAC;IAErB,WAAW,EAAE,YAAY,CAAC;IAE1B,gBAAgB,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;CAC5D,CAAC"}
|
package/build/es5/bundle.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.playoutAudioWorklet = {}, global._defineProperty, global._asyncToGenerator, global._regeneratorRuntime));
|
|
5
|
-
})(this, (function (exports, _defineProperty, _asyncToGenerator, _regeneratorRuntime) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/defineProperty'), require('@babel/runtime/helpers/objectWithoutProperties'), require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/defineProperty', '@babel/runtime/helpers/objectWithoutProperties', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.playoutAudioWorklet = {}, global._defineProperty, global._objectWithoutProperties, global._asyncToGenerator, global._regeneratorRuntime));
|
|
5
|
+
})(this, (function (exports, _defineProperty, _objectWithoutProperties, _asyncToGenerator, _regeneratorRuntime) { 'use strict';
|
|
6
6
|
|
|
7
7
|
// This is the minified and stringified code of the playout-audio-worklet-processor package.
|
|
8
8
|
var worklet = "(()=>{var e={45(e,t,r){var o=r(738).default;e.exports=function(e,t){if(\"object\"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||\"default\");if(\"object\"!=o(n))return n;throw new TypeError(\"@@toPrimitive must return a primitive value.\")}return(\"string\"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},72(e){function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},79(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=Array(t);r<t;r++)o[r]=e[r];return o},e.exports.__esModule=!0,e.exports.default=e.exports},122(e,t,r){var o=r(79);e.exports=function(e,t){if(e){if(\"string\"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return\"Object\"===r&&e.constructor&&(r=e.constructor.name),\"Map\"===r||\"Set\"===r?Array.from(e):\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},156(e){e.exports=function(e,t){var r=null==e?null:\"undefined\"!=typeof Symbol&&e[Symbol.iterator]||e[\"@@iterator\"];if(null!=r){var o,n,s,i,a=[],u=!0,l=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(o=s.call(r)).done)&&(a.push(o.value),a.length!==t);u=!0);}catch(e){l=!0,n=e}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw n}}return a}},e.exports.__esModule=!0,e.exports.default=e.exports},383(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")},e.exports.__esModule=!0,e.exports.default=e.exports},452(e,t,r){var o=r(738).default,n=r(475);e.exports=function(e,t){if(t&&(\"object\"==o(t)||\"function\"==typeof t))return t;if(void 0!==t)throw new TypeError(\"Derived constructors may only return object or undefined\");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},475(e){e.exports=function(e){if(void 0===e)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return e},e.exports.__esModule=!0,e.exports.default=e.exports},511(e,t,r){var o=r(636);e.exports=function(e,t){if(\"function\"!=typeof t&&null!==t)throw new TypeError(\"Super expression must either be null or a function\");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,\"prototype\",{writable:!1}),t&&o(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},550(e){function t(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(r){}return(e.exports=t=function(){return!!r},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,r){var o=r(736);function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,\"prototype\",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},636(e){function t(r,o){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,o)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},646(e,t,r){var o=r(550),n=r(636);e.exports=function(e,t,r){if(o())return Reflect.construct.apply(null,arguments);var s=[null];s.push.apply(s,t);var i=new(e.bind.apply(e,s));return r&&n(i,r.prototype),i},e.exports.__esModule=!0,e.exports.default=e.exports},691(e){e.exports=function(e){try{return-1!==Function.toString.call(e).indexOf(\"[native code]\")}catch(t){return\"function\"==typeof e}},e.exports.__esModule=!0,e.exports.default=e.exports},715(e,t,r){var o=r(987),n=r(156),s=r(122),i=r(752);e.exports=function(e,t){return o(e)||n(e,t)||s(e,t)||i()},e.exports.__esModule=!0,e.exports.default=e.exports},736(e,t,r){var o=r(738).default,n=r(45);e.exports=function(e){var t=n(e,\"string\");return\"symbol\"==o(t)?t:t+\"\"},e.exports.__esModule=!0,e.exports.default=e.exports},738(e){function t(r){return e.exports=t=\"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},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},752(e){e.exports=function(){throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")},e.exports.__esModule=!0,e.exports.default=e.exports},763(e,t,r){!function(e,t,r,o,n,s,i,a){\"use strict\";function u(e,t,r){return t=s(t),n(e,l()?Reflect.construct(t,[],s(e).constructor):t.apply(e,r))}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(l=function(){return!!e})()}var p=128,f=524287,c=function(n){function s(o){var n,i=o.numberOfInputs,a=o.numberOfOutputs,l=o.outputChannelCount,f=o.processorOptions;if(r(this,s),0!==i)throw new Error(\"The numberOfInputs must be 0.\");if(1!==a)throw new Error(\"The numberOfOutputs must be 1.\");if(void 0===l||1!==l.length)throw new Error(\"The outputChannelCount must define a single output.\");var c=t(l,1)[0];if(\"object\"!==e(f)||null===f)throw new Error;var d=\"readPointerView\"in f?f.readPointerView:null;if(!(d instanceof Uint8Array||d instanceof Uint16Array||d instanceof Uint32Array))throw new Error('The readPointerView needs to be an instance of \"Uint8Array\", \"Uint16Array\", or \"Uint32Array\".');if(1!==d.length)throw new Error(\"The readPointerView needs to have a length of 1.\");var h=\"startView\"in f?f.startView:null;if(!(h instanceof Uint16Array))throw new Error('The startView needs to be an instance of \"Uint16Array\".');if(1!==h.length)throw new Error(\"The startView needs to have a length of 1.\");var x=\"stopView\"in f?f.stopView:null;if(!(x instanceof Uint16Array))throw new Error('The stopView needs to be an instance of \"Uint16Array\".');if(1!==x.length)throw new Error(\"The stopView needs to have a length of 1.\");var y=\"storageView\"in f?f.storageView:null;if(!(y instanceof Float32Array))throw new Error('The storageView needs to be an instance of \"Float32Array\".');var w=y.length/c;if(!Number.isInteger(w))throw new Error(\"The storageView needs to have a length which is a multiple of the number of channels.\");var _=w/p;if(!Number.isInteger(_))throw new Error(\"The capacity can only be a multiple of the render quantum size.\");var b=\"writePointerView\"in f?f.writePointerView:null;if(!(b instanceof Uint8Array||b instanceof Uint16Array||b instanceof Uint32Array))throw new Error('The writePointerView needs to be an instance of \"Uint8Array\", \"Uint16Array\", or \"Uint32Array\".');if(1!==b.length)throw new Error(\"The writePointerView needs to have a length of 1.\");if(d.byteLength!==b.byteLength)throw new Error(\"The pointer need to be of the same size.\");if(w>=Math.pow(2,8*d.byteLength-1))throw new Error(\"The capacity exceeds the pointer range.\");return(n=u(this,s))._isStarted=!1,n._numberOfChannels=c,n._numberOfSlots=_,n._readPointerView=d,n._slots=Array.from({length:_},function(e,t){var r=t*p;return Array.from({length:c},function(e,t){var o=r+t*_*p;return y.subarray(o,o+p)})}),n._startView=h,n._stopView=x,n._writePointerView=b,n}return i(s,n),o(s,[{key:\"process\",value:function(e,r){var o=t(r,1)[0];if(!this._isStarted){if(!this._readStart())return!0;this._isStarted=!0}var n=!(!this._readStorage(o)&&this._readStop());return n||(this.port.postMessage(null),this.port.close()),n}},{key:\"_readStart\",value:function(){return 1===Atomics.load(this._startView,0)}},{key:\"_readStop\",value:function(){return 1===Atomics.load(this._stopView,0)}},{key:\"_readStorage\",value:function(e){var t=Atomics.load(this._readPointerView,0)/p;if(Math.floor((Atomics.load(this._writePointerView,0)&f)/p)===t)return!1;for(var r=this._slots[t%this._numberOfSlots],o=0;o<this._numberOfChannels;o+=1)e[o].set(r[o]);return Atomics.store(this._readPointerView,0,(t+1)%(2*this._numberOfSlots)*p),!0}}])}(a(AudioWorkletProcessor));c.parameterDescriptors=[],registerProcessor(\"playout-audio-worklet-processor\",c)}(r(738),r(715),r(383),r(579),r(452),r(72),r(511),r(837))},837(e,t,r){var o=r(72),n=r(636),s=r(691),i=r(646);function a(t){var r=\"function\"==typeof Map?new Map:void 0;return e.exports=a=function(e){if(null===e||!s(e))return e;if(\"function\"!=typeof e)throw new TypeError(\"Super expression must either be null or a function\");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return i(e,arguments,o(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,a(t)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},987(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var s=t[o]={exports:{}};return e[o].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{\"use strict\";r(763)})()})();"; // tslint:disable-line:max-line-length
|
|
9
9
|
|
|
10
|
+
var _excluded = ["numberOfChannels", "readPointerView", "startView", "stopView", "storageView", "writePointerView"];
|
|
10
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
13
|
var blob = new Blob([worklet], {
|
|
@@ -36,26 +37,27 @@
|
|
|
36
37
|
return _ref.apply(this, arguments);
|
|
37
38
|
};
|
|
38
39
|
}();
|
|
39
|
-
function createPlayoutAudioWorkletNode(audioWorkletNodeConstructor, context) {
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
40
|
+
function createPlayoutAudioWorkletNode(audioWorkletNodeConstructor, context, _ref2) {
|
|
41
|
+
var numberOfChannels = _ref2.numberOfChannels,
|
|
42
|
+
readPointerView = _ref2.readPointerView,
|
|
43
|
+
startView = _ref2.startView,
|
|
44
|
+
stopView = _ref2.stopView,
|
|
45
|
+
storageView = _ref2.storageView,
|
|
46
|
+
writePointerView = _ref2.writePointerView,
|
|
47
|
+
options = _objectWithoutProperties(_ref2, _excluded);
|
|
48
|
+
var fixedOptions = {
|
|
48
49
|
numberOfInputs: 0,
|
|
49
50
|
numberOfOutputs: 1,
|
|
50
51
|
outputChannelCount: [numberOfChannels],
|
|
51
|
-
|
|
52
|
+
processorOptions: {
|
|
52
53
|
readPointerView: readPointerView,
|
|
53
54
|
startView: startView,
|
|
54
55
|
stopView: stopView,
|
|
55
56
|
storageView: storageView,
|
|
56
57
|
writePointerView: writePointerView
|
|
57
58
|
}
|
|
58
|
-
}
|
|
59
|
+
};
|
|
60
|
+
var audioWorkletNode = new audioWorkletNodeConstructor(context, 'playout-audio-worklet-processor', _objectSpread(_objectSpread({}, options), fixedOptions));
|
|
59
61
|
var _listener = function listener() {
|
|
60
62
|
audioWorkletNode.port.removeEventListener('message', _listener);
|
|
61
63
|
audioWorkletNode.port.close();
|
package/package.json
CHANGED
package/src/module.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TNativeContext
|
|
8
8
|
} from 'standardized-audio-context';
|
|
9
9
|
import { IPlayoutAudioWorkletNode } from './interfaces';
|
|
10
|
-
import { TAnyPlayoutAudioWorkletNodeOptions, TNativePlayoutAudioWorkletNode } from './types';
|
|
10
|
+
import { TAnyAudioWorkletNodeOptions, TAnyPlayoutAudioWorkletNodeOptions, TFixedOptions, TNativePlayoutAudioWorkletNode } from './types';
|
|
11
11
|
import { worklet } from './worklet/worklet';
|
|
12
12
|
|
|
13
13
|
/*
|
|
@@ -32,24 +32,34 @@ export const addPlayoutAudioWorkletModule = async (addAudioWorkletModule: (url:
|
|
|
32
32
|
export function createPlayoutAudioWorkletNode<T extends TContext | TNativeContext>(
|
|
33
33
|
audioWorkletNodeConstructor: T extends TContext ? TAudioWorkletNodeConstructor : TNativeAudioWorkletNodeConstructor,
|
|
34
34
|
context: T,
|
|
35
|
-
|
|
35
|
+
{
|
|
36
|
+
numberOfChannels,
|
|
37
|
+
readPointerView,
|
|
38
|
+
startView,
|
|
39
|
+
stopView,
|
|
40
|
+
storageView,
|
|
41
|
+
writePointerView,
|
|
42
|
+
...options
|
|
43
|
+
}: TAnyPlayoutAudioWorkletNodeOptions<T>
|
|
36
44
|
): T extends TContext ? IPlayoutAudioWorkletNode<T> : TNativePlayoutAudioWorkletNode {
|
|
37
45
|
type TAnyAudioWorkletNode = T extends TContext ? IAudioWorkletNode<T> : TNativeAudioWorkletNode;
|
|
38
46
|
type TAnyPlayoutAudioWorkletNode = T extends TContext ? IPlayoutAudioWorkletNode<T> : TNativePlayoutAudioWorkletNode;
|
|
39
47
|
|
|
40
|
-
const
|
|
41
|
-
const audioWorkletNode: TAnyAudioWorkletNode = new (<any>audioWorkletNodeConstructor)(context, 'playout-audio-worklet-processor', {
|
|
42
|
-
...options,
|
|
48
|
+
const fixedOptions: Required<Pick<TAnyAudioWorkletNodeOptions<T>, TFixedOptions>> = {
|
|
43
49
|
numberOfInputs: 0,
|
|
44
50
|
numberOfOutputs: 1,
|
|
45
|
-
outputChannelCount: [numberOfChannels],
|
|
46
|
-
|
|
51
|
+
outputChannelCount: <number[]>[numberOfChannels],
|
|
52
|
+
processorOptions: {
|
|
47
53
|
readPointerView,
|
|
48
54
|
startView,
|
|
49
55
|
stopView,
|
|
50
56
|
storageView,
|
|
51
57
|
writePointerView
|
|
52
58
|
}
|
|
59
|
+
};
|
|
60
|
+
const audioWorkletNode: TAnyAudioWorkletNode = new (<any>audioWorkletNodeConstructor)(context, 'playout-audio-worklet-processor', {
|
|
61
|
+
...options,
|
|
62
|
+
...fixedOptions
|
|
53
63
|
});
|
|
54
64
|
const listener = () => {
|
|
55
65
|
audioWorkletNode.port.removeEventListener('message', listener);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IAudioWorkletNodeOptions, TAnyContext, TContext, TNativeAudioWorkletNodeOptions } from 'standardized-audio-context';
|
|
2
|
+
|
|
3
|
+
export type TAnyAudioWorkletNodeOptions<T extends TAnyContext> = T extends TContext
|
|
4
|
+
? IAudioWorkletNodeOptions
|
|
5
|
+
: TNativeAudioWorkletNodeOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TFixedOptions = 'numberOfInputs' | 'numberOfOutputs';
|
|
1
|
+
export type TFixedOptions = 'numberOfInputs' | 'numberOfOutputs' | 'outputChannelCount' | 'processorOptions';
|
package/src/types/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from './any-audio-worklet-node-options';
|
|
1
2
|
export * from './any-playout-audio-worklet-node-options';
|
|
3
|
+
export * from './fixed-options';
|
|
2
4
|
export * from './native-playout-audio-worklet-node';
|
|
3
5
|
export * from './native-playout-audio-worklet-node-options';
|
|
4
6
|
export * from './playout-audio-worklet-node-options';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TNativeAudioWorkletNodeOptions } from 'standardized-audio-context';
|
|
2
2
|
import { TFixedOptions } from './fixed-options';
|
|
3
3
|
|
|
4
|
-
export type TNativePlayoutAudioWorkletNodeOptions = Omit<TNativeAudioWorkletNodeOptions, TFixedOptions
|
|
4
|
+
export type TNativePlayoutAudioWorkletNodeOptions = Partial<Omit<TNativeAudioWorkletNodeOptions, TFixedOptions>> & {
|
|
5
5
|
numberOfChannels: number;
|
|
6
6
|
|
|
7
7
|
readPointerView: Uint8Array | Uint16Array | Uint32Array;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IAudioWorkletNodeOptions } from 'standardized-audio-context';
|
|
2
2
|
import { TFixedOptions } from './fixed-options';
|
|
3
3
|
|
|
4
|
-
export type TPlayoutAudioWorkletNodeOptions = Omit<IAudioWorkletNodeOptions, TFixedOptions
|
|
4
|
+
export type TPlayoutAudioWorkletNodeOptions = Partial<Omit<IAudioWorkletNodeOptions, TFixedOptions>> & {
|
|
5
5
|
numberOfChannels: number;
|
|
6
6
|
|
|
7
7
|
readPointerView: Uint8Array | Uint16Array | Uint32Array;
|