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