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/lib/errors.js
CHANGED
|
@@ -4,58 +4,6 @@ const path = require('path');
|
|
|
4
4
|
const internalPath = path.join('node-web-audio-api', 'js');
|
|
5
5
|
const internalRe = new RegExp(internalPath);
|
|
6
6
|
|
|
7
|
-
// from wpt/resources/tesharness.js (line 2226)
|
|
8
|
-
const nameCodeMap = {
|
|
9
|
-
IndexSizeError: 1,
|
|
10
|
-
HierarchyRequestError: 3,
|
|
11
|
-
WrongDocumentError: 4,
|
|
12
|
-
InvalidCharacterError: 5,
|
|
13
|
-
NoModificationAllowedError: 7,
|
|
14
|
-
NotFoundError: 8,
|
|
15
|
-
NotSupportedError: 9,
|
|
16
|
-
InUseAttributeError: 10,
|
|
17
|
-
InvalidStateError: 11,
|
|
18
|
-
SyntaxError: 12,
|
|
19
|
-
InvalidModificationError: 13,
|
|
20
|
-
NamespaceError: 14,
|
|
21
|
-
InvalidAccessError: 15,
|
|
22
|
-
TypeMismatchError: 17,
|
|
23
|
-
SecurityError: 18,
|
|
24
|
-
NetworkError: 19,
|
|
25
|
-
AbortError: 20,
|
|
26
|
-
URLMismatchError: 21,
|
|
27
|
-
QuotaExceededError: 22,
|
|
28
|
-
TimeoutError: 23,
|
|
29
|
-
InvalidNodeTypeError: 24,
|
|
30
|
-
DataCloneError: 25,
|
|
31
|
-
|
|
32
|
-
EncodingError: 0,
|
|
33
|
-
NotReadableError: 0,
|
|
34
|
-
UnknownError: 0,
|
|
35
|
-
ConstraintError: 0,
|
|
36
|
-
DataError: 0,
|
|
37
|
-
TransactionInactiveError: 0,
|
|
38
|
-
ReadOnlyError: 0,
|
|
39
|
-
VersionError: 0,
|
|
40
|
-
OperationError: 0,
|
|
41
|
-
NotAllowedError: 0,
|
|
42
|
-
OptOutError: 0
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
exports.nameCodeMap = nameCodeMap;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class DOMException extends Error {
|
|
49
|
-
constructor(message, name) {
|
|
50
|
-
super(message);
|
|
51
|
-
|
|
52
|
-
this.name = name;
|
|
53
|
-
this.code = nameCodeMap[this.name];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
exports.DOMException = DOMException;
|
|
58
|
-
|
|
59
7
|
function overrideStack(originalError, newError) {
|
|
60
8
|
// override previous error message
|
|
61
9
|
const stack = originalError.stack.replace(originalError.message, newError.message);
|
|
@@ -87,6 +35,7 @@ exports.throwSanitizedError = function throwSanitizedError(err) {
|
|
|
87
35
|
if (originalMessage.startsWith('TypeError')) {
|
|
88
36
|
const msg = originalMessage.replace(/^TypeError - /, '');
|
|
89
37
|
const error = new TypeError(msg);
|
|
38
|
+
overrideStack(err, error);
|
|
90
39
|
|
|
91
40
|
throw error;
|
|
92
41
|
} else if (originalMessage.startsWith('RangeError')) {
|
|
@@ -110,20 +59,26 @@ exports.throwSanitizedError = function throwSanitizedError(err) {
|
|
|
110
59
|
overrideStack(err, error);
|
|
111
60
|
|
|
112
61
|
throw error;
|
|
113
|
-
} if (originalMessage.startsWith('IndexSizeError')) {
|
|
62
|
+
} else if (originalMessage.startsWith('IndexSizeError')) {
|
|
114
63
|
const msg = originalMessage.replace(/^IndexSizeError - /, '');
|
|
115
64
|
const error = new DOMException(msg, 'IndexSizeError');
|
|
116
65
|
overrideStack(err, error);
|
|
117
66
|
|
|
118
67
|
throw error;
|
|
119
|
-
} if (originalMessage.startsWith('InvalidAccessError')) {
|
|
68
|
+
} else if (originalMessage.startsWith('InvalidAccessError')) {
|
|
120
69
|
const msg = originalMessage.replace(/^InvalidAccessError - /, '');
|
|
121
70
|
const error = new DOMException(msg, 'InvalidAccessError');
|
|
122
71
|
overrideStack(err, error);
|
|
123
72
|
|
|
73
|
+
throw error;
|
|
74
|
+
} else if (originalMessage.startsWith('NotFoundError')) {
|
|
75
|
+
const msg = originalMessage.replace(/^NotFoundError - /, '');
|
|
76
|
+
const error = new DOMException(msg, 'NotFoundError');
|
|
77
|
+
overrideStack(err, error);
|
|
78
|
+
|
|
124
79
|
throw error;
|
|
125
80
|
}
|
|
126
81
|
|
|
127
|
-
console.warn('[lib/errors.js]
|
|
82
|
+
console.warn('[lib/errors.js] Unexpected Rust error', err);
|
|
128
83
|
throw err;
|
|
129
84
|
}
|
package/js/lib/events.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const { isFunction } = require('./utils.js');
|
|
2
|
+
|
|
3
|
+
module.exports.propagateEvent = function propagateEvent(eventTarget, event) {
|
|
4
|
+
// call attribute first if exists
|
|
5
|
+
if (isFunction(eventTarget[`on${event.type}`])) {
|
|
6
|
+
eventTarget[`on${event.type}`](event);
|
|
7
|
+
}
|
|
8
|
+
// then distach to add event listeners
|
|
9
|
+
eventTarget.dispatchEvent(event);
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module.exports.kNapiObj = Symbol('node-web-audio-api:napi-obj');
|
|
2
|
+
module.exports.kAudioBuffer = Symbol('node-web-audio-api:audio-buffer');
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
// semi-private keys for events listeners
|
|
6
|
+
|
|
7
|
+
// # BaseAudioContext
|
|
8
|
+
module.exports.kOnStateChange = Symbol.for('node-web-audio-api:onstatechange');
|
|
9
|
+
// AudioContext
|
|
10
|
+
module.exports.kOnSinkChange = Symbol.for('node-web-audio-api:onsinkchange');
|
|
11
|
+
// # OfflineAudioContext
|
|
12
|
+
// > [The onstatechange] event is fired before the complete event is fired
|
|
13
|
+
// cf. https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange
|
|
14
|
+
// @fixme: for now the `complete` event is triggered **before** startRenring fulfills
|
|
15
|
+
module.exports.kOnComplete = Symbol.for('node-web-audio-api:oncomplete');
|
|
16
|
+
// # AudioScheduledSourceNode
|
|
17
|
+
module.exports.kOnEnded = Symbol.for('node-web-audio-api:onended');
|
|
18
|
+
// # ScriptProcessorNode
|
|
19
|
+
module.exports.kOnAudioProcess = Symbol.for('node-web-audio-api:onaudioprocess');
|
|
20
|
+
|
package/js/lib/utils.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
exports.isPlainObject = function isPlainObject(obj) {
|
|
2
|
-
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
exports.isPositiveInt = function isPositiveInt(n) {
|
|
6
|
-
return Number.isSafeInteger(n) && 0 < n;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
exports.isPositiveNumber = function isPositiveNumber(n) {
|
|
10
|
-
return Number(n) === n && 0 < n;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
1
|
exports.isFunction = function isFunction(val) {
|
|
14
2
|
return Object.prototype.toString.call(val) == '[object Function]' ||
|
|
15
3
|
Object.prototype.toString.call(val) == '[object AsyncFunction]';
|
|
16
4
|
};
|
|
5
|
+
|
|
6
|
+
const kEnumerableProperty = { __proto__: null };
|
|
7
|
+
kEnumerableProperty.enumerable = true;
|
|
8
|
+
Object.freeze(kEnumerableProperty);
|
|
9
|
+
|
|
10
|
+
exports.kEnumerableProperty = kEnumerableProperty;
|
|
11
|
+
|
|
12
|
+
const kHiddenProperty = { __proto__: null };
|
|
13
|
+
kHiddenProperty.enumerable = false;
|
|
14
|
+
Object.freeze(kHiddenProperty);
|
|
15
|
+
|
|
16
|
+
exports.kHiddenProperty = kHiddenProperty;
|
package/js/monkey-patch.js
CHANGED
|
@@ -18,48 +18,60 @@
|
|
|
18
18
|
// -------------------------------------------------------------------------- //
|
|
19
19
|
|
|
20
20
|
module.exports = function monkeyPatch(nativeBinding) {
|
|
21
|
+
let jsExport = {};
|
|
22
|
+
|
|
21
23
|
// --------------------------------------------------------------------------
|
|
22
|
-
//
|
|
24
|
+
// Events
|
|
23
25
|
// --------------------------------------------------------------------------
|
|
26
|
+
jsExport.OfflineAudioCompletionEvent = require('./Events').OfflineAudioCompletionEvent;
|
|
27
|
+
jsExport.AudioProcessingEvent = require('./Events').AudioProcessingEvent;
|
|
28
|
+
// --------------------------------------------------------------------------
|
|
29
|
+
// Create Web Audio API facade
|
|
30
|
+
// --------------------------------------------------------------------------
|
|
31
|
+
jsExport.BaseAudioContext = require('./BaseAudioContext.js')(jsExport, nativeBinding);
|
|
32
|
+
jsExport.AudioContext = require('./AudioContext.js')(jsExport, nativeBinding);
|
|
33
|
+
jsExport.OfflineAudioContext = require('./OfflineAudioContext.js')(jsExport, nativeBinding);
|
|
24
34
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// @todo - wrap AudioBuffer interface as well
|
|
43
|
-
nativeBinding.PeriodicWave = require('./PeriodicWave.js')(nativeBinding.PeriodicWave);
|
|
35
|
+
jsExport.ScriptProcessorNode = require('./ScriptProcessorNode.js')(jsExport, nativeBinding);
|
|
36
|
+
jsExport.AnalyserNode = require('./AnalyserNode.js')(jsExport, nativeBinding);
|
|
37
|
+
jsExport.AudioBufferSourceNode = require('./AudioBufferSourceNode.js')(jsExport, nativeBinding);
|
|
38
|
+
jsExport.BiquadFilterNode = require('./BiquadFilterNode.js')(jsExport, nativeBinding);
|
|
39
|
+
jsExport.ChannelMergerNode = require('./ChannelMergerNode.js')(jsExport, nativeBinding);
|
|
40
|
+
jsExport.ChannelSplitterNode = require('./ChannelSplitterNode.js')(jsExport, nativeBinding);
|
|
41
|
+
jsExport.ConstantSourceNode = require('./ConstantSourceNode.js')(jsExport, nativeBinding);
|
|
42
|
+
jsExport.ConvolverNode = require('./ConvolverNode.js')(jsExport, nativeBinding);
|
|
43
|
+
jsExport.DelayNode = require('./DelayNode.js')(jsExport, nativeBinding);
|
|
44
|
+
jsExport.DynamicsCompressorNode = require('./DynamicsCompressorNode.js')(jsExport, nativeBinding);
|
|
45
|
+
jsExport.GainNode = require('./GainNode.js')(jsExport, nativeBinding);
|
|
46
|
+
jsExport.IIRFilterNode = require('./IIRFilterNode.js')(jsExport, nativeBinding);
|
|
47
|
+
jsExport.MediaStreamAudioSourceNode = require('./MediaStreamAudioSourceNode.js')(jsExport, nativeBinding);
|
|
48
|
+
jsExport.OscillatorNode = require('./OscillatorNode.js')(jsExport, nativeBinding);
|
|
49
|
+
jsExport.PannerNode = require('./PannerNode.js')(jsExport, nativeBinding);
|
|
50
|
+
jsExport.StereoPannerNode = require('./StereoPannerNode.js')(jsExport, nativeBinding);
|
|
51
|
+
jsExport.WaveShaperNode = require('./WaveShaperNode.js')(jsExport, nativeBinding);
|
|
44
52
|
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
jsExport.AudioNode = require('./AudioNode.js');
|
|
54
|
+
jsExport.AudioScheduledSourceNode = require('./AudioScheduledSourceNode.js');
|
|
55
|
+
jsExport.AudioParam = require('./AudioParam.js');
|
|
56
|
+
jsExport.AudioDestinationNode = require('./AudioDestinationNode.js');
|
|
57
|
+
jsExport.AudioListener = require('./AudioListener.js');
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
nativeBinding.AudioDestinationNode = require('./AudioDestinationNode.js').AudioDestinationNode;
|
|
59
|
+
jsExport.PeriodicWave = require('./PeriodicWave.js')(jsExport, nativeBinding);
|
|
60
|
+
jsExport.AudioBuffer = require('./AudioBuffer.js')(jsExport, nativeBinding);
|
|
51
61
|
|
|
52
62
|
// --------------------------------------------------------------------------
|
|
53
63
|
// Promisify MediaDevices API
|
|
54
64
|
// --------------------------------------------------------------------------
|
|
65
|
+
jsExport.mediaDevices = {};
|
|
66
|
+
|
|
55
67
|
const enumerateDevicesSync = nativeBinding.mediaDevices.enumerateDevices;
|
|
56
|
-
|
|
68
|
+
jsExport.mediaDevices.enumerateDevices = async function enumerateDevices() {
|
|
57
69
|
const list = enumerateDevicesSync();
|
|
58
70
|
return Promise.resolve(list);
|
|
59
71
|
};
|
|
60
72
|
|
|
61
73
|
const getUserMediaSync = nativeBinding.mediaDevices.getUserMedia;
|
|
62
|
-
|
|
74
|
+
jsExport.mediaDevices.getUserMedia = async function getUserMedia(options) {
|
|
63
75
|
if (options === undefined) {
|
|
64
76
|
throw new TypeError('Failed to execute "getUserMedia" on "MediaDevices": audio must be requested');
|
|
65
77
|
}
|
|
@@ -68,8 +80,5 @@ module.exports = function monkeyPatch(nativeBinding) {
|
|
|
68
80
|
return Promise.resolve(stream);
|
|
69
81
|
};
|
|
70
82
|
|
|
71
|
-
return
|
|
83
|
+
return jsExport;
|
|
72
84
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-web-audio-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"author": "Benjamin Matuszewski",
|
|
5
5
|
"description": "Node.js bindings for web-audio-api-rs using napi-rs",
|
|
6
6
|
"exports": {
|
|
@@ -44,13 +44,14 @@
|
|
|
44
44
|
"lint": "npx eslint index.cjs index.mjs && npx eslint js/*.js && npx eslint examples/*.mjs",
|
|
45
45
|
"preversion": "yarn install && npm run generate",
|
|
46
46
|
"postversion": "cargo bump $npm_package_version && git commit -am \"v$npm_package_version\" && node .scripts/check-changelog.mjs",
|
|
47
|
-
"test": "mocha",
|
|
47
|
+
"test": "mocha tests",
|
|
48
48
|
"wpt": "npm run build && node ./.scripts/wpt-harness.mjs",
|
|
49
49
|
"wpt:only": "node ./.scripts/wpt-harness.mjs"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@ircam/eslint-config": "^1.3.0",
|
|
53
53
|
"@ircam/sc-gettime": "^1.0.0",
|
|
54
|
+
"@ircam/sc-utils": "^1.3.3",
|
|
54
55
|
"@sindresorhus/slugify": "^2.1.1",
|
|
55
56
|
"camelcase": "^7.0.1",
|
|
56
57
|
"chai": "^4.3.7",
|
|
@@ -58,7 +59,8 @@
|
|
|
58
59
|
"cli-table": "^0.3.11",
|
|
59
60
|
"commander": "^11.1.0",
|
|
60
61
|
"dotenv": "^16.0.3",
|
|
61
|
-
"eslint": "^8.
|
|
62
|
+
"eslint": "^8.57.0",
|
|
63
|
+
"js-beautify": "^1.15.1",
|
|
62
64
|
"mocha": "^10.2.0",
|
|
63
65
|
"node-ssh": "^13.0.0",
|
|
64
66
|
"octokit": "^2.0.11",
|
|
@@ -70,6 +72,7 @@
|
|
|
70
72
|
},
|
|
71
73
|
"dependencies": {
|
|
72
74
|
"@napi-rs/cli": "^2.14.3",
|
|
73
|
-
"@node-rs/helper": "^1.3.3"
|
|
75
|
+
"@node-rs/helper": "^1.3.3",
|
|
76
|
+
"webidl-conversions": "^7.0.0"
|
|
74
77
|
}
|
|
75
78
|
}
|
package/run-wpt.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
create file run-wpt.sh and chmod +x run-wpt.sh:
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
#!/bin/bash
|
|
5
|
+
echo $1
|
|
6
|
+
echo ~~~~~~~~~~~~~~~~~
|
|
7
|
+
node ./.scripts/wpt-harness.mjs --filter "$1" 2>&1 | grep -A 3 RESULTS
|
|
8
|
+
echo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
dissect the full suite per directory:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
ls wpt/webaudio/the-audio-api | xargs -I {} ./run-wpt.sh {}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
check the specific file results in a dir:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
ls wpt/webaudio/the-audio-api/the-oscillatornode-interface | xargs -I {} ./run-wpt.sh {}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
ls wpt/webaudio/the-audio-api/the-audiocontext-interface | xargs -I {} ./run-wpt.sh {}
|
|
24
|
+
|
|
25
|
+
processing-model
|
|
26
|
+
|
|
27
|
+
ls wpt/webaudio/the-audio-api/processing-model | xargs -I {} ./run-wpt.sh {}
|
package/run-wpt.sh
ADDED
package/js/AudioNode.mixin.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
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
|
-
const { throwSanitizedError } = require('./lib/errors.js');
|
|
21
|
-
|
|
22
|
-
const { AudioParam, kNativeAudioParam } = require('./AudioParam.js');
|
|
23
|
-
const { AudioDestinationNode, kNativeAudioDestinationNode } = require('./AudioDestinationNode.js');
|
|
24
|
-
|
|
25
|
-
module.exports = (superclass) => {
|
|
26
|
-
class AudioNode extends superclass {
|
|
27
|
-
/* eslint-disable constructor-super */
|
|
28
|
-
constructor(...args) {
|
|
29
|
-
try {
|
|
30
|
-
super(...args);
|
|
31
|
-
} catch (err) {
|
|
32
|
-
throwSanitizedError(err);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/* eslint-enable constructor-super */
|
|
36
|
-
|
|
37
|
-
// getters
|
|
38
|
-
|
|
39
|
-
get context() {
|
|
40
|
-
return super.context;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
get numberOfInputs() {
|
|
44
|
-
return super.numberOfInputs;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get numberOfOutputs() {
|
|
48
|
-
return super.numberOfOutputs;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get channelCount() {
|
|
52
|
-
return super.channelCount;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get channelCountMode() {
|
|
56
|
-
return super.channelCountMode;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get channelInterpretation() {
|
|
60
|
-
return super.channelInterpretation;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// setters
|
|
64
|
-
|
|
65
|
-
set channelCount(value) {
|
|
66
|
-
try {
|
|
67
|
-
super.channelCount = value;
|
|
68
|
-
} catch (err) {
|
|
69
|
-
throwSanitizedError(err);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
set channelCountMode(value) {
|
|
74
|
-
try {
|
|
75
|
-
super.channelCountMode = value;
|
|
76
|
-
} catch (err) {
|
|
77
|
-
throwSanitizedError(err);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
set channelInterpretation(value) {
|
|
82
|
-
try {
|
|
83
|
-
super.channelInterpretation = value;
|
|
84
|
-
} catch (err) {
|
|
85
|
-
throwSanitizedError(err);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// methods - connect / disconnect
|
|
90
|
-
|
|
91
|
-
connect(...args) {
|
|
92
|
-
// unwrap raw audio params from facade
|
|
93
|
-
if (args[0] instanceof AudioParam) {
|
|
94
|
-
args[0] = args[0][kNativeAudioParam];
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// unwrap raw audio destination from facade
|
|
98
|
-
if (args[0] instanceof AudioDestinationNode) {
|
|
99
|
-
args[0] = args[0][kNativeAudioDestinationNode];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
return super.connect(...args);
|
|
104
|
-
} catch (err) {
|
|
105
|
-
throwSanitizedError(err);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
disconnect(...args) {
|
|
110
|
-
// unwrap raw audio params from facade
|
|
111
|
-
if (args[0] instanceof AudioParam) {
|
|
112
|
-
args[0] = args[0][kNativeAudioParam];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// unwrap raw audio destination from facade
|
|
116
|
-
if (args[0] instanceof AudioDestinationNode) {
|
|
117
|
-
args[0] = args[0][kNativeAudioDestinationNode];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
return super.disconnect(...args);
|
|
122
|
-
} catch (err) {
|
|
123
|
-
throwSanitizedError(err);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return AudioNode;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
|
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
const { throwSanitizedError } = require('./lib/errors.js');
|
|
21
|
-
|
|
22
|
-
module.exports = (superclass) => {
|
|
23
|
-
class AudioScheduledSourceNode extends superclass {
|
|
24
|
-
constructor(...args) {
|
|
25
|
-
super(...args);
|
|
26
|
-
}
|
|
27
|
-
// getters
|
|
28
|
-
|
|
29
|
-
get onended() {
|
|
30
|
-
return super.onended;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// setters
|
|
34
|
-
|
|
35
|
-
set onended(value) {
|
|
36
|
-
try {
|
|
37
|
-
super.onended = value;
|
|
38
|
-
} catch (err) {
|
|
39
|
-
throwSanitizedError(err);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// methods - start / stop
|
|
44
|
-
|
|
45
|
-
start(...args) {
|
|
46
|
-
try {
|
|
47
|
-
return super.start(...args);
|
|
48
|
-
} catch (err) {
|
|
49
|
-
throwSanitizedError(err);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
stop(...args) {
|
|
54
|
-
try {
|
|
55
|
-
return super.stop(...args);
|
|
56
|
-
} catch (err) {
|
|
57
|
-
throwSanitizedError(err);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return AudioScheduledSourceNode;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|