node-web-audio-api 0.18.0 → 0.19.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.
- package/CHANGELOG.md +7 -0
- package/TODOS.md +140 -12
- package/index.mjs +10 -5
- package/js/AnalyserNode.js +262 -48
- package/js/AudioBuffer.js +244 -0
- package/js/AudioBufferSourceNode.js +265 -41
- package/js/AudioContext.js +271 -28
- package/js/AudioDestinationNode.js +42 -100
- package/js/AudioListener.js +219 -0
- package/js/AudioNode.js +323 -0
- package/js/AudioParam.js +252 -39
- package/js/AudioScheduledSourceNode.js +105 -0
- package/js/BaseAudioContext.js +419 -0
- package/js/BiquadFilterNode.js +221 -29
- package/js/ChannelMergerNode.js +96 -22
- package/js/ChannelSplitterNode.js +96 -22
- package/js/ConstantSourceNode.js +92 -26
- package/js/ConvolverNode.js +161 -29
- package/js/DelayNode.js +115 -21
- package/js/DynamicsCompressorNode.js +198 -27
- package/js/GainNode.js +107 -21
- package/js/IIRFilterNode.js +139 -23
- package/js/MediaStreamAudioSourceNode.js +83 -24
- package/js/OfflineAudioContext.js +182 -34
- package/js/OscillatorNode.js +195 -32
- package/js/PannerNode.js +461 -56
- package/js/PeriodicWave.js +67 -3
- package/js/StereoPannerNode.js +107 -21
- package/js/WaveShaperNode.js +147 -29
- package/js/lib/cast.js +19 -0
- package/js/lib/errors.js +10 -55
- package/js/lib/events.js +20 -0
- package/js/lib/symbols.js +5 -0
- package/js/lib/utils.js +12 -12
- package/js/monkey-patch.js +32 -30
- package/node-web-audio-api.darwin-arm64.node +0 -0
- package/node-web-audio-api.darwin-x64.node +0 -0
- package/node-web-audio-api.linux-arm-gnueabihf.node +0 -0
- package/node-web-audio-api.linux-arm64-gnu.node +0 -0
- package/node-web-audio-api.linux-x64-gnu.node +0 -0
- package/node-web-audio-api.win32-arm64-msvc.node +0 -0
- package/node-web-audio-api.win32-x64-msvc.node +0 -0
- package/package.json +7 -4
- package/run-wpt.md +27 -0
- package/run-wpt.sh +5 -0
- package/js/AudioNode.mixin.js +0 -132
- package/js/AudioScheduledSourceNode.mixin.js +0 -67
- package/js/BaseAudioContext.mixin.js +0 -154
- package/js/EventTarget.mixin.js +0 -60
package/js/PannerNode.js
CHANGED
|
@@ -17,148 +17,520 @@
|
|
|
17
17
|
// -------------------------------------------------------------------------- //
|
|
18
18
|
// -------------------------------------------------------------------------- //
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
20
|
+
/* eslint-disable no-unused-vars */
|
|
21
|
+
const conversions = require('webidl-conversions');
|
|
22
|
+
const {
|
|
23
|
+
toSanitizedSequence,
|
|
24
|
+
} = require('./lib/cast.js');
|
|
25
|
+
const {
|
|
26
|
+
isFunction,
|
|
27
|
+
kEnumerableProperty,
|
|
28
|
+
} = require('./lib/utils.js');
|
|
29
|
+
const {
|
|
30
|
+
throwSanitizedError,
|
|
31
|
+
} = require('./lib/errors.js');
|
|
32
|
+
const {
|
|
33
|
+
kNapiObj,
|
|
34
|
+
kAudioBuffer,
|
|
35
|
+
} = require('./lib/symbols.js');
|
|
36
|
+
const {
|
|
37
|
+
bridgeEventTarget,
|
|
38
|
+
} = require('./lib/events.js');
|
|
39
|
+
/* eslint-enable no-unused-vars */
|
|
26
40
|
|
|
41
|
+
const AudioNode = require('./AudioNode.js');
|
|
27
42
|
|
|
28
|
-
module.exports = (
|
|
43
|
+
module.exports = (jsExport, nativeBinding) => {
|
|
44
|
+
class PannerNode extends AudioNode {
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
#positionX = null;
|
|
47
|
+
#positionY = null;
|
|
48
|
+
#positionZ = null;
|
|
49
|
+
#orientationX = null;
|
|
50
|
+
#orientationY = null;
|
|
51
|
+
#orientationZ = null;
|
|
32
52
|
|
|
33
|
-
class PannerNode extends AudioNode {
|
|
34
53
|
constructor(context, options) {
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
|
|
55
|
+
if (arguments.length < 1) {
|
|
56
|
+
throw new TypeError(`Failed to construct 'PannerNode': 1 argument required, but only ${arguments.length} present`);
|
|
37
57
|
}
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
if (!(context instanceof jsExport.BaseAudioContext)) {
|
|
60
|
+
throw new TypeError(`Failed to construct 'PannerNode': argument 1 is not of type BaseAudioContext`);
|
|
61
|
+
}
|
|
40
62
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
this.positionZ = new AudioParam(this.positionZ);
|
|
44
|
-
this.orientationX = new AudioParam(this.orientationX);
|
|
45
|
-
this.orientationY = new AudioParam(this.orientationY);
|
|
46
|
-
this.orientationZ = new AudioParam(this.orientationZ);
|
|
47
|
-
}
|
|
63
|
+
// parsed version of the option to be passed to NAPI
|
|
64
|
+
const parsedOptions = {};
|
|
48
65
|
|
|
49
|
-
|
|
66
|
+
if (options && typeof options !== 'object') {
|
|
67
|
+
throw new TypeError('Failed to construct \'PannerNode\': argument 2 is not of type \'PannerOptions\'');
|
|
68
|
+
}
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
if (options && options.panningModel !== undefined) {
|
|
71
|
+
if (!['equalpower', 'HRTF'].includes(options.panningModel)) {
|
|
72
|
+
throw new TypeError(`Failed to construct 'PannerNode': Failed to read the 'panningModel' property from PannerOptions: The provided value '${options.panningModel}' is not a valid enum value of type PanningModelType`);
|
|
73
|
+
}
|
|
54
74
|
|
|
55
|
-
|
|
56
|
-
|
|
75
|
+
parsedOptions.panningModel = conversions['DOMString'](options.panningModel, {
|
|
76
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'panningModel' property from PannerOptions: The provided value '${options.panningModel}'`,
|
|
77
|
+
});
|
|
78
|
+
} else {
|
|
79
|
+
parsedOptions.panningModel = 'equalpower';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (options && options.distanceModel !== undefined) {
|
|
83
|
+
if (!['linear', 'inverse', 'exponential'].includes(options.distanceModel)) {
|
|
84
|
+
throw new TypeError(`Failed to construct 'PannerNode': Failed to read the 'distanceModel' property from PannerOptions: The provided value '${options.distanceModel}' is not a valid enum value of type DistanceModelType`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
parsedOptions.distanceModel = conversions['DOMString'](options.distanceModel, {
|
|
88
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'distanceModel' property from PannerOptions: The provided value '${options.distanceModel}'`,
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
parsedOptions.distanceModel = 'inverse';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (options && options.positionX !== undefined) {
|
|
95
|
+
parsedOptions.positionX = conversions['float'](options.positionX, {
|
|
96
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'positionX' property from PannerOptions: The provided value (${options.positionX}})`,
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
parsedOptions.positionX = 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (options && options.positionY !== undefined) {
|
|
103
|
+
parsedOptions.positionY = conversions['float'](options.positionY, {
|
|
104
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'positionY' property from PannerOptions: The provided value (${options.positionY}})`,
|
|
105
|
+
});
|
|
106
|
+
} else {
|
|
107
|
+
parsedOptions.positionY = 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (options && options.positionZ !== undefined) {
|
|
111
|
+
parsedOptions.positionZ = conversions['float'](options.positionZ, {
|
|
112
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'positionZ' property from PannerOptions: The provided value (${options.positionZ}})`,
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
parsedOptions.positionZ = 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (options && options.orientationX !== undefined) {
|
|
119
|
+
parsedOptions.orientationX = conversions['float'](options.orientationX, {
|
|
120
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'orientationX' property from PannerOptions: The provided value (${options.orientationX}})`,
|
|
121
|
+
});
|
|
122
|
+
} else {
|
|
123
|
+
parsedOptions.orientationX = 1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (options && options.orientationY !== undefined) {
|
|
127
|
+
parsedOptions.orientationY = conversions['float'](options.orientationY, {
|
|
128
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'orientationY' property from PannerOptions: The provided value (${options.orientationY}})`,
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
parsedOptions.orientationY = 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (options && options.orientationZ !== undefined) {
|
|
135
|
+
parsedOptions.orientationZ = conversions['float'](options.orientationZ, {
|
|
136
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'orientationZ' property from PannerOptions: The provided value (${options.orientationZ}})`,
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
parsedOptions.orientationZ = 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (options && options.refDistance !== undefined) {
|
|
143
|
+
parsedOptions.refDistance = conversions['double'](options.refDistance, {
|
|
144
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'refDistance' property from PannerOptions: The provided value (${options.refDistance}})`,
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
parsedOptions.refDistance = 1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (options && options.maxDistance !== undefined) {
|
|
151
|
+
parsedOptions.maxDistance = conversions['double'](options.maxDistance, {
|
|
152
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'maxDistance' property from PannerOptions: The provided value (${options.maxDistance}})`,
|
|
153
|
+
});
|
|
154
|
+
} else {
|
|
155
|
+
parsedOptions.maxDistance = 10000;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (options && options.rolloffFactor !== undefined) {
|
|
159
|
+
parsedOptions.rolloffFactor = conversions['double'](options.rolloffFactor, {
|
|
160
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'rolloffFactor' property from PannerOptions: The provided value (${options.rolloffFactor}})`,
|
|
161
|
+
});
|
|
162
|
+
} else {
|
|
163
|
+
parsedOptions.rolloffFactor = 1;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (options && options.coneInnerAngle !== undefined) {
|
|
167
|
+
parsedOptions.coneInnerAngle = conversions['double'](options.coneInnerAngle, {
|
|
168
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'coneInnerAngle' property from PannerOptions: The provided value (${options.coneInnerAngle}})`,
|
|
169
|
+
});
|
|
170
|
+
} else {
|
|
171
|
+
parsedOptions.coneInnerAngle = 360;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (options && options.coneOuterAngle !== undefined) {
|
|
175
|
+
parsedOptions.coneOuterAngle = conversions['double'](options.coneOuterAngle, {
|
|
176
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'coneOuterAngle' property from PannerOptions: The provided value (${options.coneOuterAngle}})`,
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
parsedOptions.coneOuterAngle = 360;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (options && options.coneOuterGain !== undefined) {
|
|
183
|
+
parsedOptions.coneOuterGain = conversions['double'](options.coneOuterGain, {
|
|
184
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'coneOuterGain' property from PannerOptions: The provided value (${options.coneOuterGain}})`,
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
parsedOptions.coneOuterGain = 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (options && options.channelCount !== undefined) {
|
|
191
|
+
parsedOptions.channelCount = conversions['unsigned long'](options.channelCount, {
|
|
192
|
+
enforceRange: true,
|
|
193
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'channelCount' property from PannerOptions: The provided value '${options.channelCount}'`,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (options && options.channelCountMode !== undefined) {
|
|
198
|
+
parsedOptions.channelCountMode = conversions['DOMString'](options.channelCountMode, {
|
|
199
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'channelCount' property from PannerOptions: The provided value '${options.channelCountMode}'`,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (options && options.channelInterpretation !== undefined) {
|
|
204
|
+
parsedOptions.channelInterpretation = conversions['DOMString'](options.channelInterpretation, {
|
|
205
|
+
context: `Failed to construct 'PannerNode': Failed to read the 'channelInterpretation' property from PannerOptions: The provided value '${options.channelInterpretation}'`,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
let napiObj;
|
|
210
|
+
|
|
211
|
+
try {
|
|
212
|
+
napiObj = new nativeBinding.PannerNode(context[kNapiObj], parsedOptions);
|
|
213
|
+
} catch (err) {
|
|
214
|
+
throwSanitizedError(err);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
super(context, {
|
|
218
|
+
[kNapiObj]: napiObj,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
this.#positionX = new jsExport.AudioParam({
|
|
222
|
+
[kNapiObj]: this[kNapiObj].positionX,
|
|
223
|
+
});
|
|
224
|
+
this.#positionY = new jsExport.AudioParam({
|
|
225
|
+
[kNapiObj]: this[kNapiObj].positionY,
|
|
226
|
+
});
|
|
227
|
+
this.#positionZ = new jsExport.AudioParam({
|
|
228
|
+
[kNapiObj]: this[kNapiObj].positionZ,
|
|
229
|
+
});
|
|
230
|
+
this.#orientationX = new jsExport.AudioParam({
|
|
231
|
+
[kNapiObj]: this[kNapiObj].orientationX,
|
|
232
|
+
});
|
|
233
|
+
this.#orientationY = new jsExport.AudioParam({
|
|
234
|
+
[kNapiObj]: this[kNapiObj].orientationY,
|
|
235
|
+
});
|
|
236
|
+
this.#orientationZ = new jsExport.AudioParam({
|
|
237
|
+
[kNapiObj]: this[kNapiObj].orientationZ,
|
|
238
|
+
});
|
|
57
239
|
}
|
|
58
240
|
|
|
59
|
-
get
|
|
60
|
-
|
|
241
|
+
get positionX() {
|
|
242
|
+
if (!(this instanceof PannerNode)) {
|
|
243
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return this.#positionX;
|
|
61
247
|
}
|
|
62
248
|
|
|
63
|
-
get
|
|
64
|
-
|
|
249
|
+
get positionY() {
|
|
250
|
+
if (!(this instanceof PannerNode)) {
|
|
251
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return this.#positionY;
|
|
65
255
|
}
|
|
66
256
|
|
|
67
|
-
get
|
|
68
|
-
|
|
257
|
+
get positionZ() {
|
|
258
|
+
if (!(this instanceof PannerNode)) {
|
|
259
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return this.#positionZ;
|
|
69
263
|
}
|
|
70
264
|
|
|
71
|
-
get
|
|
72
|
-
|
|
265
|
+
get orientationX() {
|
|
266
|
+
if (!(this instanceof PannerNode)) {
|
|
267
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return this.#orientationX;
|
|
73
271
|
}
|
|
74
272
|
|
|
75
|
-
get
|
|
76
|
-
|
|
273
|
+
get orientationY() {
|
|
274
|
+
if (!(this instanceof PannerNode)) {
|
|
275
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return this.#orientationY;
|
|
77
279
|
}
|
|
78
280
|
|
|
79
|
-
get
|
|
80
|
-
|
|
281
|
+
get orientationZ() {
|
|
282
|
+
if (!(this instanceof PannerNode)) {
|
|
283
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return this.#orientationZ;
|
|
81
287
|
}
|
|
82
288
|
|
|
83
|
-
|
|
289
|
+
get panningModel() {
|
|
290
|
+
if (!(this instanceof PannerNode)) {
|
|
291
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return this[kNapiObj].panningModel;
|
|
295
|
+
}
|
|
84
296
|
|
|
85
297
|
set panningModel(value) {
|
|
298
|
+
if (!(this instanceof PannerNode)) {
|
|
299
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (!['equalpower', 'HRTF'].includes(value)) {
|
|
303
|
+
console.warn(`Failed to set the 'panningModel' property on 'PannerNode': Value '${value}' is not a valid 'PanningModelType' enum value`);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
86
307
|
try {
|
|
87
|
-
|
|
308
|
+
this[kNapiObj].panningModel = value;
|
|
88
309
|
} catch (err) {
|
|
89
310
|
throwSanitizedError(err);
|
|
90
311
|
}
|
|
91
312
|
}
|
|
92
313
|
|
|
314
|
+
get distanceModel() {
|
|
315
|
+
if (!(this instanceof PannerNode)) {
|
|
316
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return this[kNapiObj].distanceModel;
|
|
320
|
+
}
|
|
321
|
+
|
|
93
322
|
set distanceModel(value) {
|
|
323
|
+
if (!(this instanceof PannerNode)) {
|
|
324
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (!['linear', 'inverse', 'exponential'].includes(value)) {
|
|
328
|
+
console.warn(`Failed to set the 'distanceModel' property on 'PannerNode': Value '${value}' is not a valid 'DistanceModelType' enum value`);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
94
332
|
try {
|
|
95
|
-
|
|
333
|
+
this[kNapiObj].distanceModel = value;
|
|
96
334
|
} catch (err) {
|
|
97
335
|
throwSanitizedError(err);
|
|
98
336
|
}
|
|
99
337
|
}
|
|
100
338
|
|
|
339
|
+
get refDistance() {
|
|
340
|
+
if (!(this instanceof PannerNode)) {
|
|
341
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return this[kNapiObj].refDistance;
|
|
345
|
+
}
|
|
346
|
+
|
|
101
347
|
set refDistance(value) {
|
|
348
|
+
if (!(this instanceof PannerNode)) {
|
|
349
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
value = conversions['double'](value, {
|
|
353
|
+
context: `Failed to set the 'refDistance' property on 'PannerNode': Value`,
|
|
354
|
+
});
|
|
355
|
+
|
|
102
356
|
try {
|
|
103
|
-
|
|
357
|
+
this[kNapiObj].refDistance = value;
|
|
104
358
|
} catch (err) {
|
|
105
359
|
throwSanitizedError(err);
|
|
106
360
|
}
|
|
107
361
|
}
|
|
108
362
|
|
|
363
|
+
get maxDistance() {
|
|
364
|
+
if (!(this instanceof PannerNode)) {
|
|
365
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return this[kNapiObj].maxDistance;
|
|
369
|
+
}
|
|
370
|
+
|
|
109
371
|
set maxDistance(value) {
|
|
372
|
+
if (!(this instanceof PannerNode)) {
|
|
373
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
value = conversions['double'](value, {
|
|
377
|
+
context: `Failed to set the 'maxDistance' property on 'PannerNode': Value`,
|
|
378
|
+
});
|
|
379
|
+
|
|
110
380
|
try {
|
|
111
|
-
|
|
381
|
+
this[kNapiObj].maxDistance = value;
|
|
112
382
|
} catch (err) {
|
|
113
383
|
throwSanitizedError(err);
|
|
114
384
|
}
|
|
115
385
|
}
|
|
116
386
|
|
|
387
|
+
get rolloffFactor() {
|
|
388
|
+
if (!(this instanceof PannerNode)) {
|
|
389
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return this[kNapiObj].rolloffFactor;
|
|
393
|
+
}
|
|
394
|
+
|
|
117
395
|
set rolloffFactor(value) {
|
|
396
|
+
if (!(this instanceof PannerNode)) {
|
|
397
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
value = conversions['double'](value, {
|
|
401
|
+
context: `Failed to set the 'rolloffFactor' property on 'PannerNode': Value`,
|
|
402
|
+
});
|
|
403
|
+
|
|
118
404
|
try {
|
|
119
|
-
|
|
405
|
+
this[kNapiObj].rolloffFactor = value;
|
|
120
406
|
} catch (err) {
|
|
121
407
|
throwSanitizedError(err);
|
|
122
408
|
}
|
|
123
409
|
}
|
|
124
410
|
|
|
411
|
+
get coneInnerAngle() {
|
|
412
|
+
if (!(this instanceof PannerNode)) {
|
|
413
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return this[kNapiObj].coneInnerAngle;
|
|
417
|
+
}
|
|
418
|
+
|
|
125
419
|
set coneInnerAngle(value) {
|
|
420
|
+
if (!(this instanceof PannerNode)) {
|
|
421
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
value = conversions['double'](value, {
|
|
425
|
+
context: `Failed to set the 'coneInnerAngle' property on 'PannerNode': Value`,
|
|
426
|
+
});
|
|
427
|
+
|
|
126
428
|
try {
|
|
127
|
-
|
|
429
|
+
this[kNapiObj].coneInnerAngle = value;
|
|
128
430
|
} catch (err) {
|
|
129
431
|
throwSanitizedError(err);
|
|
130
432
|
}
|
|
131
433
|
}
|
|
132
434
|
|
|
435
|
+
get coneOuterAngle() {
|
|
436
|
+
if (!(this instanceof PannerNode)) {
|
|
437
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return this[kNapiObj].coneOuterAngle;
|
|
441
|
+
}
|
|
442
|
+
|
|
133
443
|
set coneOuterAngle(value) {
|
|
444
|
+
if (!(this instanceof PannerNode)) {
|
|
445
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
value = conversions['double'](value, {
|
|
449
|
+
context: `Failed to set the 'coneOuterAngle' property on 'PannerNode': Value`,
|
|
450
|
+
});
|
|
451
|
+
|
|
134
452
|
try {
|
|
135
|
-
|
|
453
|
+
this[kNapiObj].coneOuterAngle = value;
|
|
136
454
|
} catch (err) {
|
|
137
455
|
throwSanitizedError(err);
|
|
138
456
|
}
|
|
139
457
|
}
|
|
140
458
|
|
|
459
|
+
get coneOuterGain() {
|
|
460
|
+
if (!(this instanceof PannerNode)) {
|
|
461
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return this[kNapiObj].coneOuterGain;
|
|
465
|
+
}
|
|
466
|
+
|
|
141
467
|
set coneOuterGain(value) {
|
|
468
|
+
if (!(this instanceof PannerNode)) {
|
|
469
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
value = conversions['double'](value, {
|
|
473
|
+
context: `Failed to set the 'coneOuterGain' property on 'PannerNode': Value`,
|
|
474
|
+
});
|
|
475
|
+
|
|
142
476
|
try {
|
|
143
|
-
|
|
477
|
+
this[kNapiObj].coneOuterGain = value;
|
|
144
478
|
} catch (err) {
|
|
145
479
|
throwSanitizedError(err);
|
|
146
480
|
}
|
|
147
481
|
}
|
|
148
482
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
483
|
+
setPosition(x, y, z) {
|
|
484
|
+
if (!(this instanceof PannerNode)) {
|
|
485
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
if (arguments.length < 3) {
|
|
489
|
+
throw new TypeError(`Failed to execute 'setPosition' on 'PannerNode': 3 argument required, but only ${arguments.length} present`);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
x = conversions['float'](x, {
|
|
493
|
+
context: `Failed to execute 'setPosition' on 'PannerNode': Parameter 1`,
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
y = conversions['float'](y, {
|
|
497
|
+
context: `Failed to execute 'setPosition' on 'PannerNode': Parameter 2`,
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
z = conversions['float'](z, {
|
|
501
|
+
context: `Failed to execute 'setPosition' on 'PannerNode': Parameter 3`,
|
|
502
|
+
});
|
|
503
|
+
|
|
152
504
|
try {
|
|
153
|
-
return
|
|
505
|
+
return this[kNapiObj].setPosition(x, y, z);
|
|
154
506
|
} catch (err) {
|
|
155
507
|
throwSanitizedError(err);
|
|
156
508
|
}
|
|
157
509
|
}
|
|
158
510
|
|
|
159
|
-
setOrientation(
|
|
511
|
+
setOrientation(x, y, z) {
|
|
512
|
+
if (!(this instanceof PannerNode)) {
|
|
513
|
+
throw new TypeError('Invalid Invocation: Value of \'this\' must be of type \'PannerNode\'');
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if (arguments.length < 3) {
|
|
517
|
+
throw new TypeError(`Failed to execute 'setOrientation' on 'PannerNode': 3 argument required, but only ${arguments.length} present`);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
x = conversions['float'](x, {
|
|
521
|
+
context: `Failed to execute 'setOrientation' on 'PannerNode': Parameter 1`,
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
y = conversions['float'](y, {
|
|
525
|
+
context: `Failed to execute 'setOrientation' on 'PannerNode': Parameter 2`,
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
z = conversions['float'](z, {
|
|
529
|
+
context: `Failed to execute 'setOrientation' on 'PannerNode': Parameter 3`,
|
|
530
|
+
});
|
|
531
|
+
|
|
160
532
|
try {
|
|
161
|
-
return
|
|
533
|
+
return this[kNapiObj].setOrientation(x, y, z);
|
|
162
534
|
} catch (err) {
|
|
163
535
|
throwSanitizedError(err);
|
|
164
536
|
}
|
|
@@ -166,8 +538,41 @@ module.exports = (NativePannerNode) => {
|
|
|
166
538
|
|
|
167
539
|
}
|
|
168
540
|
|
|
169
|
-
|
|
170
|
-
|
|
541
|
+
Object.defineProperties(PannerNode, {
|
|
542
|
+
length: {
|
|
543
|
+
__proto__: null,
|
|
544
|
+
writable: false,
|
|
545
|
+
enumerable: false,
|
|
546
|
+
configurable: true,
|
|
547
|
+
value: 1,
|
|
548
|
+
},
|
|
549
|
+
});
|
|
171
550
|
|
|
551
|
+
Object.defineProperties(PannerNode.prototype, {
|
|
552
|
+
[Symbol.toStringTag]: {
|
|
553
|
+
__proto__: null,
|
|
554
|
+
writable: false,
|
|
555
|
+
enumerable: false,
|
|
556
|
+
configurable: true,
|
|
557
|
+
value: 'PannerNode',
|
|
558
|
+
},
|
|
559
|
+
positionX: kEnumerableProperty,
|
|
560
|
+
positionY: kEnumerableProperty,
|
|
561
|
+
positionZ: kEnumerableProperty,
|
|
562
|
+
orientationX: kEnumerableProperty,
|
|
563
|
+
orientationY: kEnumerableProperty,
|
|
564
|
+
orientationZ: kEnumerableProperty,
|
|
565
|
+
panningModel: kEnumerableProperty,
|
|
566
|
+
distanceModel: kEnumerableProperty,
|
|
567
|
+
refDistance: kEnumerableProperty,
|
|
568
|
+
maxDistance: kEnumerableProperty,
|
|
569
|
+
rolloffFactor: kEnumerableProperty,
|
|
570
|
+
coneInnerAngle: kEnumerableProperty,
|
|
571
|
+
coneOuterAngle: kEnumerableProperty,
|
|
572
|
+
coneOuterGain: kEnumerableProperty,
|
|
573
|
+
setPosition: kEnumerableProperty,
|
|
574
|
+
setOrientation: kEnumerableProperty,
|
|
575
|
+
});
|
|
172
576
|
|
|
173
|
-
|
|
577
|
+
return PannerNode;
|
|
578
|
+
};
|