node-web-audio-api 0.14.0 → 0.15.0

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 (39) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +1 -1
  3. package/README.md +35 -17
  4. package/index.cjs +1 -1
  5. package/index.mjs +2 -1
  6. package/js/AnalyserNode.js +135 -0
  7. package/js/AudioBufferSourceNode.js +105 -0
  8. package/js/AudioContext.js +60 -0
  9. package/js/AudioNode.mixin.js +121 -0
  10. package/js/AudioParam.js +132 -0
  11. package/js/AudioScheduledSourceNode.mixin.js +67 -0
  12. package/js/BaseAudioContext.mixin.js +140 -0
  13. package/js/BiquadFilterNode.js +75 -0
  14. package/js/ChannelMergerNode.js +51 -0
  15. package/js/ChannelSplitterNode.js +51 -0
  16. package/js/ConstantSourceNode.js +56 -0
  17. package/js/ConvolverNode.js +75 -0
  18. package/js/DelayNode.js +52 -0
  19. package/js/DynamicsCompressorNode.js +60 -0
  20. package/js/EventTarget.mixin.js +59 -0
  21. package/js/GainNode.js +52 -0
  22. package/js/IIRFilterNode.js +59 -0
  23. package/js/OfflineAudioContext.js +45 -0
  24. package/js/OscillatorNode.js +77 -0
  25. package/js/PannerNode.js +169 -0
  26. package/js/StereoPannerNode.js +52 -0
  27. package/js/WaveShaperNode.js +75 -0
  28. package/js/lib/errors.js +108 -0
  29. package/js/lib/utils.js +16 -0
  30. package/js/monkey-patch.js +67 -0
  31. package/node-web-audio-api.darwin-arm64.node +0 -0
  32. package/node-web-audio-api.darwin-x64.node +0 -0
  33. package/node-web-audio-api.linux-arm-gnueabihf.node +0 -0
  34. package/node-web-audio-api.linux-arm64-gnu.node +0 -0
  35. package/node-web-audio-api.linux-x64-gnu.node +0 -0
  36. package/node-web-audio-api.win32-arm64-msvc.node +0 -0
  37. package/node-web-audio-api.win32-x64-msvc.node +0 -0
  38. package/package.json +10 -6
  39. package/monkey-patch.js +0 -184
@@ -0,0 +1,52 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+
27
+
28
+ module.exports = (NativeDelayNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativeDelayNode);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+
33
+ class DelayNode extends AudioNode {
34
+ constructor(context, options) {
35
+ super(context, options);
36
+
37
+ this.delayTime = new AudioParam(this.delayTime);
38
+ }
39
+
40
+ // getters
41
+
42
+ // setters
43
+
44
+ // methods
45
+
46
+ }
47
+
48
+ return DelayNode;
49
+ };
50
+
51
+
52
+
@@ -0,0 +1,60 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+
27
+
28
+ module.exports = (NativeDynamicsCompressorNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativeDynamicsCompressorNode);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+
33
+ class DynamicsCompressorNode extends AudioNode {
34
+ constructor(context, options) {
35
+ super(context, options);
36
+
37
+ this.threshold = new AudioParam(this.threshold);
38
+ this.knee = new AudioParam(this.knee);
39
+ this.ratio = new AudioParam(this.ratio);
40
+ this.attack = new AudioParam(this.attack);
41
+ this.release = new AudioParam(this.release);
42
+ }
43
+
44
+ // getters
45
+
46
+ get reduction() {
47
+ return super.reduction;
48
+ }
49
+
50
+ // setters
51
+
52
+ // methods
53
+
54
+ }
55
+
56
+ return DynamicsCompressorNode;
57
+ };
58
+
59
+
60
+
@@ -0,0 +1,59 @@
1
+ const { isFunction } = require('./lib/utils.js');
2
+
3
+ const kEventListeners = Symbol('node-web-audio-api:event-listeners');
4
+ const kDispatchEvent = Symbol.for('node-web-audio-api:napi-dispatch-event');
5
+
6
+ module.exports = (superclass, eventTypes = []) => class EventTarget extends superclass {
7
+ [kEventListeners] = new Map();
8
+
9
+ constructor(...args) {
10
+ super(...args);
11
+
12
+ eventTypes.forEach((eventType) => {
13
+ this[`on${eventType}`] = null;
14
+ });
15
+
16
+ // we need to bind because calling [kDispatchEvent] from rust loose `this`
17
+ this[kDispatchEvent] = this[kDispatchEvent].bind(this);
18
+ }
19
+
20
+ // instance might
21
+ addEventListener(eventType, callback) {
22
+ if (!this[kEventListeners].has(eventType)) {
23
+ this[kEventListeners].set(eventType, new Set());
24
+ }
25
+
26
+ const callbacks = this[kEventListeners].get(eventType);
27
+ callbacks.add(callback);
28
+ }
29
+
30
+ removeEventListener(eventType, callback) {
31
+ // this is valid event eventType, otherwaise just ignore
32
+ if (this[kEventListeners].has(eventType)) {
33
+ const callbacks = this[kEventListeners].get(eventType);
34
+ callbacks.delete(callback);
35
+ }
36
+ }
37
+
38
+ dispatchEvent(event) {
39
+ if (isFunction(this[`on${event.type}`])) {
40
+ this[`on${event.type}`](event);
41
+ }
42
+
43
+ if (this[kEventListeners].has(event.type)) {
44
+ const callbacks = this[kEventListeners].get(event.type);
45
+ callbacks.forEach(callback => callback(event));
46
+ }
47
+ }
48
+
49
+ // called from rust
50
+ [kDispatchEvent](err, eventType) {
51
+ const event = new Event(eventType);
52
+ // cannot override, this would need to derive EventTarget
53
+ // cf. https://www.nearform.com/blog/node-js-and-the-struggles-of-being-an-eventtarget/
54
+ // event.target = this;
55
+ // event.currentTarget = this;
56
+ // event.srcElement = this;
57
+ this.dispatchEvent(event);
58
+ }
59
+ };
package/js/GainNode.js ADDED
@@ -0,0 +1,52 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+
27
+
28
+ module.exports = (NativeGainNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativeGainNode);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+
33
+ class GainNode extends AudioNode {
34
+ constructor(context, options) {
35
+ super(context, options);
36
+
37
+ this.gain = new AudioParam(this.gain);
38
+ }
39
+
40
+ // getters
41
+
42
+ // setters
43
+
44
+ // methods
45
+
46
+ }
47
+
48
+ return GainNode;
49
+ };
50
+
51
+
52
+
@@ -0,0 +1,59 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+
27
+
28
+ module.exports = (NativeIIRFilterNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativeIIRFilterNode);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+
33
+ class IIRFilterNode extends AudioNode {
34
+ constructor(context, options) {
35
+ super(context, options);
36
+
37
+ }
38
+
39
+ // getters
40
+
41
+ // setters
42
+
43
+ // methods
44
+
45
+ getFrequencyResponse(...args) {
46
+ try {
47
+ return super.getFrequencyResponse(...args);
48
+ } catch (err) {
49
+ throwSanitizedError(err);
50
+ }
51
+ }
52
+
53
+ }
54
+
55
+ return IIRFilterNode;
56
+ };
57
+
58
+
59
+
@@ -0,0 +1,45 @@
1
+ const { NotSupportedError } = require('./lib/errors.js');
2
+ const { isPlainObject, isPositiveInt, isPositiveNumber } = require('./lib/utils.js');
3
+
4
+ module.exports = function patchOfflineAudioContext(bindings) {
5
+ // @todo - EventTarget
6
+ // - https://github.com/orottier/web-audio-api-rs/issues/411
7
+ // - https://github.com/orottier/web-audio-api-rs/issues/416
8
+
9
+ const EventTarget = require('./EventTarget.mixin.js')(bindings.OfflineAudioContext, ['statechange']);
10
+ const BaseAudioContext = require('./BaseAudioContext.mixin.js')(EventTarget, bindings);
11
+
12
+ class OfflineAudioContext extends BaseAudioContext {
13
+ constructor(...args) {
14
+ // handle initialisation with either an options object or a sequence of parameters
15
+ // https://webaudio.github.io/web-audio-api/#dom-offlineaudiocontext-constructor-contextoptions-contextoptions
16
+ if (isPlainObject(args[0])
17
+ && 'numberOfChannels' in args[0] && 'length' in args[0] && 'sampleRate' in args[0]
18
+ ) {
19
+ const { numberOfChannels, length, sampleRate } = args[0];
20
+ args = [numberOfChannels, length, sampleRate];
21
+ }
22
+
23
+ const [numberOfChannels, length, sampleRate] = args;
24
+
25
+ if (!isPositiveInt(numberOfChannels)) {
26
+ throw new NotSupportedError(`Invalid value for numberOfChannels: ${numberOfChannels}`);
27
+ } else if (!isPositiveInt(length)) {
28
+ throw new NotSupportedError(`Invalid value for length: ${length}`);
29
+ } else if (!isPositiveNumber(sampleRate)) {
30
+ throw new NotSupportedError(`Invalid value for sampleRate: ${sampleRate}`);
31
+ }
32
+
33
+ super(numberOfChannels, length, sampleRate);
34
+
35
+ // @todo - do not init the event target, no way to clean the thread safe
36
+ // functions for now
37
+
38
+ // EventTargetMixin has been called so EventTargetMixin[kDispatchEvent] is
39
+ // bound to this, then we can safely finalize event target initialization
40
+ // super.__initEventTarget__();
41
+ }
42
+ }
43
+
44
+ return OfflineAudioContext;
45
+ };
@@ -0,0 +1,77 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+ const AudioScheduledSourceNodeMixin = require('./AudioScheduledSourceNode.mixin.js');
27
+
28
+ module.exports = (NativeOscillatorNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativeOscillatorNode, ['ended']);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+ const AudioScheduledSourceNode = AudioScheduledSourceNodeMixin(AudioNode);
33
+
34
+ class OscillatorNode extends AudioScheduledSourceNode {
35
+ constructor(context, options) {
36
+ super(context, options);
37
+ // EventTargetMixin has been called so EventTargetMixin[kDispatchEvent] is
38
+ // bound to this, then we can safely finalize event target initialization
39
+ super.__initEventTarget__();
40
+
41
+ this.frequency = new AudioParam(this.frequency);
42
+ this.detune = new AudioParam(this.detune);
43
+ }
44
+
45
+ // getters
46
+
47
+ get type() {
48
+ return super.type;
49
+ }
50
+
51
+ // setters
52
+
53
+ set type(value) {
54
+ try {
55
+ super.type = value;
56
+ } catch (err) {
57
+ throwSanitizedError(err);
58
+ }
59
+ }
60
+
61
+ // methods
62
+
63
+ setPeriodicWave(...args) {
64
+ try {
65
+ return super.setPeriodicWave(...args);
66
+ } catch (err) {
67
+ throwSanitizedError(err);
68
+ }
69
+ }
70
+
71
+ }
72
+
73
+ return OscillatorNode;
74
+ };
75
+
76
+
77
+
@@ -0,0 +1,169 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+
27
+
28
+ module.exports = (NativePannerNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativePannerNode);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+
33
+ class PannerNode extends AudioNode {
34
+ constructor(context, options) {
35
+ super(context, options);
36
+
37
+ this.positionX = new AudioParam(this.positionX);
38
+ this.positionY = new AudioParam(this.positionY);
39
+ this.positionZ = new AudioParam(this.positionZ);
40
+ this.orientationX = new AudioParam(this.orientationX);
41
+ this.orientationY = new AudioParam(this.orientationY);
42
+ this.orientationZ = new AudioParam(this.orientationZ);
43
+ }
44
+
45
+ // getters
46
+
47
+ get panningModel() {
48
+ return super.panningModel;
49
+ }
50
+
51
+ get distanceModel() {
52
+ return super.distanceModel;
53
+ }
54
+
55
+ get refDistance() {
56
+ return super.refDistance;
57
+ }
58
+
59
+ get maxDistance() {
60
+ return super.maxDistance;
61
+ }
62
+
63
+ get rolloffFactor() {
64
+ return super.rolloffFactor;
65
+ }
66
+
67
+ get coneInnerAngle() {
68
+ return super.coneInnerAngle;
69
+ }
70
+
71
+ get coneOuterAngle() {
72
+ return super.coneOuterAngle;
73
+ }
74
+
75
+ get coneOuterGain() {
76
+ return super.coneOuterGain;
77
+ }
78
+
79
+ // setters
80
+
81
+ set panningModel(value) {
82
+ try {
83
+ super.panningModel = value;
84
+ } catch (err) {
85
+ throwSanitizedError(err);
86
+ }
87
+ }
88
+
89
+ set distanceModel(value) {
90
+ try {
91
+ super.distanceModel = value;
92
+ } catch (err) {
93
+ throwSanitizedError(err);
94
+ }
95
+ }
96
+
97
+ set refDistance(value) {
98
+ try {
99
+ super.refDistance = value;
100
+ } catch (err) {
101
+ throwSanitizedError(err);
102
+ }
103
+ }
104
+
105
+ set maxDistance(value) {
106
+ try {
107
+ super.maxDistance = value;
108
+ } catch (err) {
109
+ throwSanitizedError(err);
110
+ }
111
+ }
112
+
113
+ set rolloffFactor(value) {
114
+ try {
115
+ super.rolloffFactor = value;
116
+ } catch (err) {
117
+ throwSanitizedError(err);
118
+ }
119
+ }
120
+
121
+ set coneInnerAngle(value) {
122
+ try {
123
+ super.coneInnerAngle = value;
124
+ } catch (err) {
125
+ throwSanitizedError(err);
126
+ }
127
+ }
128
+
129
+ set coneOuterAngle(value) {
130
+ try {
131
+ super.coneOuterAngle = value;
132
+ } catch (err) {
133
+ throwSanitizedError(err);
134
+ }
135
+ }
136
+
137
+ set coneOuterGain(value) {
138
+ try {
139
+ super.coneOuterGain = value;
140
+ } catch (err) {
141
+ throwSanitizedError(err);
142
+ }
143
+ }
144
+
145
+ // methods
146
+
147
+ setPosition(...args) {
148
+ try {
149
+ return super.setPosition(...args);
150
+ } catch (err) {
151
+ throwSanitizedError(err);
152
+ }
153
+ }
154
+
155
+ setOrientation(...args) {
156
+ try {
157
+ return super.setOrientation(...args);
158
+ } catch (err) {
159
+ throwSanitizedError(err);
160
+ }
161
+ }
162
+
163
+ }
164
+
165
+ return PannerNode;
166
+ };
167
+
168
+
169
+
@@ -0,0 +1,52 @@
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
19
+
20
+ // eslint-disable-next-line no-unused-vars
21
+ const { throwSanitizedError } = require('./lib/errors.js');
22
+ // eslint-disable-next-line no-unused-vars
23
+ const { AudioParam } = require('./AudioParam.js');
24
+ const EventTargetMixin = require('./EventTarget.mixin.js');
25
+ const AudioNodeMixin = require('./AudioNode.mixin.js');
26
+
27
+
28
+ module.exports = (NativeStereoPannerNode) => {
29
+
30
+ const EventTarget = EventTargetMixin(NativeStereoPannerNode);
31
+ const AudioNode = AudioNodeMixin(EventTarget);
32
+
33
+ class StereoPannerNode extends AudioNode {
34
+ constructor(context, options) {
35
+ super(context, options);
36
+
37
+ this.pan = new AudioParam(this.pan);
38
+ }
39
+
40
+ // getters
41
+
42
+ // setters
43
+
44
+ // methods
45
+
46
+ }
47
+
48
+ return StereoPannerNode;
49
+ };
50
+
51
+
52
+