@grame/faustwasm 0.12.0 → 0.12.2
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/assets/standalone/faustwasm/index.d.ts +1 -1
- package/assets/standalone/faustwasm/index.js +201 -335
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +203 -338
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +1 -1
- package/dist/cjs-bundle/index.js +385 -687
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +201 -335
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +1 -1
- package/dist/esm-bundle/index.js +385 -687
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +2 -3
- package/src/FaustDspGenerator.ts +2 -1
- package/src/FaustWebAudioDsp.ts +2 -2
- package/src/SoundfileReader.ts +3 -3
- package/src/types.ts +1 -1
- package/test/faustlive-wasm/faustwasm/index.d.ts +1 -1
- package/test/faustlive-wasm/faustwasm/index.js +201 -335
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/organ/create-node.js +252 -0
- package/test/organ/dsp-meta.json +131 -0
- package/test/organ/dsp-module.wasm +0 -0
- package/test/organ/faust-pwa.js +344 -0
- package/test/organ/faust-ui/index.css +442 -0
- package/test/organ/faust-ui/index.css.map +1 -0
- package/test/organ/faust-ui/index.d.ts +1 -0
- package/test/organ/faust-ui/index.js +3756 -0
- package/test/organ/faust-ui/index.js.map +1 -0
- package/test/organ/faustwasm/index.d.ts +1705 -0
- package/test/organ/faustwasm/index.js +4773 -0
- package/test/organ/faustwasm/index.js.map +7 -0
- package/test/organ/icon.png +0 -0
- package/test/organ/index.html +76 -0
- package/test/organ/index.js +69 -0
- package/test/organ/manifest.json +17 -0
- package/test/organ/service-worker.js +165 -0
package/dist/cjs-bundle/index.js
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
8
11
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
12
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
13
|
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined")
|
|
12
|
-
return require.apply(this, arguments);
|
|
14
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
15
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
16
|
});
|
|
15
17
|
var __commonJS = (cb, mod) => function __require2() {
|
|
@@ -35,28 +37,13 @@
|
|
|
35
37
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
36
38
|
mod
|
|
37
39
|
));
|
|
38
|
-
var __accessCheck = (obj, member, msg) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var __privateGet = (obj, member, getter) => {
|
|
43
|
-
__accessCheck(obj, member, "read from private field");
|
|
44
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
45
|
-
};
|
|
46
|
-
var __privateAdd = (obj, member, value) => {
|
|
47
|
-
if (member.has(obj))
|
|
48
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
49
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
50
|
-
};
|
|
51
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
52
|
-
__accessCheck(obj, member, "write to private field");
|
|
53
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
54
|
-
return value;
|
|
55
|
-
};
|
|
40
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
41
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
42
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
43
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
56
44
|
var __toBinary = /* @__PURE__ */ (() => {
|
|
57
45
|
var table = new Uint8Array(128);
|
|
58
|
-
for (var i = 0; i < 64; i++)
|
|
59
|
-
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
46
|
+
for (var i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
60
47
|
return (base64) => {
|
|
61
48
|
var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);
|
|
62
49
|
for (var i2 = 0, j = 0; i2 < n; ) {
|
|
@@ -75,9 +62,8 @@
|
|
|
75
62
|
"libfaust-wasm/libfaust-wasm.cjs"(exports, module) {
|
|
76
63
|
var FaustModule = (() => {
|
|
77
64
|
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : void 0;
|
|
78
|
-
if (typeof __filename !== "undefined")
|
|
79
|
-
|
|
80
|
-
return function(FaustModule2 = {}) {
|
|
65
|
+
if (typeof __filename !== "undefined") _scriptDir = _scriptDir || __filename;
|
|
66
|
+
return (function(FaustModule2 = {}) {
|
|
81
67
|
var Module = typeof FaustModule2 != "undefined" ? FaustModule2 : {};
|
|
82
68
|
var readyPromiseResolve, readyPromiseReject;
|
|
83
69
|
Module["ready"] = new Promise(function(resolve, reject) {
|
|
@@ -94,8 +80,7 @@
|
|
|
94
80
|
}
|
|
95
81
|
Module.expectedDataFileDownloads++;
|
|
96
82
|
(function() {
|
|
97
|
-
if (Module["ENVIRONMENT_IS_PTHREAD"])
|
|
98
|
-
return;
|
|
83
|
+
if (Module["ENVIRONMENT_IS_PTHREAD"]) return;
|
|
99
84
|
var loadPackage = function(metadata) {
|
|
100
85
|
var PACKAGE_PATH = "";
|
|
101
86
|
if (typeof window === "object") {
|
|
@@ -128,13 +113,11 @@
|
|
|
128
113
|
xhr.onprogress = function(event) {
|
|
129
114
|
var url = packageName;
|
|
130
115
|
var size = packageSize;
|
|
131
|
-
if (event.total)
|
|
132
|
-
size = event.total;
|
|
116
|
+
if (event.total) size = event.total;
|
|
133
117
|
if (event.loaded) {
|
|
134
118
|
if (!xhr.addedTotal) {
|
|
135
119
|
xhr.addedTotal = true;
|
|
136
|
-
if (!Module.dataFileDownloads)
|
|
137
|
-
Module.dataFileDownloads = {};
|
|
120
|
+
if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
|
|
138
121
|
Module.dataFileDownloads[url] = { loaded: event.loaded, total: size };
|
|
139
122
|
} else {
|
|
140
123
|
Module.dataFileDownloads[url].loaded = event.loaded;
|
|
@@ -149,11 +132,9 @@
|
|
|
149
132
|
num++;
|
|
150
133
|
}
|
|
151
134
|
total = Math.ceil(total * Module.expectedDataFileDownloads / num);
|
|
152
|
-
if (Module["setStatus"])
|
|
153
|
-
Module["setStatus"]("Downloading data... (" + loaded + "/" + total + ")");
|
|
135
|
+
if (Module["setStatus"]) Module["setStatus"]("Downloading data... (" + loaded + "/" + total + ")");
|
|
154
136
|
} else if (!Module.dataFileDownloads) {
|
|
155
|
-
if (Module["setStatus"])
|
|
156
|
-
Module["setStatus"]("Downloading data...");
|
|
137
|
+
if (Module["setStatus"]) Module["setStatus"]("Downloading data...");
|
|
157
138
|
}
|
|
158
139
|
};
|
|
159
140
|
xhr.onerror = function(event) {
|
|
@@ -174,19 +155,17 @@
|
|
|
174
155
|
}
|
|
175
156
|
var fetchedCallback = null;
|
|
176
157
|
var fetched = Module["getPreloadedPackage"] ? Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
|
|
177
|
-
if (!fetched)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}, handleError);
|
|
158
|
+
if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
|
|
159
|
+
if (fetchedCallback) {
|
|
160
|
+
fetchedCallback(data);
|
|
161
|
+
fetchedCallback = null;
|
|
162
|
+
} else {
|
|
163
|
+
fetched = data;
|
|
164
|
+
}
|
|
165
|
+
}, handleError);
|
|
186
166
|
function runWithFS() {
|
|
187
167
|
function assert2(check, msg) {
|
|
188
|
-
if (!check)
|
|
189
|
-
throw msg + new Error().stack;
|
|
168
|
+
if (!check) throw msg + new Error().stack;
|
|
190
169
|
}
|
|
191
170
|
Module["FS_createPath"]("/", "usr", true, true);
|
|
192
171
|
Module["FS_createPath"]("/usr", "rsrc", true, true);
|
|
@@ -227,8 +206,7 @@
|
|
|
227
206
|
Module["removeRunDependency"]("datafile_libfaust-wasm.data");
|
|
228
207
|
}
|
|
229
208
|
Module["addRunDependency"]("datafile_libfaust-wasm.data");
|
|
230
|
-
if (!Module.preloadResults)
|
|
231
|
-
Module.preloadResults = {};
|
|
209
|
+
if (!Module.preloadResults) Module.preloadResults = {};
|
|
232
210
|
Module.preloadResults[PACKAGE_NAME] = { fromCache: false };
|
|
233
211
|
if (fetched) {
|
|
234
212
|
processPackageData(fetched);
|
|
@@ -240,21 +218,17 @@
|
|
|
240
218
|
if (Module["calledRun"]) {
|
|
241
219
|
runWithFS();
|
|
242
220
|
} else {
|
|
243
|
-
if (!Module["preRun"])
|
|
244
|
-
Module["preRun"] = [];
|
|
221
|
+
if (!Module["preRun"]) Module["preRun"] = [];
|
|
245
222
|
Module["preRun"].push(runWithFS);
|
|
246
223
|
}
|
|
247
224
|
};
|
|
248
225
|
loadPackage({ "files": [{ "filename": "/usr/.DS_Store", "start": 0, "end": 8196 }, { "filename": "/usr/rsrc/mixer32.wasm", "start": 8196, "end": 8698 }, { "filename": "/usr/rsrc/mixer64.wasm", "start": 8698, "end": 9212 }, { "filename": "/usr/share/.DS_Store", "start": 9212, "end": 17408 }, { "filename": "/usr/share/faust/aanl.lib", "start": 17408, "end": 47228 }, { "filename": "/usr/share/faust/all.lib", "start": 47228, "end": 48359 }, { "filename": "/usr/share/faust/analyzers.lib", "start": 48359, "end": 89614 }, { "filename": "/usr/share/faust/basics.lib", "start": 89614, "end": 188178 }, { "filename": "/usr/share/faust/compressors.lib", "start": 188178, "end": 254704 }, { "filename": "/usr/share/faust/delays.lib", "start": 254704, "end": 274543 }, { "filename": "/usr/share/faust/demos.lib", "start": 274543, "end": 355358 }, { "filename": "/usr/share/faust/doc.lib", "start": 355358, "end": 356487 }, { "filename": "/usr/share/faust/dx7.lib", "start": 356487, "end": 374307 }, { "filename": "/usr/share/faust/effect.lib", "start": 374307, "end": 443337 }, { "filename": "/usr/share/faust/env.lib", "start": 443337, "end": 455785 }, { "filename": "/usr/share/faust/envelopes.lib", "start": 455785, "end": 477738 }, { "filename": "/usr/share/faust/fds.lib", "start": 477738, "end": 498299 }, { "filename": "/usr/share/faust/filter.lib", "start": 498299, "end": 563685 }, { "filename": "/usr/share/faust/filters.lib", "start": 563685, "end": 699548 }, { "filename": "/usr/share/faust/hoa.lib", "start": 699548, "end": 742349 }, { "filename": "/usr/share/faust/instruments.lib", "start": 742349, "end": 751963 }, { "filename": "/usr/share/faust/interpolators.lib", "start": 751963, "end": 779352 }, { "filename": "/usr/share/faust/lfo.lib", "start": 779352, "end": 785174 }, { "filename": "/usr/share/faust/linearalgebra.lib", "start": 785174, "end": 793832 }, { "filename": "/usr/share/faust/math.lib", "start": 793832, "end": 815093 }, { "filename": "/usr/share/faust/maths.lib", "start": 815093, "end": 850462 }, { "filename": "/usr/share/faust/maxmsp.lib", "start": 850462, "end": 858638 }, { "filename": "/usr/share/faust/mi.lib", "start": 858638, "end": 876095 }, { "filename": "/usr/share/faust/misceffects.lib", "start": 876095, "end": 913817 }, { "filename": "/usr/share/faust/music.lib", "start": 913817, "end": 933335 }, { "filename": "/usr/share/faust/noises.lib", "start": 933335, "end": 950485 }, { "filename": "/usr/share/faust/operator.lib", "start": 950485, "end": 963346 }, { "filename": "/usr/share/faust/oscillator.lib", "start": 963346, "end": 983197 }, { "filename": "/usr/share/faust/oscillators.lib", "start": 983197, "end": 1045647 }, { "filename": "/usr/share/faust/phaflangers.lib", "start": 1045647, "end": 1055676 }, { "filename": "/usr/share/faust/physmodels.lib", "start": 1055676, "end": 1232080 }, { "filename": "/usr/share/faust/pitchenv.lib", "start": 1232080, "end": 1237458 }, { "filename": "/usr/share/faust/platform.lib", "start": 1237458, "end": 1240971 }, { "filename": "/usr/share/faust/quantizers.lib", "start": 1240971, "end": 1251436 }, { "filename": "/usr/share/faust/reducemaps.lib", "start": 1251436, "end": 1260606 }, { "filename": "/usr/share/faust/reverbs.lib", "start": 1260606, "end": 1305818 }, { "filename": "/usr/share/faust/routes.lib", "start": 1305818, "end": 1314470 }, { "filename": "/usr/share/faust/sf.lib", "start": 1314470, "end": 1315536 }, { "filename": "/usr/share/faust/signals.lib", "start": 1315536, "end": 1337629 }, { "filename": "/usr/share/faust/soundfiles.lib", "start": 1337629, "end": 1347019 }, { "filename": "/usr/share/faust/spats.lib", "start": 1347019, "end": 1357492 }, { "filename": "/usr/share/faust/stdfaust.lib", "start": 1357492, "end": 1358797 }, { "filename": "/usr/share/faust/synths.lib", "start": 1358797, "end": 1370158 }, { "filename": "/usr/share/faust/tonestacks.lib", "start": 1370158, "end": 1382514 }, { "filename": "/usr/share/faust/tubes.lib", "start": 1382514, "end": 1746801 }, { "filename": "/usr/share/faust/vaeffects.lib", "start": 1746801, "end": 1797955 }, { "filename": "/usr/share/faust/version.lib", "start": 1797955, "end": 1798886 }, { "filename": "/usr/share/faust/wdmodels.lib", "start": 1798886, "end": 1888839 }, { "filename": "/usr/share/faust/webaudio.lib", "start": 1888839, "end": 1900960 }], "remote_package_size": 1900960 });
|
|
249
226
|
})();
|
|
250
|
-
if (Module["ENVIRONMENT_IS_PTHREAD"])
|
|
251
|
-
Module["preRun"] = [];
|
|
227
|
+
if (Module["ENVIRONMENT_IS_PTHREAD"]) Module["preRun"] = [];
|
|
252
228
|
var necessaryPreJSTasks = Module["preRun"].slice();
|
|
253
|
-
if (!Module["preRun"])
|
|
254
|
-
throw "Module.preRun should exist because file support used it; did a pre-js delete it?";
|
|
229
|
+
if (!Module["preRun"]) throw "Module.preRun should exist because file support used it; did a pre-js delete it?";
|
|
255
230
|
necessaryPreJSTasks.forEach(function(task) {
|
|
256
|
-
if (Module["preRun"].indexOf(task) < 0)
|
|
257
|
-
throw "All preRun tasks that exist before user pre-js code should remain after; did you replace Module or modify Module.preRun?";
|
|
231
|
+
if (Module["preRun"].indexOf(task) < 0) throw "All preRun tasks that exist before user pre-js code should remain after; did you replace Module or modify Module.preRun?";
|
|
258
232
|
});
|
|
259
233
|
var moduleOverrides = Object.assign({}, Module);
|
|
260
234
|
var arguments_ = [];
|
|
@@ -278,8 +252,7 @@
|
|
|
278
252
|
}
|
|
279
253
|
var read_, readAsync, readBinary, setWindowTitle;
|
|
280
254
|
function logExceptionOnExit(e) {
|
|
281
|
-
if (e instanceof ExitStatus)
|
|
282
|
-
return;
|
|
255
|
+
if (e instanceof ExitStatus) return;
|
|
283
256
|
let toLog = e;
|
|
284
257
|
if (e && typeof e == "object" && e.stack) {
|
|
285
258
|
toLog = [e, e.stack];
|
|
@@ -287,8 +260,7 @@
|
|
|
287
260
|
err("exiting due to exception: " + toLog);
|
|
288
261
|
}
|
|
289
262
|
if (ENVIRONMENT_IS_NODE) {
|
|
290
|
-
if (typeof process == "undefined" || !process.release || process.release.name !== "node")
|
|
291
|
-
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
263
|
+
if (typeof process == "undefined" || !process.release || process.release.name !== "node") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
292
264
|
var fs = __require("fs");
|
|
293
265
|
var nodePath = __require("path");
|
|
294
266
|
if (ENVIRONMENT_IS_WORKER) {
|
|
@@ -311,10 +283,8 @@
|
|
|
311
283
|
readAsync = (filename, onload, onerror) => {
|
|
312
284
|
filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
|
|
313
285
|
fs.readFile(filename, function(err2, data) {
|
|
314
|
-
if (err2)
|
|
315
|
-
|
|
316
|
-
else
|
|
317
|
-
onload(data.buffer);
|
|
286
|
+
if (err2) onerror(err2);
|
|
287
|
+
else onload(data.buffer);
|
|
318
288
|
});
|
|
319
289
|
};
|
|
320
290
|
if (process["argv"].length > 1) {
|
|
@@ -344,8 +314,7 @@
|
|
|
344
314
|
return "[Emscripten Module object]";
|
|
345
315
|
};
|
|
346
316
|
} else if (ENVIRONMENT_IS_SHELL) {
|
|
347
|
-
if (typeof process == "object" && typeof __require === "function" || typeof window == "object" || typeof importScripts == "function")
|
|
348
|
-
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
317
|
+
if (typeof process == "object" && typeof __require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
349
318
|
if (typeof read != "undefined") {
|
|
350
319
|
read_ = function shell_read(f) {
|
|
351
320
|
return read(f);
|
|
@@ -379,8 +348,7 @@
|
|
|
379
348
|
};
|
|
380
349
|
}
|
|
381
350
|
if (typeof print != "undefined") {
|
|
382
|
-
if (typeof console == "undefined")
|
|
383
|
-
console = {};
|
|
351
|
+
if (typeof console == "undefined") console = {};
|
|
384
352
|
console.log = print;
|
|
385
353
|
console.warn = console.error = typeof printErr != "undefined" ? printErr : print;
|
|
386
354
|
}
|
|
@@ -398,8 +366,7 @@
|
|
|
398
366
|
} else {
|
|
399
367
|
scriptDirectory = "";
|
|
400
368
|
}
|
|
401
|
-
if (!(typeof window == "object" || typeof importScripts == "function"))
|
|
402
|
-
throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
369
|
+
if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
|
|
403
370
|
{
|
|
404
371
|
read_ = (url) => {
|
|
405
372
|
var xhr = new XMLHttpRequest();
|
|
@@ -440,14 +407,11 @@
|
|
|
440
407
|
Object.assign(Module, moduleOverrides);
|
|
441
408
|
moduleOverrides = null;
|
|
442
409
|
checkIncomingModuleAPI();
|
|
443
|
-
if (Module["arguments"])
|
|
444
|
-
arguments_ = Module["arguments"];
|
|
410
|
+
if (Module["arguments"]) arguments_ = Module["arguments"];
|
|
445
411
|
legacyModuleProp("arguments", "arguments_");
|
|
446
|
-
if (Module["thisProgram"])
|
|
447
|
-
thisProgram = Module["thisProgram"];
|
|
412
|
+
if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
|
|
448
413
|
legacyModuleProp("thisProgram", "thisProgram");
|
|
449
|
-
if (Module["quit"])
|
|
450
|
-
quit_ = Module["quit"];
|
|
414
|
+
if (Module["quit"]) quit_ = Module["quit"];
|
|
451
415
|
legacyModuleProp("quit", "quit_");
|
|
452
416
|
assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
|
|
453
417
|
assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
|
|
@@ -464,8 +428,7 @@
|
|
|
464
428
|
legacyModuleProp("setWindowTitle", "setWindowTitle");
|
|
465
429
|
assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");
|
|
466
430
|
var wasmBinary;
|
|
467
|
-
if (Module["wasmBinary"])
|
|
468
|
-
wasmBinary = Module["wasmBinary"];
|
|
431
|
+
if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
|
|
469
432
|
legacyModuleProp("wasmBinary", "wasmBinary");
|
|
470
433
|
var noExitRuntime = Module["noExitRuntime"] || true;
|
|
471
434
|
legacyModuleProp("noExitRuntime", "noExitRuntime");
|
|
@@ -484,8 +447,7 @@
|
|
|
484
447
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
485
448
|
var endIdx = idx + maxBytesToRead;
|
|
486
449
|
var endPtr = idx;
|
|
487
|
-
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
488
|
-
++endPtr;
|
|
450
|
+
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
|
|
489
451
|
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
490
452
|
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
491
453
|
}
|
|
@@ -505,8 +467,7 @@
|
|
|
505
467
|
if ((u0 & 240) == 224) {
|
|
506
468
|
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
507
469
|
} else {
|
|
508
|
-
if ((u0 & 248) != 240)
|
|
509
|
-
warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
|
|
470
|
+
if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
|
|
510
471
|
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
511
472
|
}
|
|
512
473
|
if (u0 < 65536) {
|
|
@@ -522,8 +483,7 @@
|
|
|
522
483
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
523
484
|
}
|
|
524
485
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
525
|
-
if (!(maxBytesToWrite > 0))
|
|
526
|
-
return 0;
|
|
486
|
+
if (!(maxBytesToWrite > 0)) return 0;
|
|
527
487
|
var startIdx = outIdx;
|
|
528
488
|
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
529
489
|
for (var i = 0; i < str.length; ++i) {
|
|
@@ -533,25 +493,20 @@
|
|
|
533
493
|
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
|
|
534
494
|
}
|
|
535
495
|
if (u <= 127) {
|
|
536
|
-
if (outIdx >= endIdx)
|
|
537
|
-
break;
|
|
496
|
+
if (outIdx >= endIdx) break;
|
|
538
497
|
heap[outIdx++] = u;
|
|
539
498
|
} else if (u <= 2047) {
|
|
540
|
-
if (outIdx + 1 >= endIdx)
|
|
541
|
-
break;
|
|
499
|
+
if (outIdx + 1 >= endIdx) break;
|
|
542
500
|
heap[outIdx++] = 192 | u >> 6;
|
|
543
501
|
heap[outIdx++] = 128 | u & 63;
|
|
544
502
|
} else if (u <= 65535) {
|
|
545
|
-
if (outIdx + 2 >= endIdx)
|
|
546
|
-
break;
|
|
503
|
+
if (outIdx + 2 >= endIdx) break;
|
|
547
504
|
heap[outIdx++] = 224 | u >> 12;
|
|
548
505
|
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
549
506
|
heap[outIdx++] = 128 | u & 63;
|
|
550
507
|
} else {
|
|
551
|
-
if (outIdx + 3 >= endIdx)
|
|
552
|
-
|
|
553
|
-
if (u > 1114111)
|
|
554
|
-
warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");
|
|
508
|
+
if (outIdx + 3 >= endIdx) break;
|
|
509
|
+
if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");
|
|
555
510
|
heap[outIdx++] = 240 | u >> 18;
|
|
556
511
|
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
557
512
|
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
@@ -610,8 +565,7 @@
|
|
|
610
565
|
HEAPU32[0] = 1668509029;
|
|
611
566
|
}
|
|
612
567
|
function checkStackCookie() {
|
|
613
|
-
if (ABORT)
|
|
614
|
-
return;
|
|
568
|
+
if (ABORT) return;
|
|
615
569
|
var max = _emscripten_stack_get_end();
|
|
616
570
|
if (max == 0) {
|
|
617
571
|
max += 4;
|
|
@@ -629,8 +583,7 @@
|
|
|
629
583
|
var h16 = new Int16Array(1);
|
|
630
584
|
var h8 = new Int8Array(h16.buffer);
|
|
631
585
|
h16[0] = 25459;
|
|
632
|
-
if (h8[0] !== 115 || h8[1] !== 99)
|
|
633
|
-
throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
586
|
+
if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
|
|
634
587
|
})();
|
|
635
588
|
var __ATPRERUN__ = [];
|
|
636
589
|
var __ATINIT__ = [];
|
|
@@ -641,8 +594,7 @@
|
|
|
641
594
|
}
|
|
642
595
|
function preRun() {
|
|
643
596
|
if (Module["preRun"]) {
|
|
644
|
-
if (typeof Module["preRun"] == "function")
|
|
645
|
-
Module["preRun"] = [Module["preRun"]];
|
|
597
|
+
if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
|
|
646
598
|
while (Module["preRun"].length) {
|
|
647
599
|
addOnPreRun(Module["preRun"].shift());
|
|
648
600
|
}
|
|
@@ -653,8 +605,7 @@
|
|
|
653
605
|
assert(!runtimeInitialized);
|
|
654
606
|
runtimeInitialized = true;
|
|
655
607
|
checkStackCookie();
|
|
656
|
-
if (!Module["noFSInit"] && !FS.init.initialized)
|
|
657
|
-
FS.init();
|
|
608
|
+
if (!Module["noFSInit"] && !FS.init.initialized) FS.init();
|
|
658
609
|
FS.ignorePermissions = false;
|
|
659
610
|
TTY.init();
|
|
660
611
|
SOCKFS.root = FS.mount(SOCKFS, {}, null);
|
|
@@ -663,8 +614,7 @@
|
|
|
663
614
|
function postRun() {
|
|
664
615
|
checkStackCookie();
|
|
665
616
|
if (Module["postRun"]) {
|
|
666
|
-
if (typeof Module["postRun"] == "function")
|
|
667
|
-
Module["postRun"] = [Module["postRun"]];
|
|
617
|
+
if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
|
|
668
618
|
while (Module["postRun"].length) {
|
|
669
619
|
addOnPostRun(Module["postRun"].shift());
|
|
670
620
|
}
|
|
@@ -691,8 +641,7 @@
|
|
|
691
641
|
function getUniqueRunDependency(id) {
|
|
692
642
|
var orig = id;
|
|
693
643
|
while (1) {
|
|
694
|
-
if (!runDependencyTracking[id])
|
|
695
|
-
return id;
|
|
644
|
+
if (!runDependencyTracking[id]) return id;
|
|
696
645
|
id = orig + Math.random();
|
|
697
646
|
}
|
|
698
647
|
}
|
|
@@ -970,12 +919,10 @@
|
|
|
970
919
|
return "0x" + ptr.toString(16).padStart(8, "0");
|
|
971
920
|
}
|
|
972
921
|
function warnOnce(text) {
|
|
973
|
-
if (!warnOnce.shown)
|
|
974
|
-
warnOnce.shown = {};
|
|
922
|
+
if (!warnOnce.shown) warnOnce.shown = {};
|
|
975
923
|
if (!warnOnce.shown[text]) {
|
|
976
924
|
warnOnce.shown[text] = 1;
|
|
977
|
-
if (ENVIRONMENT_IS_NODE)
|
|
978
|
-
text = "warning: " + text;
|
|
925
|
+
if (ENVIRONMENT_IS_NODE) text = "warning: " + text;
|
|
979
926
|
err(text);
|
|
980
927
|
}
|
|
981
928
|
}
|
|
@@ -1044,8 +991,7 @@
|
|
|
1044
991
|
return HEAPU32[this.excPtr >> 2];
|
|
1045
992
|
}
|
|
1046
993
|
var adjusted = this.get_adjusted_ptr();
|
|
1047
|
-
if (adjusted !== 0)
|
|
1048
|
-
return adjusted;
|
|
994
|
+
if (adjusted !== 0) return adjusted;
|
|
1049
995
|
return this.excPtr;
|
|
1050
996
|
};
|
|
1051
997
|
}
|
|
@@ -1101,13 +1047,11 @@
|
|
|
1101
1047
|
}
|
|
1102
1048
|
return root + dir;
|
|
1103
1049
|
}, basename: (path) => {
|
|
1104
|
-
if (path === "/")
|
|
1105
|
-
return "/";
|
|
1050
|
+
if (path === "/") return "/";
|
|
1106
1051
|
path = PATH.normalize(path);
|
|
1107
1052
|
path = path.replace(/\/$/, "");
|
|
1108
1053
|
var lastSlash = path.lastIndexOf("/");
|
|
1109
|
-
if (lastSlash === -1)
|
|
1110
|
-
return path;
|
|
1054
|
+
if (lastSlash === -1) return path;
|
|
1111
1055
|
return path.substr(lastSlash + 1);
|
|
1112
1056
|
}, join: function() {
|
|
1113
1057
|
var paths = Array.prototype.slice.call(arguments);
|
|
@@ -1151,16 +1095,13 @@
|
|
|
1151
1095
|
function trim(arr) {
|
|
1152
1096
|
var start = 0;
|
|
1153
1097
|
for (; start < arr.length; start++) {
|
|
1154
|
-
if (arr[start] !== "")
|
|
1155
|
-
break;
|
|
1098
|
+
if (arr[start] !== "") break;
|
|
1156
1099
|
}
|
|
1157
1100
|
var end = arr.length - 1;
|
|
1158
1101
|
for (; end >= 0; end--) {
|
|
1159
|
-
if (arr[end] !== "")
|
|
1160
|
-
break;
|
|
1102
|
+
if (arr[end] !== "") break;
|
|
1161
1103
|
}
|
|
1162
|
-
if (start > end)
|
|
1163
|
-
return [];
|
|
1104
|
+
if (start > end) return [];
|
|
1164
1105
|
return arr.slice(start, end - start + 1);
|
|
1165
1106
|
}
|
|
1166
1107
|
var fromParts = trim(from.split("/"));
|
|
@@ -1184,8 +1125,7 @@
|
|
|
1184
1125
|
var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
|
|
1185
1126
|
var u8array = new Array(len);
|
|
1186
1127
|
var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
|
|
1187
|
-
if (dontAddNull)
|
|
1188
|
-
u8array.length = numBytesWritten;
|
|
1128
|
+
if (dontAddNull) u8array.length = numBytesWritten;
|
|
1189
1129
|
return u8array;
|
|
1190
1130
|
}
|
|
1191
1131
|
var TTY = { ttys: [], init: function() {
|
|
@@ -1219,8 +1159,7 @@
|
|
|
1219
1159
|
if (result === void 0 && bytesRead === 0) {
|
|
1220
1160
|
throw new FS.ErrnoError(6);
|
|
1221
1161
|
}
|
|
1222
|
-
if (result === null || result === void 0)
|
|
1223
|
-
break;
|
|
1162
|
+
if (result === null || result === void 0) break;
|
|
1224
1163
|
bytesRead++;
|
|
1225
1164
|
buffer[offset + i] = result;
|
|
1226
1165
|
}
|
|
@@ -1253,10 +1192,8 @@
|
|
|
1253
1192
|
try {
|
|
1254
1193
|
bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1);
|
|
1255
1194
|
} catch (e) {
|
|
1256
|
-
if (e.toString().includes("EOF"))
|
|
1257
|
-
|
|
1258
|
-
else
|
|
1259
|
-
throw e;
|
|
1195
|
+
if (e.toString().includes("EOF")) bytesRead = 0;
|
|
1196
|
+
else throw e;
|
|
1260
1197
|
}
|
|
1261
1198
|
if (bytesRead > 0) {
|
|
1262
1199
|
result = buf.slice(0, bytesRead).toString("utf-8");
|
|
@@ -1285,8 +1222,7 @@
|
|
|
1285
1222
|
out(UTF8ArrayToString(tty.output, 0));
|
|
1286
1223
|
tty.output = [];
|
|
1287
1224
|
} else {
|
|
1288
|
-
if (val != 0)
|
|
1289
|
-
tty.output.push(val);
|
|
1225
|
+
if (val != 0) tty.output.push(val);
|
|
1290
1226
|
}
|
|
1291
1227
|
}, fsync: function(tty) {
|
|
1292
1228
|
if (tty.output && tty.output.length > 0) {
|
|
@@ -1298,8 +1234,7 @@
|
|
|
1298
1234
|
err(UTF8ArrayToString(tty.output, 0));
|
|
1299
1235
|
tty.output = [];
|
|
1300
1236
|
} else {
|
|
1301
|
-
if (val != 0)
|
|
1302
|
-
tty.output.push(val);
|
|
1237
|
+
if (val != 0) tty.output.push(val);
|
|
1303
1238
|
}
|
|
1304
1239
|
}, fsync: function(tty) {
|
|
1305
1240
|
if (tty.output && tty.output.length > 0) {
|
|
@@ -1343,26 +1278,20 @@
|
|
|
1343
1278
|
}
|
|
1344
1279
|
return node;
|
|
1345
1280
|
}, getFileDataAsTypedArray: function(node) {
|
|
1346
|
-
if (!node.contents)
|
|
1347
|
-
|
|
1348
|
-
if (node.contents.subarray)
|
|
1349
|
-
return node.contents.subarray(0, node.usedBytes);
|
|
1281
|
+
if (!node.contents) return new Uint8Array(0);
|
|
1282
|
+
if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes);
|
|
1350
1283
|
return new Uint8Array(node.contents);
|
|
1351
1284
|
}, expandFileStorage: function(node, newCapacity) {
|
|
1352
1285
|
var prevCapacity = node.contents ? node.contents.length : 0;
|
|
1353
|
-
if (prevCapacity >= newCapacity)
|
|
1354
|
-
return;
|
|
1286
|
+
if (prevCapacity >= newCapacity) return;
|
|
1355
1287
|
var CAPACITY_DOUBLING_MAX = 1024 * 1024;
|
|
1356
1288
|
newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
|
|
1357
|
-
if (prevCapacity != 0)
|
|
1358
|
-
newCapacity = Math.max(newCapacity, 256);
|
|
1289
|
+
if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
|
|
1359
1290
|
var oldContents = node.contents;
|
|
1360
1291
|
node.contents = new Uint8Array(newCapacity);
|
|
1361
|
-
if (node.usedBytes > 0)
|
|
1362
|
-
node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
|
|
1292
|
+
if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
|
|
1363
1293
|
}, resizeFileStorage: function(node, newSize) {
|
|
1364
|
-
if (node.usedBytes == newSize)
|
|
1365
|
-
return;
|
|
1294
|
+
if (node.usedBytes == newSize) return;
|
|
1366
1295
|
if (newSize == 0) {
|
|
1367
1296
|
node.contents = null;
|
|
1368
1297
|
node.usedBytes = 0;
|
|
@@ -1461,15 +1390,13 @@
|
|
|
1461
1390
|
return node.link;
|
|
1462
1391
|
} }, stream_ops: { read: function(stream, buffer, offset, length, position) {
|
|
1463
1392
|
var contents = stream.node.contents;
|
|
1464
|
-
if (position >= stream.node.usedBytes)
|
|
1465
|
-
return 0;
|
|
1393
|
+
if (position >= stream.node.usedBytes) return 0;
|
|
1466
1394
|
var size = Math.min(stream.node.usedBytes - position, length);
|
|
1467
1395
|
assert(size >= 0);
|
|
1468
1396
|
if (size > 8 && contents.subarray) {
|
|
1469
1397
|
buffer.set(contents.subarray(position, position + size), offset);
|
|
1470
1398
|
} else {
|
|
1471
|
-
for (var i = 0; i < size; i++)
|
|
1472
|
-
buffer[offset + i] = contents[position + i];
|
|
1399
|
+
for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
|
|
1473
1400
|
}
|
|
1474
1401
|
return size;
|
|
1475
1402
|
}, write: function(stream, buffer, offset, length, position, canOwn) {
|
|
@@ -1477,8 +1404,7 @@
|
|
|
1477
1404
|
if (buffer.buffer === HEAP8.buffer) {
|
|
1478
1405
|
canOwn = false;
|
|
1479
1406
|
}
|
|
1480
|
-
if (!length)
|
|
1481
|
-
return 0;
|
|
1407
|
+
if (!length) return 0;
|
|
1482
1408
|
var node = stream.node;
|
|
1483
1409
|
node.timestamp = Date.now();
|
|
1484
1410
|
if (buffer.subarray && (!node.contents || node.contents.subarray)) {
|
|
@@ -1557,8 +1483,7 @@
|
|
|
1557
1483
|
readAsync(url, (arrayBuffer) => {
|
|
1558
1484
|
assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
|
|
1559
1485
|
onload(new Uint8Array(arrayBuffer));
|
|
1560
|
-
if (dep)
|
|
1561
|
-
removeRunDependency(dep);
|
|
1486
|
+
if (dep) removeRunDependency(dep);
|
|
1562
1487
|
}, (event) => {
|
|
1563
1488
|
if (onerror) {
|
|
1564
1489
|
onerror();
|
|
@@ -1566,8 +1491,7 @@
|
|
|
1566
1491
|
throw 'Loading data file "' + url + '" failed.';
|
|
1567
1492
|
}
|
|
1568
1493
|
});
|
|
1569
|
-
if (dep)
|
|
1570
|
-
addRunDependency(dep);
|
|
1494
|
+
if (dep) addRunDependency(dep);
|
|
1571
1495
|
}
|
|
1572
1496
|
var ERRNO_MESSAGES = { 0: "Success", 1: "Arg list too long", 2: "Permission denied", 3: "Address already in use", 4: "Address not available", 5: "Address family not supported by protocol family", 6: "No more processes", 7: "Socket already connected", 8: "Bad file number", 9: "Trying to read unreadable message", 10: "Mount device busy", 11: "Operation canceled", 12: "No children", 13: "Connection aborted", 14: "Connection refused", 15: "Connection reset by peer", 16: "File locking deadlock error", 17: "Destination address required", 18: "Math arg out of domain of func", 19: "Quota exceeded", 20: "File exists", 21: "Bad address", 22: "File too large", 23: "Host is unreachable", 24: "Identifier removed", 25: "Illegal byte sequence", 26: "Connection already in progress", 27: "Interrupted system call", 28: "Invalid argument", 29: "I/O error", 30: "Socket is already connected", 31: "Is a directory", 32: "Too many symbolic links", 33: "Too many open files", 34: "Too many links", 35: "Message too long", 36: "Multihop attempted", 37: "File or path name too long", 38: "Network interface is not configured", 39: "Connection reset by network", 40: "Network is unreachable", 41: "Too many open files in system", 42: "No buffer space available", 43: "No such device", 44: "No such file or directory", 45: "Exec format error", 46: "No record locks available", 47: "The link has been severed", 48: "Not enough core", 49: "No message of desired type", 50: "Protocol not available", 51: "No space left on device", 52: "Function not implemented", 53: "Socket is not connected", 54: "Not a directory", 55: "Directory not empty", 56: "State not recoverable", 57: "Socket operation on non-socket", 59: "Not a typewriter", 60: "No such device or address", 61: "Value too large for defined data type", 62: "Previous owner died", 63: "Not super-user", 64: "Broken pipe", 65: "Protocol error", 66: "Unknown protocol", 67: "Protocol wrong type for socket", 68: "Math result not representable", 69: "Read only file system", 70: "Illegal seek", 71: "No such process", 72: "Stale file handle", 73: "Connection timed out", 74: "Text file busy", 75: "Cross-device link", 100: "Device not a stream", 101: "Bad font file fmt", 102: "Invalid slot", 103: "Invalid request code", 104: "No anode", 105: "Block device required", 106: "Channel number out of range", 107: "Level 3 halted", 108: "Level 3 reset", 109: "Link number out of range", 110: "Protocol driver not attached", 111: "No CSI structure available", 112: "Level 2 halted", 113: "Invalid exchange", 114: "Invalid request descriptor", 115: "Exchange full", 116: "No data (for no delay io)", 117: "Timer expired", 118: "Out of streams resources", 119: "Machine is not on the network", 120: "Package not installed", 121: "The object is remote", 122: "Advertise error", 123: "Srmount error", 124: "Communication error on send", 125: "Cross mount point (not really error)", 126: "Given log. name not unique", 127: "f.d. invalid for this operation", 128: "Remote address changed", 129: "Can access a needed shared lib", 130: "Accessing a corrupted shared lib", 131: ".lib section in a.out corrupted", 132: "Attempting to link in too many libs", 133: "Attempting to exec a shared library", 135: "Streams pipe error", 136: "Too many users", 137: "Socket type not supported", 138: "Not supported", 139: "Protocol family not supported", 140: "Can't send after socket shutdown", 141: "Too many references", 142: "Host is down", 148: "No medium (in tape drive)", 156: "Level 2 not synchronized" };
|
|
1573
1497
|
var ERRNO_CODES = {};
|
|
@@ -1584,8 +1508,7 @@
|
|
|
1584
1508
|
}
|
|
1585
1509
|
var FS = { root: null, mounts: [], devices: {}, streams: [], nextInode: 1, nameTable: null, currentPath: "/", initialized: false, ignorePermissions: true, ErrnoError: null, genericErrors: {}, filesystems: null, syncFSRequests: 0, lookupPath: (path, opts = {}) => {
|
|
1586
1510
|
path = PATH_FS.resolve(path);
|
|
1587
|
-
if (!path)
|
|
1588
|
-
return { path: "", node: null };
|
|
1511
|
+
if (!path) return { path: "", node: null };
|
|
1589
1512
|
var defaults = { follow_mount: true, recurse_count: 0 };
|
|
1590
1513
|
opts = Object.assign(defaults, opts);
|
|
1591
1514
|
if (opts.recurse_count > 8) {
|
|
@@ -1625,8 +1548,7 @@
|
|
|
1625
1548
|
while (true) {
|
|
1626
1549
|
if (FS.isRoot(node)) {
|
|
1627
1550
|
var mount = node.mount.mountpoint;
|
|
1628
|
-
if (!path)
|
|
1629
|
-
return mount;
|
|
1551
|
+
if (!path) return mount;
|
|
1630
1552
|
return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path;
|
|
1631
1553
|
}
|
|
1632
1554
|
path = path ? node.name + "/" + path : node.name;
|
|
@@ -1720,10 +1642,8 @@
|
|
|
1720
1642
|
return 0;
|
|
1721
1643
|
}, mayLookup: (dir) => {
|
|
1722
1644
|
var errCode = FS.nodePermissions(dir, "x");
|
|
1723
|
-
if (errCode)
|
|
1724
|
-
|
|
1725
|
-
if (!dir.node_ops.lookup)
|
|
1726
|
-
return 2;
|
|
1645
|
+
if (errCode) return errCode;
|
|
1646
|
+
if (!dir.node_ops.lookup) return 2;
|
|
1727
1647
|
return 0;
|
|
1728
1648
|
}, mayCreate: (dir, name) => {
|
|
1729
1649
|
try {
|
|
@@ -1947,14 +1867,12 @@
|
|
|
1947
1867
|
var dirs = path.split("/");
|
|
1948
1868
|
var d = "";
|
|
1949
1869
|
for (var i = 0; i < dirs.length; ++i) {
|
|
1950
|
-
if (!dirs[i])
|
|
1951
|
-
continue;
|
|
1870
|
+
if (!dirs[i]) continue;
|
|
1952
1871
|
d += "/" + dirs[i];
|
|
1953
1872
|
try {
|
|
1954
1873
|
FS.mkdir(d, mode);
|
|
1955
1874
|
} catch (e) {
|
|
1956
|
-
if (e.errno != 20)
|
|
1957
|
-
throw e;
|
|
1875
|
+
if (e.errno != 20) throw e;
|
|
1958
1876
|
}
|
|
1959
1877
|
}
|
|
1960
1878
|
}, mkdev: (path, mode, dev) => {
|
|
@@ -1992,8 +1910,7 @@
|
|
|
1992
1910
|
old_dir = lookup.node;
|
|
1993
1911
|
lookup = FS.lookupPath(new_path, { parent: true });
|
|
1994
1912
|
new_dir = lookup.node;
|
|
1995
|
-
if (!old_dir || !new_dir)
|
|
1996
|
-
throw new FS.ErrnoError(44);
|
|
1913
|
+
if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
|
|
1997
1914
|
if (old_dir.mount !== new_dir.mount) {
|
|
1998
1915
|
throw new FS.ErrnoError(75);
|
|
1999
1916
|
}
|
|
@@ -2244,8 +2161,7 @@
|
|
|
2244
2161
|
stream.stream_ops.open(stream);
|
|
2245
2162
|
}
|
|
2246
2163
|
if (Module["logReadFiles"] && !(flags & 1)) {
|
|
2247
|
-
if (!FS.readFiles)
|
|
2248
|
-
FS.readFiles = {};
|
|
2164
|
+
if (!FS.readFiles) FS.readFiles = {};
|
|
2249
2165
|
if (!(path in FS.readFiles)) {
|
|
2250
2166
|
FS.readFiles[path] = 1;
|
|
2251
2167
|
}
|
|
@@ -2255,8 +2171,7 @@
|
|
|
2255
2171
|
if (FS.isClosed(stream)) {
|
|
2256
2172
|
throw new FS.ErrnoError(8);
|
|
2257
2173
|
}
|
|
2258
|
-
if (stream.getdents)
|
|
2259
|
-
stream.getdents = null;
|
|
2174
|
+
if (stream.getdents) stream.getdents = null;
|
|
2260
2175
|
try {
|
|
2261
2176
|
if (stream.stream_ops.close) {
|
|
2262
2177
|
stream.stream_ops.close(stream);
|
|
@@ -2305,8 +2220,7 @@
|
|
|
2305
2220
|
throw new FS.ErrnoError(70);
|
|
2306
2221
|
}
|
|
2307
2222
|
var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
|
|
2308
|
-
if (!seeking)
|
|
2309
|
-
stream.position += bytesRead;
|
|
2223
|
+
if (!seeking) stream.position += bytesRead;
|
|
2310
2224
|
return bytesRead;
|
|
2311
2225
|
}, write: (stream, buffer, offset, length, position, canOwn) => {
|
|
2312
2226
|
if (length < 0 || position < 0) {
|
|
@@ -2334,8 +2248,7 @@
|
|
|
2334
2248
|
throw new FS.ErrnoError(70);
|
|
2335
2249
|
}
|
|
2336
2250
|
var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
|
|
2337
|
-
if (!seeking)
|
|
2338
|
-
stream.position += bytesWritten;
|
|
2251
|
+
if (!seeking) stream.position += bytesWritten;
|
|
2339
2252
|
return bytesWritten;
|
|
2340
2253
|
}, allocate: (stream, offset, length) => {
|
|
2341
2254
|
if (FS.isClosed(stream)) {
|
|
@@ -2446,8 +2359,7 @@
|
|
|
2446
2359
|
node.node_ops = { lookup: (parent, name) => {
|
|
2447
2360
|
var fd = +name;
|
|
2448
2361
|
var stream = FS.getStream(fd);
|
|
2449
|
-
if (!stream)
|
|
2450
|
-
throw new FS.ErrnoError(8);
|
|
2362
|
+
if (!stream) throw new FS.ErrnoError(8);
|
|
2451
2363
|
var ret = { parent: null, mount: { mountpoint: "fake" }, node_ops: { readlink: () => stream.path } };
|
|
2452
2364
|
ret.parent = ret;
|
|
2453
2365
|
return ret;
|
|
@@ -2477,8 +2389,7 @@
|
|
|
2477
2389
|
assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")");
|
|
2478
2390
|
assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")");
|
|
2479
2391
|
}, ensureErrnoError: () => {
|
|
2480
|
-
if (FS.ErrnoError)
|
|
2481
|
-
return;
|
|
2392
|
+
if (FS.ErrnoError) return;
|
|
2482
2393
|
FS.ErrnoError = function ErrnoError(errno, node) {
|
|
2483
2394
|
this.node = node;
|
|
2484
2395
|
this.setErrno = function(errno2) {
|
|
@@ -2531,10 +2442,8 @@
|
|
|
2531
2442
|
}
|
|
2532
2443
|
}, getMode: (canRead, canWrite) => {
|
|
2533
2444
|
var mode = 0;
|
|
2534
|
-
if (canRead)
|
|
2535
|
-
|
|
2536
|
-
if (canWrite)
|
|
2537
|
-
mode |= 146;
|
|
2445
|
+
if (canRead) mode |= 292 | 73;
|
|
2446
|
+
if (canWrite) mode |= 146;
|
|
2538
2447
|
return mode;
|
|
2539
2448
|
}, findObject: (path, dontResolveLastLink) => {
|
|
2540
2449
|
var ret = FS.analyzePath(path, dontResolveLastLink);
|
|
@@ -2570,8 +2479,7 @@
|
|
|
2570
2479
|
var parts = path.split("/").reverse();
|
|
2571
2480
|
while (parts.length) {
|
|
2572
2481
|
var part = parts.pop();
|
|
2573
|
-
if (!part)
|
|
2574
|
-
continue;
|
|
2482
|
+
if (!part) continue;
|
|
2575
2483
|
var current = PATH.join2(parent, part);
|
|
2576
2484
|
try {
|
|
2577
2485
|
FS.mkdir(current);
|
|
@@ -2595,8 +2503,7 @@
|
|
|
2595
2503
|
if (data) {
|
|
2596
2504
|
if (typeof data == "string") {
|
|
2597
2505
|
var arr = new Array(data.length);
|
|
2598
|
-
for (var i = 0, len = data.length; i < len; ++i)
|
|
2599
|
-
arr[i] = data.charCodeAt(i);
|
|
2506
|
+
for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
|
|
2600
2507
|
data = arr;
|
|
2601
2508
|
}
|
|
2602
2509
|
FS.chmod(node, mode | 146);
|
|
@@ -2609,8 +2516,7 @@
|
|
|
2609
2516
|
}, createDevice: (parent, name, input, output) => {
|
|
2610
2517
|
var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
|
|
2611
2518
|
var mode = FS.getMode(!!input, !!output);
|
|
2612
|
-
if (!FS.createDevice.major)
|
|
2613
|
-
FS.createDevice.major = 64;
|
|
2519
|
+
if (!FS.createDevice.major) FS.createDevice.major = 64;
|
|
2614
2520
|
var dev = FS.makedev(FS.createDevice.major++, 0);
|
|
2615
2521
|
FS.registerDevice(dev, { open: (stream) => {
|
|
2616
2522
|
stream.seekable = false;
|
|
@@ -2630,8 +2536,7 @@
|
|
|
2630
2536
|
if (result === void 0 && bytesRead === 0) {
|
|
2631
2537
|
throw new FS.ErrnoError(6);
|
|
2632
2538
|
}
|
|
2633
|
-
if (result === null || result === void 0)
|
|
2634
|
-
break;
|
|
2539
|
+
if (result === null || result === void 0) break;
|
|
2635
2540
|
bytesRead++;
|
|
2636
2541
|
buffer[offset + i] = result;
|
|
2637
2542
|
}
|
|
@@ -2654,8 +2559,7 @@
|
|
|
2654
2559
|
} });
|
|
2655
2560
|
return FS.mkdev(path, mode, dev);
|
|
2656
2561
|
}, forceLoadFile: (obj) => {
|
|
2657
|
-
if (obj.isDevice || obj.isFolder || obj.link || obj.contents)
|
|
2658
|
-
return true;
|
|
2562
|
+
if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
|
|
2659
2563
|
if (typeof XMLHttpRequest != "undefined") {
|
|
2660
2564
|
throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
|
|
2661
2565
|
} else if (read_) {
|
|
@@ -2688,31 +2592,25 @@
|
|
|
2688
2592
|
var xhr = new XMLHttpRequest();
|
|
2689
2593
|
xhr.open("HEAD", url, false);
|
|
2690
2594
|
xhr.send(null);
|
|
2691
|
-
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))
|
|
2692
|
-
throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
|
|
2595
|
+
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
|
|
2693
2596
|
var datalength = Number(xhr.getResponseHeader("Content-length"));
|
|
2694
2597
|
var header;
|
|
2695
2598
|
var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
|
|
2696
2599
|
var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
|
|
2697
2600
|
var chunkSize = 1024 * 1024;
|
|
2698
|
-
if (!hasByteServing)
|
|
2699
|
-
chunkSize = datalength;
|
|
2601
|
+
if (!hasByteServing) chunkSize = datalength;
|
|
2700
2602
|
var doXHR = (from, to) => {
|
|
2701
|
-
if (from > to)
|
|
2702
|
-
|
|
2703
|
-
if (to > datalength - 1)
|
|
2704
|
-
throw new Error("only " + datalength + " bytes available! programmer error!");
|
|
2603
|
+
if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
|
|
2604
|
+
if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!");
|
|
2705
2605
|
var xhr2 = new XMLHttpRequest();
|
|
2706
2606
|
xhr2.open("GET", url, false);
|
|
2707
|
-
if (datalength !== chunkSize)
|
|
2708
|
-
xhr2.setRequestHeader("Range", "bytes=" + from + "-" + to);
|
|
2607
|
+
if (datalength !== chunkSize) xhr2.setRequestHeader("Range", "bytes=" + from + "-" + to);
|
|
2709
2608
|
xhr2.responseType = "arraybuffer";
|
|
2710
2609
|
if (xhr2.overrideMimeType) {
|
|
2711
2610
|
xhr2.overrideMimeType("text/plain; charset=x-user-defined");
|
|
2712
2611
|
}
|
|
2713
2612
|
xhr2.send(null);
|
|
2714
|
-
if (!(xhr2.status >= 200 && xhr2.status < 300 || xhr2.status === 304))
|
|
2715
|
-
throw new Error("Couldn't load " + url + ". Status: " + xhr2.status);
|
|
2613
|
+
if (!(xhr2.status >= 200 && xhr2.status < 300 || xhr2.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr2.status);
|
|
2716
2614
|
if (xhr2.response !== void 0) {
|
|
2717
2615
|
return new Uint8Array(xhr2.response || []);
|
|
2718
2616
|
}
|
|
@@ -2726,8 +2624,7 @@
|
|
|
2726
2624
|
if (typeof lazyArray2.chunks[chunkNum] == "undefined") {
|
|
2727
2625
|
lazyArray2.chunks[chunkNum] = doXHR(start, end);
|
|
2728
2626
|
}
|
|
2729
|
-
if (typeof lazyArray2.chunks[chunkNum] == "undefined")
|
|
2730
|
-
throw new Error("doXHR failed!");
|
|
2627
|
+
if (typeof lazyArray2.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!");
|
|
2731
2628
|
return lazyArray2.chunks[chunkNum];
|
|
2732
2629
|
});
|
|
2733
2630
|
if (usesGzip || !datalength) {
|
|
@@ -2741,8 +2638,7 @@
|
|
|
2741
2638
|
this.lengthKnown = true;
|
|
2742
2639
|
};
|
|
2743
2640
|
if (typeof XMLHttpRequest != "undefined") {
|
|
2744
|
-
if (!ENVIRONMENT_IS_WORKER)
|
|
2745
|
-
throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
|
|
2641
|
+
if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
|
|
2746
2642
|
var lazyArray = new LazyUint8Array();
|
|
2747
2643
|
Object.defineProperties(lazyArray, { length: { get: function() {
|
|
2748
2644
|
if (!this.lengthKnown) {
|
|
@@ -2780,8 +2676,7 @@
|
|
|
2780
2676
|
});
|
|
2781
2677
|
function writeChunks(stream, buffer, offset, length, position) {
|
|
2782
2678
|
var contents = stream.node.contents;
|
|
2783
|
-
if (position >= contents.length)
|
|
2784
|
-
return 0;
|
|
2679
|
+
if (position >= contents.length) return 0;
|
|
2785
2680
|
var size = Math.min(contents.length - position, length);
|
|
2786
2681
|
assert(size >= 0);
|
|
2787
2682
|
if (contents.slice) {
|
|
@@ -2815,18 +2710,15 @@
|
|
|
2815
2710
|
var dep = getUniqueRunDependency("cp " + fullname);
|
|
2816
2711
|
function processData(byteArray) {
|
|
2817
2712
|
function finish(byteArray2) {
|
|
2818
|
-
if (preFinish)
|
|
2819
|
-
preFinish();
|
|
2713
|
+
if (preFinish) preFinish();
|
|
2820
2714
|
if (!dontCreateFile) {
|
|
2821
2715
|
FS.createDataFile(parent, name, byteArray2, canRead, canWrite, canOwn);
|
|
2822
2716
|
}
|
|
2823
|
-
if (onload)
|
|
2824
|
-
onload();
|
|
2717
|
+
if (onload) onload();
|
|
2825
2718
|
removeRunDependency(dep);
|
|
2826
2719
|
}
|
|
2827
2720
|
if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => {
|
|
2828
|
-
if (onerror)
|
|
2829
|
-
onerror();
|
|
2721
|
+
if (onerror) onerror();
|
|
2830
2722
|
removeRunDependency(dep);
|
|
2831
2723
|
})) {
|
|
2832
2724
|
return;
|
|
@@ -2843,9 +2735,9 @@
|
|
|
2843
2735
|
return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
2844
2736
|
}, DB_NAME: () => {
|
|
2845
2737
|
return "EM_FS_" + window.location.pathname;
|
|
2846
|
-
}, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: (paths, onload = () => {
|
|
2847
|
-
}, onerror = () => {
|
|
2848
|
-
}) => {
|
|
2738
|
+
}, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: (paths, onload = (() => {
|
|
2739
|
+
}), onerror = (() => {
|
|
2740
|
+
})) => {
|
|
2849
2741
|
var indexedDB = FS.indexedDB();
|
|
2850
2742
|
try {
|
|
2851
2743
|
var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
|
|
@@ -2863,30 +2755,26 @@
|
|
|
2863
2755
|
var files = transaction.objectStore(FS.DB_STORE_NAME);
|
|
2864
2756
|
var ok = 0, fail = 0, total = paths.length;
|
|
2865
2757
|
function finish() {
|
|
2866
|
-
if (fail == 0)
|
|
2867
|
-
|
|
2868
|
-
else
|
|
2869
|
-
onerror();
|
|
2758
|
+
if (fail == 0) onload();
|
|
2759
|
+
else onerror();
|
|
2870
2760
|
}
|
|
2871
2761
|
paths.forEach((path) => {
|
|
2872
2762
|
var putRequest = files.put(FS.analyzePath(path).object.contents, path);
|
|
2873
2763
|
putRequest.onsuccess = () => {
|
|
2874
2764
|
ok++;
|
|
2875
|
-
if (ok + fail == total)
|
|
2876
|
-
finish();
|
|
2765
|
+
if (ok + fail == total) finish();
|
|
2877
2766
|
};
|
|
2878
2767
|
putRequest.onerror = () => {
|
|
2879
2768
|
fail++;
|
|
2880
|
-
if (ok + fail == total)
|
|
2881
|
-
finish();
|
|
2769
|
+
if (ok + fail == total) finish();
|
|
2882
2770
|
};
|
|
2883
2771
|
});
|
|
2884
2772
|
transaction.onerror = onerror;
|
|
2885
2773
|
};
|
|
2886
2774
|
openRequest.onerror = onerror;
|
|
2887
|
-
}, loadFilesFromDB: (paths, onload = () => {
|
|
2888
|
-
}, onerror = () => {
|
|
2889
|
-
}) => {
|
|
2775
|
+
}, loadFilesFromDB: (paths, onload = (() => {
|
|
2776
|
+
}), onerror = (() => {
|
|
2777
|
+
})) => {
|
|
2890
2778
|
var indexedDB = FS.indexedDB();
|
|
2891
2779
|
try {
|
|
2892
2780
|
var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
|
|
@@ -2905,10 +2793,8 @@
|
|
|
2905
2793
|
var files = transaction.objectStore(FS.DB_STORE_NAME);
|
|
2906
2794
|
var ok = 0, fail = 0, total = paths.length;
|
|
2907
2795
|
function finish() {
|
|
2908
|
-
if (fail == 0)
|
|
2909
|
-
|
|
2910
|
-
else
|
|
2911
|
-
onerror();
|
|
2796
|
+
if (fail == 0) onload();
|
|
2797
|
+
else onerror();
|
|
2912
2798
|
}
|
|
2913
2799
|
paths.forEach((path) => {
|
|
2914
2800
|
var getRequest = files.get(path);
|
|
@@ -2918,13 +2804,11 @@
|
|
|
2918
2804
|
}
|
|
2919
2805
|
FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
|
|
2920
2806
|
ok++;
|
|
2921
|
-
if (ok + fail == total)
|
|
2922
|
-
finish();
|
|
2807
|
+
if (ok + fail == total) finish();
|
|
2923
2808
|
};
|
|
2924
2809
|
getRequest.onerror = () => {
|
|
2925
2810
|
fail++;
|
|
2926
|
-
if (ok + fail == total)
|
|
2927
|
-
finish();
|
|
2811
|
+
if (ok + fail == total) finish();
|
|
2928
2812
|
};
|
|
2929
2813
|
});
|
|
2930
2814
|
transaction.onerror = onerror;
|
|
@@ -3010,8 +2894,7 @@
|
|
|
3010
2894
|
return ret;
|
|
3011
2895
|
}, getStreamFromFD: function(fd) {
|
|
3012
2896
|
var stream = FS.getStream(fd);
|
|
3013
|
-
if (!stream)
|
|
3014
|
-
throw new FS.ErrnoError(8);
|
|
2897
|
+
if (!stream) throw new FS.ErrnoError(8);
|
|
3015
2898
|
return stream;
|
|
3016
2899
|
} };
|
|
3017
2900
|
function ___syscall__newselect(nfds, readfds, writefds, exceptfds, timeout) {
|
|
@@ -3067,8 +2950,7 @@
|
|
|
3067
2950
|
}
|
|
3068
2951
|
return total;
|
|
3069
2952
|
} catch (e) {
|
|
3070
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3071
|
-
throw e;
|
|
2953
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3072
2954
|
return -e.errno;
|
|
3073
2955
|
}
|
|
3074
2956
|
}
|
|
@@ -3078,8 +2960,7 @@
|
|
|
3078
2960
|
FS.chdir(path);
|
|
3079
2961
|
return 0;
|
|
3080
2962
|
} catch (e) {
|
|
3081
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3082
|
-
throw e;
|
|
2963
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3083
2964
|
return -e.errno;
|
|
3084
2965
|
}
|
|
3085
2966
|
}
|
|
@@ -3339,10 +3220,8 @@
|
|
|
3339
3220
|
try {
|
|
3340
3221
|
sock.sock_ops.listen(sock, 0);
|
|
3341
3222
|
} catch (e) {
|
|
3342
|
-
if (!(e instanceof FS.ErrnoError))
|
|
3343
|
-
|
|
3344
|
-
if (e.errno !== 138)
|
|
3345
|
-
throw e;
|
|
3223
|
+
if (!(e instanceof FS.ErrnoError)) throw e;
|
|
3224
|
+
if (e.errno !== 138) throw e;
|
|
3346
3225
|
}
|
|
3347
3226
|
}
|
|
3348
3227
|
}, connect: function(sock, addr, port) {
|
|
@@ -3489,8 +3368,7 @@
|
|
|
3489
3368
|
} } };
|
|
3490
3369
|
function getSocketFromFD(fd) {
|
|
3491
3370
|
var socket = SOCKFS.getSocket(fd);
|
|
3492
|
-
if (!socket)
|
|
3493
|
-
throw new FS.ErrnoError(8);
|
|
3371
|
+
if (!socket) throw new FS.ErrnoError(8);
|
|
3494
3372
|
return socket;
|
|
3495
3373
|
}
|
|
3496
3374
|
function setErrNo(value) {
|
|
@@ -3526,10 +3404,8 @@
|
|
|
3526
3404
|
}
|
|
3527
3405
|
if (parts[5] === 0) {
|
|
3528
3406
|
str = "::";
|
|
3529
|
-
if (v4part === "0.0.0.0")
|
|
3530
|
-
|
|
3531
|
-
if (v4part === "0.0.0.1")
|
|
3532
|
-
v4part = "1";
|
|
3407
|
+
if (v4part === "0.0.0.0") v4part = "";
|
|
3408
|
+
if (v4part === "0.0.0.1") v4part = "1";
|
|
3533
3409
|
str += v4part;
|
|
3534
3410
|
return str;
|
|
3535
3411
|
}
|
|
@@ -3552,8 +3428,7 @@
|
|
|
3552
3428
|
if (parts[word] === 0 && word >= zstart && word < zstart + longest) {
|
|
3553
3429
|
if (word === zstart) {
|
|
3554
3430
|
str += ":";
|
|
3555
|
-
if (zstart === 0)
|
|
3556
|
-
str += ":";
|
|
3431
|
+
if (zstart === 0) str += ":";
|
|
3557
3432
|
}
|
|
3558
3433
|
continue;
|
|
3559
3434
|
}
|
|
@@ -3591,8 +3466,7 @@
|
|
|
3591
3466
|
var b = str.split(".");
|
|
3592
3467
|
for (var i = 0; i < 4; i++) {
|
|
3593
3468
|
var tmp = Number(b[i]);
|
|
3594
|
-
if (isNaN(tmp))
|
|
3595
|
-
return null;
|
|
3469
|
+
if (isNaN(tmp)) return null;
|
|
3596
3470
|
b[i] = tmp;
|
|
3597
3471
|
}
|
|
3598
3472
|
return (b[0] | b[1] << 8 | b[2] << 16 | b[3] << 24) >>> 0;
|
|
@@ -3670,11 +3544,9 @@
|
|
|
3670
3544
|
return null;
|
|
3671
3545
|
} };
|
|
3672
3546
|
function getSocketAddress(addrp, addrlen, allowNull) {
|
|
3673
|
-
if (allowNull && addrp === 0)
|
|
3674
|
-
return null;
|
|
3547
|
+
if (allowNull && addrp === 0) return null;
|
|
3675
3548
|
var info = readSockaddr(addrp, addrlen);
|
|
3676
|
-
if (info.errno)
|
|
3677
|
-
throw new FS.ErrnoError(info.errno);
|
|
3549
|
+
if (info.errno) throw new FS.ErrnoError(info.errno);
|
|
3678
3550
|
info.addr = DNS.lookup_addr(info.addr) || info.addr;
|
|
3679
3551
|
return info;
|
|
3680
3552
|
}
|
|
@@ -3685,8 +3557,7 @@
|
|
|
3685
3557
|
sock.sock_ops.connect(sock, info.addr, info.port);
|
|
3686
3558
|
return 0;
|
|
3687
3559
|
} catch (e) {
|
|
3688
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3689
|
-
throw e;
|
|
3560
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3690
3561
|
return -e.errno;
|
|
3691
3562
|
}
|
|
3692
3563
|
}
|
|
@@ -3734,24 +3605,20 @@
|
|
|
3734
3605
|
}
|
|
3735
3606
|
}
|
|
3736
3607
|
} catch (e) {
|
|
3737
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3738
|
-
throw e;
|
|
3608
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3739
3609
|
return -e.errno;
|
|
3740
3610
|
}
|
|
3741
3611
|
}
|
|
3742
3612
|
function ___syscall_getcwd(buf, size) {
|
|
3743
3613
|
try {
|
|
3744
|
-
if (size === 0)
|
|
3745
|
-
return -28;
|
|
3614
|
+
if (size === 0) return -28;
|
|
3746
3615
|
var cwd = FS.cwd();
|
|
3747
3616
|
var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
|
|
3748
|
-
if (size < cwdLengthInBytes)
|
|
3749
|
-
return -68;
|
|
3617
|
+
if (size < cwdLengthInBytes) return -68;
|
|
3750
3618
|
stringToUTF8(cwd, buf, size);
|
|
3751
3619
|
return cwdLengthInBytes;
|
|
3752
3620
|
} catch (e) {
|
|
3753
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3754
|
-
throw e;
|
|
3621
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3755
3622
|
return -e.errno;
|
|
3756
3623
|
}
|
|
3757
3624
|
}
|
|
@@ -3762,8 +3629,7 @@
|
|
|
3762
3629
|
switch (op) {
|
|
3763
3630
|
case 21509:
|
|
3764
3631
|
case 21505: {
|
|
3765
|
-
if (!stream.tty)
|
|
3766
|
-
return -59;
|
|
3632
|
+
if (!stream.tty) return -59;
|
|
3767
3633
|
return 0;
|
|
3768
3634
|
}
|
|
3769
3635
|
case 21510:
|
|
@@ -3772,20 +3638,17 @@
|
|
|
3772
3638
|
case 21506:
|
|
3773
3639
|
case 21507:
|
|
3774
3640
|
case 21508: {
|
|
3775
|
-
if (!stream.tty)
|
|
3776
|
-
return -59;
|
|
3641
|
+
if (!stream.tty) return -59;
|
|
3777
3642
|
return 0;
|
|
3778
3643
|
}
|
|
3779
3644
|
case 21519: {
|
|
3780
|
-
if (!stream.tty)
|
|
3781
|
-
return -59;
|
|
3645
|
+
if (!stream.tty) return -59;
|
|
3782
3646
|
var argp = SYSCALLS.get();
|
|
3783
3647
|
HEAP32[argp >> 2] = 0;
|
|
3784
3648
|
return 0;
|
|
3785
3649
|
}
|
|
3786
3650
|
case 21520: {
|
|
3787
|
-
if (!stream.tty)
|
|
3788
|
-
return -59;
|
|
3651
|
+
if (!stream.tty) return -59;
|
|
3789
3652
|
return -28;
|
|
3790
3653
|
}
|
|
3791
3654
|
case 21531: {
|
|
@@ -3793,21 +3656,18 @@
|
|
|
3793
3656
|
return FS.ioctl(stream, op, argp);
|
|
3794
3657
|
}
|
|
3795
3658
|
case 21523: {
|
|
3796
|
-
if (!stream.tty)
|
|
3797
|
-
return -59;
|
|
3659
|
+
if (!stream.tty) return -59;
|
|
3798
3660
|
return 0;
|
|
3799
3661
|
}
|
|
3800
3662
|
case 21524: {
|
|
3801
|
-
if (!stream.tty)
|
|
3802
|
-
return -59;
|
|
3663
|
+
if (!stream.tty) return -59;
|
|
3803
3664
|
return 0;
|
|
3804
3665
|
}
|
|
3805
3666
|
default:
|
|
3806
3667
|
return -28;
|
|
3807
3668
|
}
|
|
3808
3669
|
} catch (e) {
|
|
3809
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3810
|
-
throw e;
|
|
3670
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3811
3671
|
return -e.errno;
|
|
3812
3672
|
}
|
|
3813
3673
|
}
|
|
@@ -3816,13 +3676,11 @@
|
|
|
3816
3676
|
path = SYSCALLS.getStr(path);
|
|
3817
3677
|
path = SYSCALLS.calculateAt(dirfd, path);
|
|
3818
3678
|
path = PATH.normalize(path);
|
|
3819
|
-
if (path[path.length - 1] === "/")
|
|
3820
|
-
path = path.substr(0, path.length - 1);
|
|
3679
|
+
if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1);
|
|
3821
3680
|
FS.mkdir(path, mode, 0);
|
|
3822
3681
|
return 0;
|
|
3823
3682
|
} catch (e) {
|
|
3824
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3825
|
-
throw e;
|
|
3683
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3826
3684
|
return -e.errno;
|
|
3827
3685
|
}
|
|
3828
3686
|
}
|
|
@@ -3834,8 +3692,7 @@
|
|
|
3834
3692
|
var mode = varargs ? SYSCALLS.get() : 0;
|
|
3835
3693
|
return FS.open(path, flags, mode).fd;
|
|
3836
3694
|
} catch (e) {
|
|
3837
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3838
|
-
throw e;
|
|
3695
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3839
3696
|
return -e.errno;
|
|
3840
3697
|
}
|
|
3841
3698
|
}
|
|
@@ -3843,8 +3700,7 @@
|
|
|
3843
3700
|
try {
|
|
3844
3701
|
path = SYSCALLS.getStr(path);
|
|
3845
3702
|
path = SYSCALLS.calculateAt(dirfd, path);
|
|
3846
|
-
if (bufsize <= 0)
|
|
3847
|
-
return -28;
|
|
3703
|
+
if (bufsize <= 0) return -28;
|
|
3848
3704
|
var ret = FS.readlink(path);
|
|
3849
3705
|
var len = Math.min(bufsize, lengthBytesUTF8(ret));
|
|
3850
3706
|
var endChar = HEAP8[buf + len];
|
|
@@ -3852,8 +3708,7 @@
|
|
|
3852
3708
|
HEAP8[buf + len] = endChar;
|
|
3853
3709
|
return len;
|
|
3854
3710
|
} catch (e) {
|
|
3855
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3856
|
-
throw e;
|
|
3711
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3857
3712
|
return -e.errno;
|
|
3858
3713
|
}
|
|
3859
3714
|
}
|
|
@@ -3863,8 +3718,7 @@
|
|
|
3863
3718
|
assert(sock.stream.fd < 64);
|
|
3864
3719
|
return sock.stream.fd;
|
|
3865
3720
|
} catch (e) {
|
|
3866
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
3867
|
-
throw e;
|
|
3721
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
3868
3722
|
return -e.errno;
|
|
3869
3723
|
}
|
|
3870
3724
|
}
|
|
@@ -4561,8 +4415,7 @@
|
|
|
4561
4415
|
function getWasmTableEntry(funcPtr) {
|
|
4562
4416
|
var func = wasmTableMirror[funcPtr];
|
|
4563
4417
|
if (!func) {
|
|
4564
|
-
if (funcPtr >= wasmTableMirror.length)
|
|
4565
|
-
wasmTableMirror.length = funcPtr + 1;
|
|
4418
|
+
if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
|
|
4566
4419
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
4567
4420
|
}
|
|
4568
4421
|
assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!");
|
|
@@ -5047,16 +4900,13 @@
|
|
|
5047
4900
|
var endPtr = ptr;
|
|
5048
4901
|
var idx = endPtr >> 1;
|
|
5049
4902
|
var maxIdx = idx + maxBytesToRead / 2;
|
|
5050
|
-
while (!(idx >= maxIdx) && HEAPU16[idx])
|
|
5051
|
-
++idx;
|
|
4903
|
+
while (!(idx >= maxIdx) && HEAPU16[idx]) ++idx;
|
|
5052
4904
|
endPtr = idx << 1;
|
|
5053
|
-
if (endPtr - ptr > 32 && UTF16Decoder)
|
|
5054
|
-
return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
|
|
4905
|
+
if (endPtr - ptr > 32 && UTF16Decoder) return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
|
|
5055
4906
|
var str = "";
|
|
5056
4907
|
for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {
|
|
5057
4908
|
var codeUnit = HEAP16[ptr + i * 2 >> 1];
|
|
5058
|
-
if (codeUnit == 0)
|
|
5059
|
-
break;
|
|
4909
|
+
if (codeUnit == 0) break;
|
|
5060
4910
|
str += String.fromCharCode(codeUnit);
|
|
5061
4911
|
}
|
|
5062
4912
|
return str;
|
|
@@ -5067,8 +4917,7 @@
|
|
|
5067
4917
|
if (maxBytesToWrite === void 0) {
|
|
5068
4918
|
maxBytesToWrite = 2147483647;
|
|
5069
4919
|
}
|
|
5070
|
-
if (maxBytesToWrite < 2)
|
|
5071
|
-
return 0;
|
|
4920
|
+
if (maxBytesToWrite < 2) return 0;
|
|
5072
4921
|
maxBytesToWrite -= 2;
|
|
5073
4922
|
var startPtr = outPtr;
|
|
5074
4923
|
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
@@ -5089,8 +4938,7 @@
|
|
|
5089
4938
|
var str = "";
|
|
5090
4939
|
while (!(i >= maxBytesToRead / 4)) {
|
|
5091
4940
|
var utf32 = HEAP32[ptr + i * 4 >> 2];
|
|
5092
|
-
if (utf32 == 0)
|
|
5093
|
-
break;
|
|
4941
|
+
if (utf32 == 0) break;
|
|
5094
4942
|
++i;
|
|
5095
4943
|
if (utf32 >= 65536) {
|
|
5096
4944
|
var ch = utf32 - 65536;
|
|
@@ -5107,8 +4955,7 @@
|
|
|
5107
4955
|
if (maxBytesToWrite === void 0) {
|
|
5108
4956
|
maxBytesToWrite = 2147483647;
|
|
5109
4957
|
}
|
|
5110
|
-
if (maxBytesToWrite < 4)
|
|
5111
|
-
return 0;
|
|
4958
|
+
if (maxBytesToWrite < 4) return 0;
|
|
5112
4959
|
var startPtr = outPtr;
|
|
5113
4960
|
var endPtr = startPtr + maxBytesToWrite - 4;
|
|
5114
4961
|
for (var i = 0; i < str.length; ++i) {
|
|
@@ -5119,8 +4966,7 @@
|
|
|
5119
4966
|
}
|
|
5120
4967
|
HEAP32[outPtr >> 2] = codeUnit;
|
|
5121
4968
|
outPtr += 4;
|
|
5122
|
-
if (outPtr + 4 > endPtr)
|
|
5123
|
-
break;
|
|
4969
|
+
if (outPtr + 4 > endPtr) break;
|
|
5124
4970
|
}
|
|
5125
4971
|
HEAP32[outPtr >> 2] = 0;
|
|
5126
4972
|
return outPtr - startPtr;
|
|
@@ -5129,8 +4975,7 @@
|
|
|
5129
4975
|
var len = 0;
|
|
5130
4976
|
for (var i = 0; i < str.length; ++i) {
|
|
5131
4977
|
var codeUnit = str.charCodeAt(i);
|
|
5132
|
-
if (codeUnit >= 55296 && codeUnit <= 57343)
|
|
5133
|
-
++i;
|
|
4978
|
+
if (codeUnit >= 55296 && codeUnit <= 57343) ++i;
|
|
5134
4979
|
len += 4;
|
|
5135
4980
|
}
|
|
5136
4981
|
return len;
|
|
@@ -5254,8 +5099,7 @@
|
|
|
5254
5099
|
function allocateUTF8(str) {
|
|
5255
5100
|
var size = lengthBytesUTF8(str) + 1;
|
|
5256
5101
|
var ret = _malloc(size);
|
|
5257
|
-
if (ret)
|
|
5258
|
-
stringToUTF8Array(str, HEAP8, ret, size);
|
|
5102
|
+
if (ret) stringToUTF8Array(str, HEAP8, ret, size);
|
|
5259
5103
|
return ret;
|
|
5260
5104
|
}
|
|
5261
5105
|
function __tzset_js(timezone, daylight, tzname) {
|
|
@@ -5305,8 +5149,7 @@
|
|
|
5305
5149
|
}
|
|
5306
5150
|
function runEmAsmFunction(code, sigPtr, argbuf) {
|
|
5307
5151
|
var args = readEmAsmArgs(sigPtr, argbuf);
|
|
5308
|
-
if (!ASM_CONSTS.hasOwnProperty(code))
|
|
5309
|
-
abort("No EM_ASM constant found at address " + code);
|
|
5152
|
+
if (!ASM_CONSTS.hasOwnProperty(code)) abort("No EM_ASM constant found at address " + code);
|
|
5310
5153
|
return ASM_CONSTS[code].apply(null, args);
|
|
5311
5154
|
}
|
|
5312
5155
|
function _emscripten_asm_const_int(code, sigPtr, argbuf) {
|
|
@@ -5362,10 +5205,8 @@
|
|
|
5362
5205
|
var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
|
|
5363
5206
|
var env = { "USER": "web_user", "LOGNAME": "web_user", "PATH": "/", "PWD": "/", "HOME": "/home/web_user", "LANG": lang, "_": getExecutableName() };
|
|
5364
5207
|
for (var x in ENV) {
|
|
5365
|
-
if (ENV[x] === void 0)
|
|
5366
|
-
|
|
5367
|
-
else
|
|
5368
|
-
env[x] = ENV[x];
|
|
5208
|
+
if (ENV[x] === void 0) delete env[x];
|
|
5209
|
+
else env[x] = ENV[x];
|
|
5369
5210
|
}
|
|
5370
5211
|
var strings = [];
|
|
5371
5212
|
for (var x in env) {
|
|
@@ -5380,8 +5221,7 @@
|
|
|
5380
5221
|
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255));
|
|
5381
5222
|
HEAP8[buffer++ >> 0] = str.charCodeAt(i);
|
|
5382
5223
|
}
|
|
5383
|
-
if (!dontAddNull)
|
|
5384
|
-
HEAP8[buffer >> 0] = 0;
|
|
5224
|
+
if (!dontAddNull) HEAP8[buffer >> 0] = 0;
|
|
5385
5225
|
}
|
|
5386
5226
|
function _environ_get(__environ, environ_buf) {
|
|
5387
5227
|
var bufSize = 0;
|
|
@@ -5409,8 +5249,7 @@
|
|
|
5409
5249
|
FS.close(stream);
|
|
5410
5250
|
return 0;
|
|
5411
5251
|
} catch (e) {
|
|
5412
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
5413
|
-
throw e;
|
|
5252
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
5414
5253
|
return e.errno;
|
|
5415
5254
|
}
|
|
5416
5255
|
}
|
|
@@ -5421,8 +5260,7 @@
|
|
|
5421
5260
|
HEAP8[pbuf >> 0] = type;
|
|
5422
5261
|
return 0;
|
|
5423
5262
|
} catch (e) {
|
|
5424
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
5425
|
-
throw e;
|
|
5263
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
5426
5264
|
return e.errno;
|
|
5427
5265
|
}
|
|
5428
5266
|
}
|
|
@@ -5433,11 +5271,9 @@
|
|
|
5433
5271
|
var len = HEAPU32[iov + 4 >> 2];
|
|
5434
5272
|
iov += 8;
|
|
5435
5273
|
var curr = FS.read(stream, HEAP8, ptr, len, offset);
|
|
5436
|
-
if (curr < 0)
|
|
5437
|
-
return -1;
|
|
5274
|
+
if (curr < 0) return -1;
|
|
5438
5275
|
ret += curr;
|
|
5439
|
-
if (curr < len)
|
|
5440
|
-
break;
|
|
5276
|
+
if (curr < len) break;
|
|
5441
5277
|
if (typeof offset !== "undefined") {
|
|
5442
5278
|
offset += curr;
|
|
5443
5279
|
}
|
|
@@ -5451,8 +5287,7 @@
|
|
|
5451
5287
|
HEAPU32[pnum >> 2] = num;
|
|
5452
5288
|
return 0;
|
|
5453
5289
|
} catch (e) {
|
|
5454
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
5455
|
-
throw e;
|
|
5290
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
5456
5291
|
return e.errno;
|
|
5457
5292
|
}
|
|
5458
5293
|
}
|
|
@@ -5464,17 +5299,14 @@
|
|
|
5464
5299
|
function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
|
|
5465
5300
|
try {
|
|
5466
5301
|
var offset = convertI32PairToI53Checked(offset_low, offset_high);
|
|
5467
|
-
if (isNaN(offset))
|
|
5468
|
-
return 61;
|
|
5302
|
+
if (isNaN(offset)) return 61;
|
|
5469
5303
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
5470
5304
|
FS.llseek(stream, offset, whence);
|
|
5471
5305
|
tempI64 = [stream.position >>> 0, (tempDouble = stream.position, +Math.abs(tempDouble) >= 1 ? tempDouble > 0 ? (Math.min(+Math.floor(tempDouble / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((tempDouble - +(~~tempDouble >>> 0)) / 4294967296) >>> 0 : 0)], HEAP32[newOffset >> 2] = tempI64[0], HEAP32[newOffset + 4 >> 2] = tempI64[1];
|
|
5472
|
-
if (stream.getdents && offset === 0 && whence === 0)
|
|
5473
|
-
stream.getdents = null;
|
|
5306
|
+
if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
|
|
5474
5307
|
return 0;
|
|
5475
5308
|
} catch (e) {
|
|
5476
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
5477
|
-
throw e;
|
|
5309
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
5478
5310
|
return e.errno;
|
|
5479
5311
|
}
|
|
5480
5312
|
}
|
|
@@ -5485,8 +5317,7 @@
|
|
|
5485
5317
|
var len = HEAPU32[iov + 4 >> 2];
|
|
5486
5318
|
iov += 8;
|
|
5487
5319
|
var curr = FS.write(stream, HEAP8, ptr, len, offset);
|
|
5488
|
-
if (curr < 0)
|
|
5489
|
-
return -1;
|
|
5320
|
+
if (curr < 0) return -1;
|
|
5490
5321
|
ret += curr;
|
|
5491
5322
|
if (typeof offset !== "undefined") {
|
|
5492
5323
|
offset += curr;
|
|
@@ -5501,8 +5332,7 @@
|
|
|
5501
5332
|
HEAPU32[pnum >> 2] = num;
|
|
5502
5333
|
return 0;
|
|
5503
5334
|
} catch (e) {
|
|
5504
|
-
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
|
|
5505
|
-
throw e;
|
|
5335
|
+
if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
|
|
5506
5336
|
return e.errno;
|
|
5507
5337
|
}
|
|
5508
5338
|
}
|
|
@@ -5648,10 +5478,8 @@
|
|
|
5648
5478
|
return leadingNulls(date2.tm_hour, 2);
|
|
5649
5479
|
}, "%I": function(date2) {
|
|
5650
5480
|
var twelveHour = date2.tm_hour;
|
|
5651
|
-
if (twelveHour == 0)
|
|
5652
|
-
|
|
5653
|
-
else if (twelveHour > 12)
|
|
5654
|
-
twelveHour -= 12;
|
|
5481
|
+
if (twelveHour == 0) twelveHour = 12;
|
|
5482
|
+
else if (twelveHour > 12) twelveHour -= 12;
|
|
5655
5483
|
return leadingNulls(twelveHour, 2);
|
|
5656
5484
|
}, "%j": function(date2) {
|
|
5657
5485
|
return leadingNulls(date2.tm_mday + __arraySum(__isLeapYear(date2.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date2.tm_mon - 1), 3);
|
|
@@ -5688,8 +5516,7 @@
|
|
|
5688
5516
|
}
|
|
5689
5517
|
} else if (val == 53) {
|
|
5690
5518
|
var jan1 = (date2.tm_wday + 371 - date2.tm_yday) % 7;
|
|
5691
|
-
if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year)))
|
|
5692
|
-
val = 1;
|
|
5519
|
+
if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year))) val = 1;
|
|
5693
5520
|
}
|
|
5694
5521
|
return leadingNulls(val, 2);
|
|
5695
5522
|
}, "%w": function(date2) {
|
|
@@ -5873,10 +5700,8 @@
|
|
|
5873
5700
|
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
5874
5701
|
var calledRun;
|
|
5875
5702
|
dependenciesFulfilled = function runCaller() {
|
|
5876
|
-
if (!calledRun)
|
|
5877
|
-
|
|
5878
|
-
if (!calledRun)
|
|
5879
|
-
dependenciesFulfilled = runCaller;
|
|
5703
|
+
if (!calledRun) run();
|
|
5704
|
+
if (!calledRun) dependenciesFulfilled = runCaller;
|
|
5880
5705
|
};
|
|
5881
5706
|
function stackCheckInit() {
|
|
5882
5707
|
_emscripten_stack_init();
|
|
@@ -5892,16 +5717,13 @@
|
|
|
5892
5717
|
return;
|
|
5893
5718
|
}
|
|
5894
5719
|
function doRun() {
|
|
5895
|
-
if (calledRun)
|
|
5896
|
-
return;
|
|
5720
|
+
if (calledRun) return;
|
|
5897
5721
|
calledRun = true;
|
|
5898
5722
|
Module["calledRun"] = true;
|
|
5899
|
-
if (ABORT)
|
|
5900
|
-
return;
|
|
5723
|
+
if (ABORT) return;
|
|
5901
5724
|
initRuntime();
|
|
5902
5725
|
readyPromiseResolve(Module);
|
|
5903
|
-
if (Module["onRuntimeInitialized"])
|
|
5904
|
-
Module["onRuntimeInitialized"]();
|
|
5726
|
+
if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
|
|
5905
5727
|
assert(!Module["_main"], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
|
|
5906
5728
|
postRun();
|
|
5907
5729
|
}
|
|
@@ -5919,15 +5741,14 @@
|
|
|
5919
5741
|
checkStackCookie();
|
|
5920
5742
|
}
|
|
5921
5743
|
if (Module["preInit"]) {
|
|
5922
|
-
if (typeof Module["preInit"] == "function")
|
|
5923
|
-
Module["preInit"] = [Module["preInit"]];
|
|
5744
|
+
if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
|
|
5924
5745
|
while (Module["preInit"].length > 0) {
|
|
5925
5746
|
Module["preInit"].pop()();
|
|
5926
5747
|
}
|
|
5927
5748
|
}
|
|
5928
5749
|
run();
|
|
5929
5750
|
return FaustModule2.ready;
|
|
5930
|
-
};
|
|
5751
|
+
});
|
|
5931
5752
|
})();
|
|
5932
5753
|
if (typeof exports === "object" && typeof module === "object")
|
|
5933
5754
|
module.exports = FaustModule;
|
|
@@ -6068,8 +5889,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6068
5889
|
const faustModule = await FaustModule({
|
|
6069
5890
|
wasmBinary,
|
|
6070
5891
|
getPreloadedPackage: (remotePackageName, remotePackageSize) => {
|
|
6071
|
-
if (remotePackageName === "libfaust-wasm.data")
|
|
6072
|
-
return dataBinary;
|
|
5892
|
+
if (remotePackageName === "libfaust-wasm.data") return dataBinary;
|
|
6073
5893
|
return new ArrayBuffer(0);
|
|
6074
5894
|
}
|
|
6075
5895
|
});
|
|
@@ -6095,8 +5915,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6095
5915
|
const analysePolyParameters = (item) => {
|
|
6096
5916
|
const polyKeywords = ["/gate", "/freq", "/gain", "/key", "/vel", "/velocity"];
|
|
6097
5917
|
const isPolyReserved = "address" in item && !!polyKeywords.find((k) => item.address.endsWith(k));
|
|
6098
|
-
if (poly && isPolyReserved)
|
|
6099
|
-
return null;
|
|
5918
|
+
if (poly && isPolyReserved) return null;
|
|
6100
5919
|
if (item.type === "vslider" || item.type === "hslider" || item.type === "nentry") {
|
|
6101
5920
|
return { name: item.address, defaultValue: item.init || 0, minValue: item.min || 0, maxValue: item.max || 0 };
|
|
6102
5921
|
} else if (item.type === "button" || item.type === "checkbox") {
|
|
@@ -6114,37 +5933,30 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6114
5933
|
this.paramValuesCache[pd.name] = pd.defaultValue || 0;
|
|
6115
5934
|
});
|
|
6116
5935
|
const { moduleId, instanceId } = options.processorOptions;
|
|
6117
|
-
if (!moduleId || !instanceId)
|
|
6118
|
-
return;
|
|
5936
|
+
if (!moduleId || !instanceId) return;
|
|
6119
5937
|
this.wamInfo = { moduleId, instanceId };
|
|
6120
5938
|
}
|
|
6121
5939
|
static get parameterDescriptors() {
|
|
6122
5940
|
const params = [];
|
|
6123
5941
|
const callback = (item) => {
|
|
6124
5942
|
const param = analysePolyParameters(item);
|
|
6125
|
-
if (param)
|
|
6126
|
-
params.push(param);
|
|
5943
|
+
if (param) params.push(param);
|
|
6127
5944
|
};
|
|
6128
5945
|
FaustBaseWebAudioDsp2.parseUI(dspMeta.ui, callback);
|
|
6129
|
-
if (effectMeta)
|
|
6130
|
-
FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
|
|
5946
|
+
if (effectMeta) FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
|
|
6131
5947
|
return params;
|
|
6132
5948
|
}
|
|
6133
5949
|
setupWamEventHandler() {
|
|
6134
5950
|
var _a;
|
|
6135
|
-
if (!this.wamInfo)
|
|
6136
|
-
return;
|
|
5951
|
+
if (!this.wamInfo) return;
|
|
6137
5952
|
const { moduleId, instanceId } = this.wamInfo;
|
|
6138
5953
|
const { webAudioModules } = globalThis;
|
|
6139
5954
|
const ModuleScope = webAudioModules.getModuleScope(moduleId);
|
|
6140
5955
|
const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
|
|
6141
|
-
if (!paramMgrProcessor)
|
|
6142
|
-
|
|
6143
|
-
if (paramMgrProcessor.handleEvent)
|
|
6144
|
-
return;
|
|
5956
|
+
if (!paramMgrProcessor) return;
|
|
5957
|
+
if (paramMgrProcessor.handleEvent) return;
|
|
6145
5958
|
paramMgrProcessor.handleEvent = (event) => {
|
|
6146
|
-
if (event.type === "wam-midi")
|
|
6147
|
-
this.midiMessage(event.data.bytes);
|
|
5959
|
+
if (event.type === "wam-midi") this.midiMessage(event.data.bytes);
|
|
6148
5960
|
};
|
|
6149
5961
|
}
|
|
6150
5962
|
process(inputs, outputs, parameters) {
|
|
@@ -6174,10 +5986,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6174
5986
|
handleMessageAux(e) {
|
|
6175
5987
|
const msg = e.data;
|
|
6176
5988
|
switch (msg.type) {
|
|
5989
|
+
// Generic MIDI message
|
|
6177
5990
|
case "midi": {
|
|
6178
5991
|
this.midiMessage(msg.data);
|
|
6179
5992
|
break;
|
|
6180
5993
|
}
|
|
5994
|
+
// Typed MIDI message
|
|
6181
5995
|
case "ctrlChange": {
|
|
6182
5996
|
this.ctrlChange(msg.data[0], msg.data[1], msg.data[2]);
|
|
6183
5997
|
break;
|
|
@@ -6194,10 +6008,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6194
6008
|
this.keyOff(msg.data[0], msg.data[1], msg.data[2]);
|
|
6195
6009
|
break;
|
|
6196
6010
|
}
|
|
6011
|
+
// Generic data message
|
|
6197
6012
|
case "param": {
|
|
6198
6013
|
this.setParamValue(msg.data.path, msg.data.value);
|
|
6199
6014
|
break;
|
|
6200
6015
|
}
|
|
6016
|
+
// Plot handler set on demand
|
|
6201
6017
|
case "setPlotHandler": {
|
|
6202
6018
|
if (msg.data) {
|
|
6203
6019
|
this.fDSPCode.setPlotHandler((output, index, events) => this.port.postMessage({ type: "plot", value: output, index, events }));
|
|
@@ -6301,12 +6117,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6301
6117
|
const channel = data[0] & 15;
|
|
6302
6118
|
const data1 = data[1];
|
|
6303
6119
|
const data2 = data[2];
|
|
6304
|
-
if (cmd === 8 || cmd === 9 && data2 === 0)
|
|
6305
|
-
|
|
6306
|
-
else
|
|
6307
|
-
this.keyOn(channel, data1, data2);
|
|
6308
|
-
else
|
|
6309
|
-
super.midiMessage(data);
|
|
6120
|
+
if (cmd === 8 || cmd === 9 && data2 === 0) this.keyOff(channel, data1, data2);
|
|
6121
|
+
else if (cmd === 9) this.keyOn(channel, data1, data2);
|
|
6122
|
+
else super.midiMessage(data);
|
|
6310
6123
|
}
|
|
6311
6124
|
// Public API
|
|
6312
6125
|
keyOn(channel, pitch, velocity) {
|
|
@@ -6372,10 +6185,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6372
6185
|
while (spilled < spillLength) {
|
|
6373
6186
|
const $spillLength = Math.min(spillLength - spilled, toLength - $to, fromLength - $from);
|
|
6374
6187
|
const $fromEnd = $from + $spillLength;
|
|
6375
|
-
if ($from === 0 && $fromEnd === fromLength)
|
|
6376
|
-
|
|
6377
|
-
else
|
|
6378
|
-
to.set(from.subarray($from, $fromEnd), $to);
|
|
6188
|
+
if ($from === 0 && $fromEnd === fromLength) to.set(from, $to);
|
|
6189
|
+
else to.set(from.subarray($from, $fromEnd), $to);
|
|
6379
6190
|
$to = ($to + $spillLength) % toLength;
|
|
6380
6191
|
$from = $fromEnd % fromLength;
|
|
6381
6192
|
spilled += $spillLength;
|
|
@@ -6384,8 +6195,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6384
6195
|
};
|
|
6385
6196
|
const analyseParameters = (item) => {
|
|
6386
6197
|
const isFFTReserved = "address" in item && !!fftParamKeywords.find((k) => item.address.endsWith(k));
|
|
6387
|
-
if (isFFTReserved)
|
|
6388
|
-
return null;
|
|
6198
|
+
if (isFFTReserved) return null;
|
|
6389
6199
|
if (item.type === "vslider" || item.type === "hslider" || item.type === "nentry") {
|
|
6390
6200
|
return { name: item.address, defaultValue: item.init || 0, minValue: item.min || 0, maxValue: item.max || 0 };
|
|
6391
6201
|
} else if (item.type === "button" || item.type === "checkbox") {
|
|
@@ -6426,23 +6236,26 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6426
6236
|
var _a, _b, _c;
|
|
6427
6237
|
const msg = e.data;
|
|
6428
6238
|
switch (msg.type) {
|
|
6239
|
+
// Generic MIDI message
|
|
6429
6240
|
case "midi":
|
|
6430
6241
|
this.midiMessage(msg.data);
|
|
6431
6242
|
break;
|
|
6243
|
+
// Typed MIDI message
|
|
6432
6244
|
case "ctrlChange":
|
|
6433
6245
|
this.ctrlChange(msg.data[0], msg.data[1], msg.data[2]);
|
|
6434
6246
|
break;
|
|
6435
6247
|
case "pitchWheel":
|
|
6436
6248
|
this.pitchWheel(msg.data[0], msg.data[1]);
|
|
6437
6249
|
break;
|
|
6250
|
+
// Generic data message
|
|
6438
6251
|
case "param":
|
|
6439
6252
|
this.setParamValue(msg.data.path, msg.data.value);
|
|
6440
6253
|
break;
|
|
6254
|
+
// Plot handler set on demand
|
|
6441
6255
|
case "setPlotHandler": {
|
|
6442
6256
|
if (msg.data) {
|
|
6443
6257
|
this.fPlotHandler = (output, index, events) => {
|
|
6444
|
-
if (events)
|
|
6445
|
-
this.fCachedEvents.push(...events);
|
|
6258
|
+
if (events) this.fCachedEvents.push(...events);
|
|
6446
6259
|
};
|
|
6447
6260
|
} else {
|
|
6448
6261
|
this.fPlotHandler = null;
|
|
@@ -6484,8 +6297,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6484
6297
|
this.soundfiles = factory.soundfiles;
|
|
6485
6298
|
this.initFFT();
|
|
6486
6299
|
const { moduleId, instanceId } = options.processorOptions;
|
|
6487
|
-
if (!moduleId || !instanceId)
|
|
6488
|
-
return;
|
|
6300
|
+
if (!moduleId || !instanceId) return;
|
|
6489
6301
|
this.wamInfo = { moduleId, instanceId };
|
|
6490
6302
|
}
|
|
6491
6303
|
get fftProcessorBufferSize() {
|
|
@@ -6500,8 +6312,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6500
6312
|
const params = [];
|
|
6501
6313
|
const callback = (item) => {
|
|
6502
6314
|
const param = analyseParameters(item);
|
|
6503
|
-
if (param)
|
|
6504
|
-
params.push(param);
|
|
6315
|
+
if (param) params.push(param);
|
|
6505
6316
|
};
|
|
6506
6317
|
FaustBaseWebAudioDsp2.parseUI(dspMeta.ui, callback);
|
|
6507
6318
|
return [
|
|
@@ -6534,19 +6345,15 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6534
6345
|
}
|
|
6535
6346
|
setupWamEventHandler() {
|
|
6536
6347
|
var _a;
|
|
6537
|
-
if (!this.wamInfo)
|
|
6538
|
-
return;
|
|
6348
|
+
if (!this.wamInfo) return;
|
|
6539
6349
|
const { moduleId, instanceId } = this.wamInfo;
|
|
6540
6350
|
const { webAudioModules } = globalThis;
|
|
6541
6351
|
const ModuleScope = webAudioModules.getModuleScope(moduleId);
|
|
6542
6352
|
const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
|
|
6543
|
-
if (!paramMgrProcessor)
|
|
6544
|
-
|
|
6545
|
-
if (paramMgrProcessor.handleEvent)
|
|
6546
|
-
return;
|
|
6353
|
+
if (!paramMgrProcessor) return;
|
|
6354
|
+
if (paramMgrProcessor.handleEvent) return;
|
|
6547
6355
|
paramMgrProcessor.handleEvent = (event) => {
|
|
6548
|
-
if (event.type === "wam-midi")
|
|
6549
|
-
this.midiMessage(event.data.bytes);
|
|
6356
|
+
if (event.type === "wam-midi") this.midiMessage(event.data.bytes);
|
|
6550
6357
|
};
|
|
6551
6358
|
}
|
|
6552
6359
|
processFFT() {
|
|
@@ -6564,10 +6371,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6564
6371
|
fftToSignal(ffted, inputs[i * 3], inputs[i * 3 + 1], inputs[i * 3 + 2]);
|
|
6565
6372
|
}
|
|
6566
6373
|
for (let i = this.fftInput.length * 3; i < inputs.length; i++) {
|
|
6567
|
-
if (i % 3 === 2)
|
|
6568
|
-
|
|
6569
|
-
else
|
|
6570
|
-
inputs[i].fill(0);
|
|
6374
|
+
if (i % 3 === 2) inputs[i].forEach((v, j) => inputs[i][j] = j);
|
|
6375
|
+
else inputs[i].fill(0);
|
|
6571
6376
|
}
|
|
6572
6377
|
}, (outputs) => {
|
|
6573
6378
|
fftProcessorOutputs = outputs;
|
|
@@ -6592,14 +6397,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6592
6397
|
for (let j = 0; j < iffted.length - this.fftHopSize; j++) {
|
|
6593
6398
|
$ = mod(this.$outputWrite + j, this.fftBufferSize);
|
|
6594
6399
|
this.fftOutput[i][$] += iffted[j];
|
|
6595
|
-
if (i === 0)
|
|
6596
|
-
this.windowSumSquare[$] += this.noIFFT ? this.window[j] : this.window[j] ** 2;
|
|
6400
|
+
if (i === 0) this.windowSumSquare[$] += this.noIFFT ? this.window[j] : this.window[j] ** 2;
|
|
6597
6401
|
}
|
|
6598
6402
|
for (let j = iffted.length - this.fftHopSize; j < iffted.length; j++) {
|
|
6599
6403
|
$ = mod(this.$outputWrite + j, this.fftBufferSize);
|
|
6600
6404
|
this.fftOutput[i][$] = iffted[j];
|
|
6601
|
-
if (i === 0)
|
|
6602
|
-
this.windowSumSquare[$] = this.noIFFT ? this.window[j] : this.window[j] ** 2;
|
|
6405
|
+
if (i === 0) this.windowSumSquare[$] = this.noIFFT ? this.window[j] : this.window[j] ** 2;
|
|
6603
6406
|
}
|
|
6604
6407
|
}
|
|
6605
6408
|
this.$outputWrite += this.fftHopSize;
|
|
@@ -6607,10 +6410,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6607
6410
|
}
|
|
6608
6411
|
}
|
|
6609
6412
|
process(inputs, outputs, parameters) {
|
|
6610
|
-
if (this.destroyed)
|
|
6611
|
-
|
|
6612
|
-
if (!this.FFT)
|
|
6613
|
-
return true;
|
|
6413
|
+
if (this.destroyed) return false;
|
|
6414
|
+
if (!this.FFT) return true;
|
|
6614
6415
|
const input = inputs[0];
|
|
6615
6416
|
const output = outputs[0];
|
|
6616
6417
|
const inputChannels = (input == null ? void 0 : input.length) || 0;
|
|
@@ -6618,11 +6419,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6618
6419
|
const bufferSize = (input == null ? void 0 : input.length) ? Math.max(...input.map((c) => c.length)) || 128 : 128;
|
|
6619
6420
|
this.noIFFT = !!parameters.noIFFT[0];
|
|
6620
6421
|
this.resetFFT(~~parameters.fftSize[0], ~~parameters.fftOverlap[0], ~~parameters.windowFunction[0], inputChannels, outputChannels, bufferSize);
|
|
6621
|
-
if (!this.fDSPCode)
|
|
6622
|
-
return true;
|
|
6422
|
+
if (!this.fDSPCode) return true;
|
|
6623
6423
|
for (const path in parameters) {
|
|
6624
|
-
if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k)))
|
|
6625
|
-
continue;
|
|
6424
|
+
if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k))) continue;
|
|
6626
6425
|
const [paramValue] = parameters[path];
|
|
6627
6426
|
if (paramValue !== this.paramValuesCache[path]) {
|
|
6628
6427
|
this.setParamValue(path, paramValue);
|
|
@@ -6716,8 +6515,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6716
6515
|
this.$outputWrite = 0;
|
|
6717
6516
|
this.$outputRead = -latency;
|
|
6718
6517
|
this.fftBufferSize = Math.max(fftSize * 2 - this.fftHopSize, bufferSize * 2);
|
|
6719
|
-
if (!fftSizeChanged && this.fftHopSizeParam)
|
|
6720
|
-
(_a = this.fDSPCode) == null ? void 0 : _a.setParamValue(this.fftHopSizeParam, this.fftHopSize);
|
|
6518
|
+
if (!fftSizeChanged && this.fftHopSizeParam) (_a = this.fDSPCode) == null ? void 0 : _a.setParamValue(this.fftHopSizeParam, this.fftHopSize);
|
|
6721
6519
|
}
|
|
6722
6520
|
if (fftSizeChanged) {
|
|
6723
6521
|
(_b = this.rfft) == null ? void 0 : _b.dispose();
|
|
@@ -6729,8 +6527,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6729
6527
|
this.windowFunction = windowFunction;
|
|
6730
6528
|
this.window = new Float32Array(fftSize);
|
|
6731
6529
|
this.window.fill(1);
|
|
6732
|
-
if (windowFunction)
|
|
6733
|
-
apply(this.window, windowFunction);
|
|
6530
|
+
if (windowFunction) apply(this.window, windowFunction);
|
|
6734
6531
|
this.windowSumSquare = new Float32Array(this.fftBufferSize);
|
|
6735
6532
|
}
|
|
6736
6533
|
if (this.fftInput.length > inputChannels) {
|
|
@@ -6769,16 +6566,13 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6769
6566
|
const params = this.fDSPCode.getParams();
|
|
6770
6567
|
this.fDSPCode.start();
|
|
6771
6568
|
for (const path in this.paramValuesCache) {
|
|
6772
|
-
if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k)))
|
|
6773
|
-
continue;
|
|
6569
|
+
if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k))) continue;
|
|
6774
6570
|
this.fDSPCode.setParamValue(path, this.paramValuesCache[path]);
|
|
6775
6571
|
}
|
|
6776
6572
|
const fftSizeParam = params.find((s) => s.endsWith("/fftSize"));
|
|
6777
|
-
if (fftSizeParam)
|
|
6778
|
-
this.fDSPCode.setParamValue(fftSizeParam, this.fftSize);
|
|
6573
|
+
if (fftSizeParam) this.fDSPCode.setParamValue(fftSizeParam, this.fftSize);
|
|
6779
6574
|
this.fftHopSizeParam = params.find((s) => s.endsWith("/fftHopSize"));
|
|
6780
|
-
if (this.fftHopSizeParam)
|
|
6781
|
-
this.fDSPCode.setParamValue(this.fftHopSizeParam, this.fftHopSize);
|
|
6575
|
+
if (this.fftHopSizeParam) this.fDSPCode.setParamValue(this.fftHopSizeParam, this.fftHopSize);
|
|
6782
6576
|
this.fftProcessorZeros = new Float32Array(this.fftProcessorBufferSize);
|
|
6783
6577
|
}
|
|
6784
6578
|
destroy() {
|
|
@@ -6831,8 +6625,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6831
6625
|
}
|
|
6832
6626
|
function __generator(thisArg, body) {
|
|
6833
6627
|
var _ = { label: 0, sent: function() {
|
|
6834
|
-
if (t[0] & 1)
|
|
6835
|
-
throw t[1];
|
|
6628
|
+
if (t[0] & 1) throw t[1];
|
|
6836
6629
|
return t[1];
|
|
6837
6630
|
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
6838
6631
|
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
@@ -6844,64 +6637,58 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6844
6637
|
};
|
|
6845
6638
|
}
|
|
6846
6639
|
function step(op) {
|
|
6847
|
-
if (f)
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6640
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
6641
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
6642
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6643
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6644
|
+
switch (op[0]) {
|
|
6645
|
+
case 0:
|
|
6646
|
+
case 1:
|
|
6647
|
+
t = op;
|
|
6648
|
+
break;
|
|
6649
|
+
case 4:
|
|
6650
|
+
_.label++;
|
|
6651
|
+
return { value: op[1], done: false };
|
|
6652
|
+
case 5:
|
|
6653
|
+
_.label++;
|
|
6654
|
+
y = op[1];
|
|
6655
|
+
op = [0];
|
|
6656
|
+
continue;
|
|
6657
|
+
case 7:
|
|
6658
|
+
op = _.ops.pop();
|
|
6659
|
+
_.trys.pop();
|
|
6660
|
+
continue;
|
|
6661
|
+
default:
|
|
6662
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
6663
|
+
_ = 0;
|
|
6664
|
+
continue;
|
|
6665
|
+
}
|
|
6666
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
6667
|
+
_.label = op[1];
|
|
6668
|
+
break;
|
|
6669
|
+
}
|
|
6670
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
6671
|
+
_.label = t[1];
|
|
6858
6672
|
t = op;
|
|
6859
6673
|
break;
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
op = _.ops.pop();
|
|
6870
|
-
_.trys.pop();
|
|
6871
|
-
continue;
|
|
6872
|
-
default:
|
|
6873
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
6874
|
-
_ = 0;
|
|
6875
|
-
continue;
|
|
6876
|
-
}
|
|
6877
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
6878
|
-
_.label = op[1];
|
|
6879
|
-
break;
|
|
6880
|
-
}
|
|
6881
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
6882
|
-
_.label = t[1];
|
|
6883
|
-
t = op;
|
|
6884
|
-
break;
|
|
6885
|
-
}
|
|
6886
|
-
if (t && _.label < t[2]) {
|
|
6887
|
-
_.label = t[2];
|
|
6888
|
-
_.ops.push(op);
|
|
6889
|
-
break;
|
|
6890
|
-
}
|
|
6891
|
-
if (t[2])
|
|
6892
|
-
_.ops.pop();
|
|
6893
|
-
_.trys.pop();
|
|
6894
|
-
continue;
|
|
6895
|
-
}
|
|
6896
|
-
op = body.call(thisArg, _);
|
|
6897
|
-
} catch (e) {
|
|
6898
|
-
op = [6, e];
|
|
6899
|
-
y = 0;
|
|
6900
|
-
} finally {
|
|
6901
|
-
f = t = 0;
|
|
6674
|
+
}
|
|
6675
|
+
if (t && _.label < t[2]) {
|
|
6676
|
+
_.label = t[2];
|
|
6677
|
+
_.ops.push(op);
|
|
6678
|
+
break;
|
|
6679
|
+
}
|
|
6680
|
+
if (t[2]) _.ops.pop();
|
|
6681
|
+
_.trys.pop();
|
|
6682
|
+
continue;
|
|
6902
6683
|
}
|
|
6903
|
-
|
|
6904
|
-
|
|
6684
|
+
op = body.call(thisArg, _);
|
|
6685
|
+
} catch (e) {
|
|
6686
|
+
op = [6, e];
|
|
6687
|
+
y = 0;
|
|
6688
|
+
} finally {
|
|
6689
|
+
f = t = 0;
|
|
6690
|
+
}
|
|
6691
|
+
if (op[0] & 5) throw op[1];
|
|
6905
6692
|
return { value: op[0] ? op[1] : void 0, done: true };
|
|
6906
6693
|
}
|
|
6907
6694
|
}
|
|
@@ -6990,7 +6777,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
6990
6777
|
// node_modules/@aws-crypto/sha256-js/build/module/RawSha256.js
|
|
6991
6778
|
var RawSha256 = (
|
|
6992
6779
|
/** @class */
|
|
6993
|
-
function() {
|
|
6780
|
+
(function() {
|
|
6994
6781
|
function RawSha2562() {
|
|
6995
6782
|
this.state = Int32Array.from(INIT);
|
|
6996
6783
|
this.temp = new Int32Array(64);
|
|
@@ -7082,7 +6869,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
7082
6869
|
state[7] += state7;
|
|
7083
6870
|
};
|
|
7084
6871
|
return RawSha2562;
|
|
7085
|
-
}()
|
|
6872
|
+
})()
|
|
7086
6873
|
);
|
|
7087
6874
|
|
|
7088
6875
|
// node_modules/@smithy/util-utf8/dist-es/fromUtf8.browser.js
|
|
@@ -7115,7 +6902,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
7115
6902
|
// node_modules/@aws-crypto/sha256-js/build/module/jsSha256.js
|
|
7116
6903
|
var Sha256 = (
|
|
7117
6904
|
/** @class */
|
|
7118
|
-
function() {
|
|
6905
|
+
(function() {
|
|
7119
6906
|
function Sha2562(secret) {
|
|
7120
6907
|
this.secret = secret;
|
|
7121
6908
|
this.hash = new RawSha256();
|
|
@@ -7169,7 +6956,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
7169
6956
|
}
|
|
7170
6957
|
};
|
|
7171
6958
|
return Sha2562;
|
|
7172
|
-
}()
|
|
6959
|
+
})()
|
|
7173
6960
|
);
|
|
7174
6961
|
function bufferFromSecret(secret) {
|
|
7175
6962
|
var input = convertToBuffer(secret);
|
|
@@ -7317,8 +7104,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
7317
7104
|
async getAsyncInternalMixerModule(isDouble = false) {
|
|
7318
7105
|
const bufferKey = isDouble ? "mixer64Buffer" : "mixer32Buffer";
|
|
7319
7106
|
const moduleKey = isDouble ? "mixer64Module" : "mixer32Module";
|
|
7320
|
-
if (this[moduleKey])
|
|
7321
|
-
return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
|
|
7107
|
+
if (this[moduleKey]) return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
|
|
7322
7108
|
const path = isDouble ? "/usr/rsrc/mixer64.wasm" : "/usr/rsrc/mixer32.wasm";
|
|
7323
7109
|
const mixerBuffer = this.fs().readFile(path, { encoding: "binary" });
|
|
7324
7110
|
this[bufferKey] = mixerBuffer;
|
|
@@ -7329,8 +7115,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
7329
7115
|
getSyncInternalMixerModule(isDouble = false) {
|
|
7330
7116
|
const bufferKey = isDouble ? "mixer64Buffer" : "mixer32Buffer";
|
|
7331
7117
|
const moduleKey = isDouble ? "mixer64Module" : "mixer32Module";
|
|
7332
|
-
if (this[moduleKey])
|
|
7333
|
-
return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
|
|
7118
|
+
if (this[moduleKey]) return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
|
|
7334
7119
|
const path = isDouble ? "/usr/rsrc/mixer64.wasm" : "/usr/rsrc/mixer32.wasm";
|
|
7335
7120
|
const mixerBuffer = this.fs().readFile(path, { encoding: "binary" });
|
|
7336
7121
|
this[bufferKey] = mixerBuffer;
|
|
@@ -7671,10 +7456,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
7671
7456
|
this.fHi = Math.max(x, y);
|
|
7672
7457
|
}
|
|
7673
7458
|
clip(x) {
|
|
7674
|
-
if (x < this.fLo)
|
|
7675
|
-
|
|
7676
|
-
if (x > this.fHi)
|
|
7677
|
-
return this.fHi;
|
|
7459
|
+
if (x < this.fLo) return this.fLo;
|
|
7460
|
+
if (x > this.fHi) return this.fHi;
|
|
7678
7461
|
return x;
|
|
7679
7462
|
}
|
|
7680
7463
|
};
|
|
@@ -8083,8 +7866,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8083
7866
|
console.log(`fSR: ${this.fSR}`);
|
|
8084
7867
|
console.log(`fOffset: ${this.fOffset}`);
|
|
8085
7868
|
const HEAP32 = this.fAllocator.getInt32Array();
|
|
8086
|
-
if (mem)
|
|
8087
|
-
console.log(`HEAP32: ${HEAP32}`);
|
|
7869
|
+
if (mem) console.log(`HEAP32: ${HEAP32}`);
|
|
8088
7870
|
console.log(`HEAP32[this.fPtr >> 2]: ${HEAP32[this.fPtr >> 2]}`);
|
|
8089
7871
|
console.log(`HEAP32[(this.fPtr + ptrSize) >> 2]: ${HEAP32[this.fPtr + this.fPtrSize >> 2]}`);
|
|
8090
7872
|
console.log(`HEAP32[(this.fPtr + 2 * ptrSize) >> 2]: ${HEAP32[this.fPtr + 2 * this.fPtrSize >> 2]}`);
|
|
@@ -8138,8 +7920,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8138
7920
|
this.fInputsItems.push(item.address);
|
|
8139
7921
|
this.fPathTable[item.address] = item.index;
|
|
8140
7922
|
this.fDescriptor.push(item);
|
|
8141
|
-
if (!item.meta)
|
|
8142
|
-
return;
|
|
7923
|
+
if (!item.meta) return;
|
|
8143
7924
|
item.meta.forEach((meta) => {
|
|
8144
7925
|
var _a, _b, _c, _d, _e, _f;
|
|
8145
7926
|
const { midi, acc, gyr } = meta;
|
|
@@ -8235,19 +8016,13 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8235
8016
|
propagateAcc(accelerationIncludingGravity, invert = false) {
|
|
8236
8017
|
const { x, y, z } = accelerationIncludingGravity;
|
|
8237
8018
|
if (invert) {
|
|
8238
|
-
if (x !== null)
|
|
8239
|
-
|
|
8240
|
-
if (
|
|
8241
|
-
this.fAcc.y.forEach((handler) => handler(-y));
|
|
8242
|
-
if (z !== null)
|
|
8243
|
-
this.fAcc.z.forEach((handler) => handler(-z));
|
|
8019
|
+
if (x !== null) this.fAcc.x.forEach((handler) => handler(-x));
|
|
8020
|
+
if (y !== null) this.fAcc.y.forEach((handler) => handler(-y));
|
|
8021
|
+
if (z !== null) this.fAcc.z.forEach((handler) => handler(-z));
|
|
8244
8022
|
} else {
|
|
8245
|
-
if (x !== null)
|
|
8246
|
-
|
|
8247
|
-
if (
|
|
8248
|
-
this.fAcc.y.forEach((handler) => handler(y));
|
|
8249
|
-
if (z !== null)
|
|
8250
|
-
this.fAcc.z.forEach((handler) => handler(z));
|
|
8023
|
+
if (x !== null) this.fAcc.x.forEach((handler) => handler(x));
|
|
8024
|
+
if (y !== null) this.fAcc.y.forEach((handler) => handler(y));
|
|
8025
|
+
if (z !== null) this.fAcc.z.forEach((handler) => handler(z));
|
|
8251
8026
|
}
|
|
8252
8027
|
}
|
|
8253
8028
|
get hasGyrInput() {
|
|
@@ -8255,12 +8030,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8255
8030
|
}
|
|
8256
8031
|
propagateGyr(event) {
|
|
8257
8032
|
const { alpha, beta, gamma } = event;
|
|
8258
|
-
if (alpha !== null)
|
|
8259
|
-
|
|
8260
|
-
if (
|
|
8261
|
-
this.fGyr.y.forEach((handler) => handler(beta));
|
|
8262
|
-
if (gamma !== null)
|
|
8263
|
-
this.fGyr.z.forEach((handler) => handler(gamma));
|
|
8033
|
+
if (alpha !== null) this.fGyr.x.forEach((handler) => handler(alpha));
|
|
8034
|
+
if (beta !== null) this.fGyr.y.forEach((handler) => handler(beta));
|
|
8035
|
+
if (gamma !== null) this.fGyr.z.forEach((handler) => handler(gamma));
|
|
8264
8036
|
}
|
|
8265
8037
|
/** Build the accelerometer handler */
|
|
8266
8038
|
setupAccHandler(path, axis, curve, amin, amid, amax, min, init, max) {
|
|
@@ -8315,8 +8087,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8315
8087
|
console.log(`Soundfile ${name} paths: ${url}`);
|
|
8316
8088
|
const soundfileIds = _FaustBaseWebAudioDsp.splitSoundfileNames(url);
|
|
8317
8089
|
const item = this.fSoundfiles.find((item2) => item2.url === url);
|
|
8318
|
-
if (!item)
|
|
8319
|
-
throw new Error(`Soundfile with ${url} cannot be found !}`);
|
|
8090
|
+
if (!item) throw new Error(`Soundfile with ${url} cannot be found !}`);
|
|
8320
8091
|
if (item.basePtr !== -1) {
|
|
8321
8092
|
const HEAP32 = allocator.getInt32Array();
|
|
8322
8093
|
console.log(`Soundfile CACHE ${url}} : ${name} loaded at ${item.basePtr} in wasm memory with index ${item.index}`);
|
|
@@ -8339,7 +8110,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8339
8110
|
for (const soundfileId of soundfileIdList) {
|
|
8340
8111
|
let chan = 0;
|
|
8341
8112
|
let len = 0;
|
|
8342
|
-
const audioData = soundfiles[soundfileId];
|
|
8113
|
+
const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
|
|
8343
8114
|
if (audioData) {
|
|
8344
8115
|
chan = audioData.audioBuffer.length;
|
|
8345
8116
|
len = audioData.audioBuffer[0].length;
|
|
@@ -8355,7 +8126,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8355
8126
|
let offset = 0;
|
|
8356
8127
|
for (let part = 0; part < soundfileIdList.length; part++) {
|
|
8357
8128
|
const soundfileId = soundfileIdList[part];
|
|
8358
|
-
const audioData = soundfiles[soundfileId];
|
|
8129
|
+
const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
|
|
8359
8130
|
if (audioData) {
|
|
8360
8131
|
soundfile.copyToOut(part, maxChan, offset, audioData);
|
|
8361
8132
|
offset += audioData.audioBuffer[0].length;
|
|
@@ -8431,16 +8202,13 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8431
8202
|
return -1;
|
|
8432
8203
|
}
|
|
8433
8204
|
midiMessage(data) {
|
|
8434
|
-
if (this.fPlotHandler)
|
|
8435
|
-
this.fCachedEvents.push({ data, type: "midi" });
|
|
8205
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ data, type: "midi" });
|
|
8436
8206
|
const cmd = data[0] >> 4;
|
|
8437
8207
|
const channel = data[0] & 15;
|
|
8438
8208
|
const data1 = data[1];
|
|
8439
8209
|
const data2 = data[2];
|
|
8440
|
-
if (cmd === 11)
|
|
8441
|
-
|
|
8442
|
-
if (cmd === 14)
|
|
8443
|
-
return this.pitchWheel(channel, data2 * 128 + data1);
|
|
8210
|
+
if (cmd === 11) return this.ctrlChange(channel, data1, data2);
|
|
8211
|
+
if (cmd === 14) return this.pitchWheel(channel, data2 * 128 + data1);
|
|
8444
8212
|
if (cmd === 9) {
|
|
8445
8213
|
if (data2 > 0)
|
|
8446
8214
|
return this.keyOn(channel, data1, data2);
|
|
@@ -8452,68 +8220,58 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8452
8220
|
}
|
|
8453
8221
|
}
|
|
8454
8222
|
ctrlChange(channel, ctrl, value) {
|
|
8455
|
-
if (this.fPlotHandler)
|
|
8456
|
-
this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
|
|
8223
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
|
|
8457
8224
|
if (this.fCtrlLabel[ctrl].length) {
|
|
8458
8225
|
this.fCtrlLabel[ctrl].forEach((ctrl2) => {
|
|
8459
8226
|
const { path, chan } = ctrl2;
|
|
8460
8227
|
if (chan === 0 || channel === chan - 1) {
|
|
8461
8228
|
this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
|
|
8462
|
-
if (this.fOutputHandler)
|
|
8463
|
-
this.fOutputHandler(path, this.getParamValue(path));
|
|
8229
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
8464
8230
|
}
|
|
8465
8231
|
});
|
|
8466
8232
|
}
|
|
8467
8233
|
}
|
|
8468
8234
|
keyOn(channel, pitch, velocity) {
|
|
8469
|
-
if (this.fPlotHandler)
|
|
8470
|
-
this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
|
|
8235
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
|
|
8471
8236
|
this.fMidiKeyOnLabel[pitch].forEach((key) => {
|
|
8472
8237
|
const { path, chan } = key;
|
|
8473
8238
|
if (chan === 0 || channel === chan - 1) {
|
|
8474
8239
|
this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
|
|
8475
|
-
if (this.fOutputHandler)
|
|
8476
|
-
this.fOutputHandler(path, this.getParamValue(path));
|
|
8240
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
8477
8241
|
}
|
|
8478
8242
|
});
|
|
8479
8243
|
this.fMidiKeyLabel[pitch].forEach((key) => {
|
|
8480
8244
|
const { path, chan } = key;
|
|
8481
8245
|
if (chan === 0 || channel === chan - 1) {
|
|
8482
8246
|
this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
|
|
8483
|
-
if (this.fOutputHandler)
|
|
8484
|
-
this.fOutputHandler(path, this.getParamValue(path));
|
|
8247
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
8485
8248
|
}
|
|
8486
8249
|
});
|
|
8487
8250
|
}
|
|
8488
8251
|
keyOff(channel, pitch, velocity) {
|
|
8489
|
-
if (this.fPlotHandler)
|
|
8490
|
-
this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
|
|
8252
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
|
|
8491
8253
|
this.fMidiKeyOffLabel[pitch].forEach((key) => {
|
|
8492
8254
|
const { path, chan } = key;
|
|
8493
8255
|
if (chan === 0 || channel === chan - 1) {
|
|
8494
8256
|
this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
|
|
8495
|
-
if (this.fOutputHandler)
|
|
8496
|
-
this.fOutputHandler(path, this.getParamValue(path));
|
|
8257
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
8497
8258
|
}
|
|
8498
8259
|
});
|
|
8499
8260
|
this.fMidiKeyLabel[pitch].forEach((key) => {
|
|
8500
8261
|
const { path, chan } = key;
|
|
8501
8262
|
if (chan === 0 || channel === chan - 1) {
|
|
8502
8263
|
this.setParamValue(path, 0);
|
|
8503
|
-
if (this.fOutputHandler)
|
|
8504
|
-
this.fOutputHandler(path, this.getParamValue(path));
|
|
8264
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
8505
8265
|
}
|
|
8506
8266
|
});
|
|
8507
8267
|
}
|
|
8508
8268
|
pitchWheel(channel, wheel) {
|
|
8509
|
-
if (this.fPlotHandler)
|
|
8510
|
-
this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
|
|
8269
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
|
|
8511
8270
|
this.fPitchwheelLabel.forEach((pw) => {
|
|
8512
8271
|
const { path, chan } = pw;
|
|
8513
8272
|
if (chan === 0 || channel === chan - 1) {
|
|
8514
8273
|
this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
|
|
8515
|
-
if (this.fOutputHandler)
|
|
8516
|
-
this.fOutputHandler(path, this.getParamValue(path));
|
|
8274
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
8517
8275
|
}
|
|
8518
8276
|
});
|
|
8519
8277
|
}
|
|
@@ -8614,10 +8372,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8614
8372
|
}
|
|
8615
8373
|
// Public API
|
|
8616
8374
|
compute(input, output) {
|
|
8617
|
-
if (this.fDestroyed)
|
|
8618
|
-
|
|
8619
|
-
if (!this.fProcessing)
|
|
8620
|
-
return true;
|
|
8375
|
+
if (this.fDestroyed) return false;
|
|
8376
|
+
if (!this.fProcessing) return true;
|
|
8621
8377
|
if (this.fFirstCall) {
|
|
8622
8378
|
this.initMemory();
|
|
8623
8379
|
this.fFirstCall = false;
|
|
@@ -8638,8 +8394,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8638
8394
|
}
|
|
8639
8395
|
}
|
|
8640
8396
|
}
|
|
8641
|
-
if (this.fComputeHandler)
|
|
8642
|
-
this.fComputeHandler(this.fBufferSize);
|
|
8397
|
+
if (this.fComputeHandler) this.fComputeHandler(this.fBufferSize);
|
|
8643
8398
|
this.fInstance.api.compute(this.fDSP, this.fBufferSize, this.fAudioInputs, this.fAudioOutputs);
|
|
8644
8399
|
this.updateOutputs();
|
|
8645
8400
|
let forPlot = this.fOutChannels;
|
|
@@ -8668,8 +8423,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8668
8423
|
return this.fInstance.api.getNumOutputs(this.fDSP);
|
|
8669
8424
|
}
|
|
8670
8425
|
setParamValue(path, value) {
|
|
8671
|
-
if (this.fPlotHandler)
|
|
8672
|
-
this.fCachedEvents.push({ type: "param", data: { path, value } });
|
|
8426
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "param", data: { path, value } });
|
|
8673
8427
|
this.fInstance.api.setParamValue(this.fDSP, this.fPathTable[path], value);
|
|
8674
8428
|
}
|
|
8675
8429
|
getParamValue(path) {
|
|
@@ -8795,8 +8549,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8795
8549
|
this.fJSONDsp = JSON.parse(this.fInstance.voiceJSON);
|
|
8796
8550
|
this.fJSONEffect = this.fInstance.effectAPI && this.fInstance.effectJSON ? JSON.parse(this.fInstance.effectJSON) : null;
|
|
8797
8551
|
FaustBaseWebAudioDsp.parseUI(this.fJSONDsp.ui, this.fUICallback);
|
|
8798
|
-
if (this.fJSONEffect)
|
|
8799
|
-
FaustBaseWebAudioDsp.parseUI(this.fJSONEffect.ui, this.fUICallback);
|
|
8552
|
+
if (this.fJSONEffect) FaustBaseWebAudioDsp.parseUI(this.fJSONEffect.ui, this.fUICallback);
|
|
8800
8553
|
this.fEndMemory = this.initMemory();
|
|
8801
8554
|
this.fVoiceTable = [];
|
|
8802
8555
|
for (let voice = 0; voice < this.fInstance.voices; voice++) {
|
|
@@ -8808,8 +8561,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8808
8561
|
sampleRate
|
|
8809
8562
|
));
|
|
8810
8563
|
}
|
|
8811
|
-
if (this.fInstance.effectAPI)
|
|
8812
|
-
this.fInstance.effectAPI.init(this.fEffect, sampleRate);
|
|
8564
|
+
if (this.fInstance.effectAPI) this.fInstance.effectAPI.init(this.fEffect, sampleRate);
|
|
8813
8565
|
if (this.fSoundfiles.length > 0) {
|
|
8814
8566
|
const allocator = new WasmAllocator(this.fInstance.memory, this.fEndMemory);
|
|
8815
8567
|
for (let voice = 0; voice < this.fInstance.voices; voice++) {
|
|
@@ -8915,14 +8667,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8915
8667
|
}
|
|
8916
8668
|
// Public API
|
|
8917
8669
|
compute(input, output) {
|
|
8918
|
-
if (this.fDestroyed)
|
|
8919
|
-
return false;
|
|
8670
|
+
if (this.fDestroyed) return false;
|
|
8920
8671
|
if (this.fFirstCall) {
|
|
8921
8672
|
this.initMemory();
|
|
8922
8673
|
this.fFirstCall = false;
|
|
8923
8674
|
}
|
|
8924
|
-
if (!this.fProcessing)
|
|
8925
|
-
return true;
|
|
8675
|
+
if (!this.fProcessing) return true;
|
|
8926
8676
|
if (this.getNumInputs() > 0 && (!input || !input[0] || input[0].length === 0)) {
|
|
8927
8677
|
return true;
|
|
8928
8678
|
}
|
|
@@ -8935,8 +8685,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8935
8685
|
dspInput.set(input[chan]);
|
|
8936
8686
|
}
|
|
8937
8687
|
}
|
|
8938
|
-
if (this.fComputeHandler)
|
|
8939
|
-
this.fComputeHandler(this.fBufferSize);
|
|
8688
|
+
if (this.fComputeHandler) this.fComputeHandler(this.fBufferSize);
|
|
8940
8689
|
this.fInstance.mixerAPI.clearOutput(this.fBufferSize, this.getNumOutputs(), this.fAudioOutputs);
|
|
8941
8690
|
this.fVoiceTable.forEach((voice) => {
|
|
8942
8691
|
if (voice.fCurNote === FaustWebAudioDspVoice.kLegatoVoice) {
|
|
@@ -8951,8 +8700,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8951
8700
|
}
|
|
8952
8701
|
}
|
|
8953
8702
|
});
|
|
8954
|
-
if (this.fInstance.effectAPI)
|
|
8955
|
-
this.fInstance.effectAPI.compute(this.fEffect, this.fBufferSize, this.fAudioOutputs, this.fAudioOutputs);
|
|
8703
|
+
if (this.fInstance.effectAPI) this.fInstance.effectAPI.compute(this.fEffect, this.fBufferSize, this.fAudioOutputs, this.fAudioOutputs);
|
|
8956
8704
|
this.updateOutputs();
|
|
8957
8705
|
if (output !== void 0) {
|
|
8958
8706
|
for (let chan = 0; chan < Math.min(this.getNumOutputs(), output.length); chan++) {
|
|
@@ -8979,15 +8727,13 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
8979
8727
|
return o.address === p;
|
|
8980
8728
|
} else {
|
|
8981
8729
|
for (const k in o) {
|
|
8982
|
-
if (_FaustPolyWebAudioDsp.findPath(o[k], p))
|
|
8983
|
-
return true;
|
|
8730
|
+
if (_FaustPolyWebAudioDsp.findPath(o[k], p)) return true;
|
|
8984
8731
|
}
|
|
8985
8732
|
return false;
|
|
8986
8733
|
}
|
|
8987
8734
|
}
|
|
8988
8735
|
setParamValue(path, value) {
|
|
8989
|
-
if (this.fPlotHandler)
|
|
8990
|
-
this.fCachedEvents.push({ type: "param", data: { path, value } });
|
|
8736
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "param", data: { path, value } });
|
|
8991
8737
|
if (this.fJSONEffect && _FaustPolyWebAudioDsp.findPath(this.fJSONEffect.ui, path) && this.fInstance.effectAPI) {
|
|
8992
8738
|
this.fInstance.effectAPI.setParamValue(this.fEffect, this.fPathTable[path], value);
|
|
8993
8739
|
} else {
|
|
@@ -9039,12 +8785,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9039
8785
|
const channel = data[0] & 15;
|
|
9040
8786
|
const data1 = data[1];
|
|
9041
8787
|
const data2 = data[2];
|
|
9042
|
-
if (cmd === 8 || cmd === 9 && data2 === 0)
|
|
9043
|
-
|
|
9044
|
-
else
|
|
9045
|
-
return this.keyOn(channel, data1, data2);
|
|
9046
|
-
else
|
|
9047
|
-
super.midiMessage(data);
|
|
8788
|
+
if (cmd === 8 || cmd === 9 && data2 === 0) return this.keyOff(channel, data1, data2);
|
|
8789
|
+
else if (cmd === 9) return this.keyOn(channel, data1, data2);
|
|
8790
|
+
else super.midiMessage(data);
|
|
9048
8791
|
}
|
|
9049
8792
|
ctrlChange(channel, ctrl, value) {
|
|
9050
8793
|
if (ctrl === 123 || ctrl === 120) {
|
|
@@ -9054,14 +8797,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9054
8797
|
}
|
|
9055
8798
|
}
|
|
9056
8799
|
keyOn(channel, pitch, velocity) {
|
|
9057
|
-
if (this.fPlotHandler)
|
|
9058
|
-
this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
|
|
8800
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
|
|
9059
8801
|
const voice = this.getFreeVoice();
|
|
9060
8802
|
this.fVoiceTable[voice].keyOn(pitch, velocity, this.fVoiceTable[voice].fCurNote == FaustWebAudioDspVoice.kLegatoVoice);
|
|
9061
8803
|
}
|
|
9062
8804
|
keyOff(channel, pitch, velocity) {
|
|
9063
|
-
if (this.fPlotHandler)
|
|
9064
|
-
this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
|
|
8805
|
+
if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
|
|
9065
8806
|
const voice = this.getPlayingVoice(pitch);
|
|
9066
8807
|
if (voice !== FaustWebAudioDspVoice.kNoVoice) {
|
|
9067
8808
|
this.fVoiceTable[voice].keyOff();
|
|
@@ -9097,8 +8838,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9097
8838
|
param = { name: item.address, defaultValue: item.init || 0, minValue: 0, maxValue: 1 };
|
|
9098
8839
|
}
|
|
9099
8840
|
}
|
|
9100
|
-
if (param)
|
|
9101
|
-
params.push(param);
|
|
8841
|
+
if (param) params.push(param);
|
|
9102
8842
|
};
|
|
9103
8843
|
FaustBaseWebAudioDsp.parseUI(this.fDSPCode.getUI(), callback);
|
|
9104
8844
|
return params;
|
|
@@ -9269,8 +9009,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9269
9009
|
} catch {
|
|
9270
9010
|
}
|
|
9271
9011
|
const success = this.compiler.generateAuxFiles(name, code, `-lang wasm -o binary -svg ${args}`);
|
|
9272
|
-
if (!success)
|
|
9273
|
-
throw new Error(this.compiler.getErrorMessage());
|
|
9012
|
+
if (!success) throw new Error(this.compiler.getErrorMessage());
|
|
9274
9013
|
const svgs = {};
|
|
9275
9014
|
const files = fs.readdir(`/${name}-svg/`);
|
|
9276
9015
|
files.filter((file) => file !== "." && file !== "..").forEach((file) => svgs[file] = fs.readFile(`/${name}-svg/${file}`, { encoding: "utf8" }));
|
|
@@ -9773,8 +9512,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9773
9512
|
static async fetchSoundfile(url, audioCtx) {
|
|
9774
9513
|
console.log(`Loading sound file from ${url}`);
|
|
9775
9514
|
const response = await fetch(url);
|
|
9776
|
-
if (!response.ok)
|
|
9777
|
-
throw new Error(`Failed to load sound file from ${url}: ${response.statusText}`);
|
|
9515
|
+
if (!response.ok) throw new Error(`Failed to load sound file from ${url}: ${response.statusText}`);
|
|
9778
9516
|
const arrayBuffer = await response.arrayBuffer();
|
|
9779
9517
|
const audioBuffer = await audioCtx.decodeAudioData(arrayBuffer);
|
|
9780
9518
|
return this.toAudioData(audioBuffer);
|
|
@@ -9788,13 +9526,11 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9788
9526
|
* @param audioCtx : the audio context
|
|
9789
9527
|
*/
|
|
9790
9528
|
static async loadSoundfile(filename, metaUrls, soundfiles, audioCtx) {
|
|
9791
|
-
if (soundfiles[filename])
|
|
9792
|
-
return;
|
|
9529
|
+
if (soundfiles == null ? void 0 : soundfiles[filename]) return;
|
|
9793
9530
|
const urlsToCheck = [filename, ...[...metaUrls, ...this.fallbackPaths].map((path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href)];
|
|
9794
9531
|
const checkResults = await Promise.all(urlsToCheck.map((url) => this.checkFileExists(url)));
|
|
9795
9532
|
const successIndex = checkResults.findIndex((r) => !!r);
|
|
9796
|
-
if (successIndex === -1)
|
|
9797
|
-
throw new Error(`Failed to load sound file ${filename}, all check failed.`);
|
|
9533
|
+
if (successIndex === -1) throw new Error(`Failed to load sound file ${filename}, all check failed.`);
|
|
9798
9534
|
soundfiles[filename] = await this.fetchSoundfile(urlsToCheck[successIndex], audioCtx);
|
|
9799
9535
|
}
|
|
9800
9536
|
/**
|
|
@@ -9809,7 +9545,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9809
9545
|
const metaUrls = FaustBaseWebAudioDsp.extractUrlsFromMeta(dspMeta);
|
|
9810
9546
|
const soundfiles = this.findSoundfilesFromMeta(dspMeta);
|
|
9811
9547
|
for (const id in soundfiles) {
|
|
9812
|
-
if (soundfilesIn[id]) {
|
|
9548
|
+
if (soundfilesIn == null ? void 0 : soundfilesIn[id]) {
|
|
9813
9549
|
soundfiles[id] = soundfilesIn[id];
|
|
9814
9550
|
continue;
|
|
9815
9551
|
}
|
|
@@ -9847,8 +9583,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9847
9583
|
ptr += 3 * Float32Array.BYTES_PER_ELEMENT;
|
|
9848
9584
|
}
|
|
9849
9585
|
setNewAccDataAvailable(value) {
|
|
9850
|
-
if (!this.uin8NewAccData)
|
|
9851
|
-
return;
|
|
9586
|
+
if (!this.uin8NewAccData) return;
|
|
9852
9587
|
this.uin8NewAccData[0] = +value;
|
|
9853
9588
|
}
|
|
9854
9589
|
getNewAccDataAvailable() {
|
|
@@ -9856,8 +9591,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9856
9591
|
return !!((_a = this.uin8NewAccData) == null ? void 0 : _a[0]);
|
|
9857
9592
|
}
|
|
9858
9593
|
setNewGyrDataAvailable(value) {
|
|
9859
|
-
if (!this.uin8NewGyrData)
|
|
9860
|
-
return;
|
|
9594
|
+
if (!this.uin8NewGyrData) return;
|
|
9861
9595
|
this.uin8NewGyrData[0] = +value;
|
|
9862
9596
|
}
|
|
9863
9597
|
getNewGyrDataAvailable() {
|
|
@@ -9869,8 +9603,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9869
9603
|
const e = { type: "acc", data: { x, y, z }, invert };
|
|
9870
9604
|
this.port.postMessage(e);
|
|
9871
9605
|
}
|
|
9872
|
-
if (!this.uin8NewAccData)
|
|
9873
|
-
return;
|
|
9606
|
+
if (!this.uin8NewAccData) return;
|
|
9874
9607
|
this.uin8Invert[0] = +invert;
|
|
9875
9608
|
this.f32Acc[0] = x;
|
|
9876
9609
|
this.f32Acc[1] = y;
|
|
@@ -9878,8 +9611,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9878
9611
|
this.uin8NewAccData[0] = 1;
|
|
9879
9612
|
}
|
|
9880
9613
|
getAcc() {
|
|
9881
|
-
if (!this.uin8NewAccData)
|
|
9882
|
-
return;
|
|
9614
|
+
if (!this.uin8NewAccData) return;
|
|
9883
9615
|
const invert = !!this.uin8Invert[0];
|
|
9884
9616
|
const [x, y, z] = this.f32Acc;
|
|
9885
9617
|
return { x, y, z, invert };
|
|
@@ -9889,16 +9621,14 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9889
9621
|
const e = { type: "gyr", data: { alpha, beta, gamma } };
|
|
9890
9622
|
this.port.postMessage(e);
|
|
9891
9623
|
}
|
|
9892
|
-
if (!this.uin8NewGyrData)
|
|
9893
|
-
return;
|
|
9624
|
+
if (!this.uin8NewGyrData) return;
|
|
9894
9625
|
this.f32Gyr[0] = alpha;
|
|
9895
9626
|
this.f32Gyr[1] = beta;
|
|
9896
9627
|
this.f32Gyr[2] = gamma;
|
|
9897
9628
|
this.uin8NewGyrData[0] = 1;
|
|
9898
9629
|
}
|
|
9899
9630
|
getGyr() {
|
|
9900
|
-
if (!this.uin8NewGyrData)
|
|
9901
|
-
return;
|
|
9631
|
+
if (!this.uin8NewGyrData) return;
|
|
9902
9632
|
const [alpha, beta, gamma] = this.f32Gyr;
|
|
9903
9633
|
return { alpha, beta, gamma };
|
|
9904
9634
|
}
|
|
@@ -9932,6 +9662,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9932
9662
|
this.port.addEventListener("message", (event) => {
|
|
9933
9663
|
const msg = event.data;
|
|
9934
9664
|
switch (msg.type) {
|
|
9665
|
+
// Sensors messages
|
|
9935
9666
|
case "acc": {
|
|
9936
9667
|
this.setAcc(msg.data, msg.invert);
|
|
9937
9668
|
break;
|
|
@@ -9975,8 +9706,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9975
9706
|
// Accelerometer and gyroscope handlers
|
|
9976
9707
|
this.handleDeviceMotion = ({ accelerationIncludingGravity }) => {
|
|
9977
9708
|
const isAndroid = /Android/i.test(navigator.userAgent);
|
|
9978
|
-
if (!accelerationIncludingGravity)
|
|
9979
|
-
return;
|
|
9709
|
+
if (!accelerationIncludingGravity) return;
|
|
9980
9710
|
const { x, y, z } = accelerationIncludingGravity;
|
|
9981
9711
|
this.propagateAcc({ x, y, z }, isAndroid);
|
|
9982
9712
|
};
|
|
@@ -9994,14 +9724,11 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
9994
9724
|
if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
|
|
9995
9725
|
this.fInputsItems.push(item.address);
|
|
9996
9726
|
this.fDescriptor.push(item);
|
|
9997
|
-
if (!item.meta)
|
|
9998
|
-
return;
|
|
9727
|
+
if (!item.meta) return;
|
|
9999
9728
|
item.meta.forEach((meta) => {
|
|
10000
9729
|
const { midi, acc, gyr } = meta;
|
|
10001
|
-
if (acc)
|
|
10002
|
-
|
|
10003
|
-
if (gyr)
|
|
10004
|
-
__privateSet(this, _hasGyrInput, true);
|
|
9730
|
+
if (acc) __privateSet(this, _hasAccInput, true);
|
|
9731
|
+
if (gyr) __privateSet(this, _hasGyrInput, true);
|
|
10005
9732
|
});
|
|
10006
9733
|
}
|
|
10007
9734
|
};
|
|
@@ -10089,16 +9816,11 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10089
9816
|
const channel = data[0] & 15;
|
|
10090
9817
|
const data1 = data[1];
|
|
10091
9818
|
const data2 = data[2];
|
|
10092
|
-
if (cmd === 11)
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
this.keyOff(channel, data1, data2);
|
|
10098
|
-
else if (cmd === 9)
|
|
10099
|
-
this.keyOn(channel, data1, data2);
|
|
10100
|
-
else
|
|
10101
|
-
this.port.postMessage({ type: "midi", data });
|
|
9819
|
+
if (cmd === 11) this.ctrlChange(channel, data1, data2);
|
|
9820
|
+
else if (cmd === 14) this.pitchWheel(channel, data2 * 128 + data1);
|
|
9821
|
+
if (cmd === 8 || cmd === 9 && data2 === 0) this.keyOff(channel, data1, data2);
|
|
9822
|
+
else if (cmd === 9) this.keyOn(channel, data1, data2);
|
|
9823
|
+
else this.port.postMessage({ type: "midi", data });
|
|
10102
9824
|
}
|
|
10103
9825
|
ctrlChange(channel, ctrl, value) {
|
|
10104
9826
|
const e = { type: "ctrlChange", data: [channel, ctrl, value] };
|
|
@@ -10120,8 +9842,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10120
9842
|
return __privateGet(this, _hasAccInput);
|
|
10121
9843
|
}
|
|
10122
9844
|
propagateAcc(accelerationIncludingGravity, invert = false) {
|
|
10123
|
-
if (!accelerationIncludingGravity)
|
|
10124
|
-
return;
|
|
9845
|
+
if (!accelerationIncludingGravity) return;
|
|
10125
9846
|
const { x, y, z } = accelerationIncludingGravity;
|
|
10126
9847
|
this.fCommunicator.setAcc({ x, y, z }, invert);
|
|
10127
9848
|
}
|
|
@@ -10129,8 +9850,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10129
9850
|
return __privateGet(this, _hasGyrInput);
|
|
10130
9851
|
}
|
|
10131
9852
|
propagateGyr(event) {
|
|
10132
|
-
if (!event)
|
|
10133
|
-
return;
|
|
9853
|
+
if (!event) return;
|
|
10134
9854
|
const { alpha, beta, gamma } = event;
|
|
10135
9855
|
this.fCommunicator.setGyr({ alpha, beta, gamma });
|
|
10136
9856
|
}
|
|
@@ -10138,8 +9858,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10138
9858
|
const e = { type: "param", data: { path, value } };
|
|
10139
9859
|
this.port.postMessage(e);
|
|
10140
9860
|
const param = this.parameters.get(path);
|
|
10141
|
-
if (param)
|
|
10142
|
-
param.setValueAtTime(value, this.context.currentTime);
|
|
9861
|
+
if (param) param.setValueAtTime(value, this.context.currentTime);
|
|
10143
9862
|
}
|
|
10144
9863
|
getParamValue(path) {
|
|
10145
9864
|
const param = this.parameters.get(path);
|
|
@@ -10255,8 +9974,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10255
9974
|
this.fOutputs = new Array(this.fDSPCode.getNumOutputs());
|
|
10256
9975
|
this.handleDeviceMotion = ({ accelerationIncludingGravity }) => {
|
|
10257
9976
|
const isAndroid = /Android/i.test(navigator.userAgent);
|
|
10258
|
-
if (!accelerationIncludingGravity)
|
|
10259
|
-
return;
|
|
9977
|
+
if (!accelerationIncludingGravity) return;
|
|
10260
9978
|
const { x, y, z } = accelerationIncludingGravity;
|
|
10261
9979
|
this.propagateAcc({ x, y, z }, isAndroid);
|
|
10262
9980
|
};
|
|
@@ -10420,23 +10138,21 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10420
10138
|
}
|
|
10421
10139
|
}
|
|
10422
10140
|
addSoundfiles(soundfileMap) {
|
|
10423
|
-
if (!this.factory)
|
|
10424
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10141
|
+
if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10425
10142
|
for (const id in soundfileMap) {
|
|
10426
10143
|
this.factory.soundfiles[id] = soundfileMap[id];
|
|
10427
10144
|
}
|
|
10428
10145
|
}
|
|
10429
10146
|
getSoundfileList() {
|
|
10430
|
-
if (!this.factory)
|
|
10431
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10147
|
+
if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10432
10148
|
const meta = JSON.parse(this.factory.json);
|
|
10433
10149
|
const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
|
|
10150
|
+
if (!map) return [];
|
|
10434
10151
|
return Object.keys(map);
|
|
10435
10152
|
}
|
|
10436
10153
|
async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
|
|
10437
10154
|
var _a, _b;
|
|
10438
|
-
if (!factory)
|
|
10439
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10155
|
+
if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10440
10156
|
const meta = JSON.parse(factory.json);
|
|
10441
10157
|
const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
|
|
10442
10158
|
factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
|
|
@@ -10448,8 +10164,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
10448
10164
|
sp2.init(monoDsp);
|
|
10449
10165
|
return sp2;
|
|
10450
10166
|
} else {
|
|
10451
|
-
if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context))
|
|
10452
|
-
_FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
|
|
10167
|
+
if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context)) _FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
|
|
10453
10168
|
if (!((_a = _FaustMonoDspGenerator.gWorkletProcessors.get(context)) == null ? void 0 : _a.has(processorName))) {
|
|
10454
10169
|
try {
|
|
10455
10170
|
const processorCode = `
|
|
@@ -10502,13 +10217,11 @@ const dependencies = {
|
|
|
10502
10217
|
}
|
|
10503
10218
|
async createFFTNode(context, fftUtils, name = this.name, factory = this.factory, fftOptions = {}, processorName = (factory == null ? void 0 : factory.shaKey) ? `${factory.shaKey}_fft` : name, processorOptions = {}) {
|
|
10504
10219
|
var _a, _b;
|
|
10505
|
-
if (!factory)
|
|
10506
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10220
|
+
if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10507
10221
|
const meta = JSON.parse(factory.json);
|
|
10508
10222
|
const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
|
|
10509
10223
|
factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
|
|
10510
|
-
if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context))
|
|
10511
|
-
_FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
|
|
10224
|
+
if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context)) _FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
|
|
10512
10225
|
if (!((_a = _FaustMonoDspGenerator.gWorkletProcessors.get(context)) == null ? void 0 : _a.has(processorName))) {
|
|
10513
10226
|
try {
|
|
10514
10227
|
const processorCode = `
|
|
@@ -10560,29 +10273,24 @@ const dependencies = {
|
|
|
10560
10273
|
const node = new FaustMonoAudioWorkletNode(context, { channelCount: Math.max(1, Math.ceil(meta.inputs / 3)), outputChannelCount: [Math.ceil(meta.outputs / 2)], processorOptions: { name: processorName, factory, sampleSize, ...processorOptions } });
|
|
10561
10274
|
if (fftOptions.fftSize) {
|
|
10562
10275
|
const param = node.parameters.get("fftSize");
|
|
10563
|
-
if (param)
|
|
10564
|
-
param.value = fftOptions.fftSize;
|
|
10276
|
+
if (param) param.value = fftOptions.fftSize;
|
|
10565
10277
|
}
|
|
10566
10278
|
if (fftOptions.fftOverlap) {
|
|
10567
10279
|
const param = node.parameters.get("fftOverlap");
|
|
10568
|
-
if (param)
|
|
10569
|
-
param.value = fftOptions.fftOverlap;
|
|
10280
|
+
if (param) param.value = fftOptions.fftOverlap;
|
|
10570
10281
|
}
|
|
10571
10282
|
if (typeof fftOptions.defaultWindowFunction === "number") {
|
|
10572
10283
|
const param = node.parameters.get("windowFunction");
|
|
10573
|
-
if (param)
|
|
10574
|
-
param.value = fftOptions.defaultWindowFunction + 1;
|
|
10284
|
+
if (param) param.value = fftOptions.defaultWindowFunction + 1;
|
|
10575
10285
|
}
|
|
10576
10286
|
if (typeof fftOptions.noIFFT === "boolean") {
|
|
10577
10287
|
const param = node.parameters.get("noIFFT");
|
|
10578
|
-
if (param)
|
|
10579
|
-
param.value = +fftOptions.noIFFT;
|
|
10288
|
+
if (param) param.value = +fftOptions.noIFFT;
|
|
10580
10289
|
}
|
|
10581
10290
|
return node;
|
|
10582
10291
|
}
|
|
10583
10292
|
async createAudioWorkletProcessor(name = this.name, factory = this.factory, processorName = (factory == null ? void 0 : factory.shaKey) || name) {
|
|
10584
|
-
if (!factory)
|
|
10585
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10293
|
+
if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10586
10294
|
const meta = JSON.parse(factory.json);
|
|
10587
10295
|
const dependencies = {
|
|
10588
10296
|
FaustBaseWebAudioDsp,
|
|
@@ -10606,13 +10314,11 @@ const dependencies = {
|
|
|
10606
10314
|
}
|
|
10607
10315
|
}
|
|
10608
10316
|
async createOfflineProcessor(sampleRate, bufferSize, factory = this.factory, context) {
|
|
10609
|
-
if (!factory)
|
|
10610
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10317
|
+
if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10611
10318
|
const meta = JSON.parse(factory.json);
|
|
10612
10319
|
const instance = await FaustWasmInstantiator_default.createAsyncMonoDSPInstance(factory);
|
|
10613
10320
|
const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
|
|
10614
|
-
if (context)
|
|
10615
|
-
factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
|
|
10321
|
+
if (context) factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
|
|
10616
10322
|
const monoDsp = new FaustMonoWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, factory.soundfiles);
|
|
10617
10323
|
return new FaustMonoOfflineProcessor(monoDsp, bufferSize);
|
|
10618
10324
|
}
|
|
@@ -10703,33 +10409,29 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
|
|
|
10703
10409
|
}
|
|
10704
10410
|
}
|
|
10705
10411
|
addSoundfiles(soundfileMap) {
|
|
10706
|
-
if (!this.voiceFactory)
|
|
10707
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10412
|
+
if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10708
10413
|
for (const id in soundfileMap) {
|
|
10709
10414
|
this.voiceFactory.soundfiles[id] = soundfileMap[id];
|
|
10710
10415
|
}
|
|
10711
10416
|
}
|
|
10712
10417
|
getSoundfileList() {
|
|
10713
|
-
if (!this.voiceFactory)
|
|
10714
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10418
|
+
if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10715
10419
|
const meta = JSON.parse(this.voiceFactory.json);
|
|
10716
10420
|
const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
|
|
10717
|
-
if (!
|
|
10718
|
-
|
|
10421
|
+
if (!map) return [];
|
|
10422
|
+
if (!this.effectFactory) return Object.keys(map);
|
|
10719
10423
|
const effectMeta = JSON.parse(this.effectFactory.json);
|
|
10720
10424
|
const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);
|
|
10721
10425
|
return Object.keys({ ...effectMap, ...map });
|
|
10722
10426
|
}
|
|
10723
10427
|
async createNode(context, voices, name = this.name, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, sp = false, bufferSize = 1024, processorName = ((voiceFactory == null ? void 0 : voiceFactory.shaKey) || "") + ((effectFactory == null ? void 0 : effectFactory.shaKey) || "") || `${name}_poly`, processorOptions = {}) {
|
|
10724
10428
|
var _a, _b;
|
|
10725
|
-
if (!voiceFactory)
|
|
10726
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10429
|
+
if (!voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10727
10430
|
const voiceMeta = JSON.parse(voiceFactory.json);
|
|
10728
10431
|
const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
|
|
10729
10432
|
const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
|
|
10730
10433
|
voiceFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(voiceMeta, voiceFactory.soundfiles || {}, context);
|
|
10731
|
-
if (effectFactory)
|
|
10732
|
-
effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
|
|
10434
|
+
if (effectFactory) effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
|
|
10733
10435
|
if (sp) {
|
|
10734
10436
|
const instance = await FaustWasmInstantiator_default.createAsyncPolyDSPInstance(voiceFactory, mixerModule, voices, effectFactory || void 0);
|
|
10735
10437
|
const soundfiles = { ...effectFactory == null ? void 0 : effectFactory.soundfiles, ...voiceFactory.soundfiles };
|
|
@@ -10739,8 +10441,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
|
|
|
10739
10441
|
sp2.init(polyDsp);
|
|
10740
10442
|
return sp2;
|
|
10741
10443
|
} else {
|
|
10742
|
-
if (!_FaustPolyDspGenerator.gWorkletProcessors.has(context))
|
|
10743
|
-
_FaustPolyDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
|
|
10444
|
+
if (!_FaustPolyDspGenerator.gWorkletProcessors.has(context)) _FaustPolyDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
|
|
10744
10445
|
if (!((_a = _FaustPolyDspGenerator.gWorkletProcessors.get(context)) == null ? void 0 : _a.has(processorName))) {
|
|
10745
10446
|
try {
|
|
10746
10447
|
const processorCode = `
|
|
@@ -10795,8 +10496,7 @@ const dependencies = {
|
|
|
10795
10496
|
}
|
|
10796
10497
|
}
|
|
10797
10498
|
async createAudioWorkletProcessor(name = this.name, voiceFactory = this.voiceFactory, effectFactory = this.effectFactory, processorName = ((voiceFactory == null ? void 0 : voiceFactory.shaKey) || "") + ((effectFactory == null ? void 0 : effectFactory.shaKey) || "") || `${name}_poly`) {
|
|
10798
|
-
if (!voiceFactory)
|
|
10799
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10499
|
+
if (!voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10800
10500
|
const voiceMeta = JSON.parse(voiceFactory.json);
|
|
10801
10501
|
const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
|
|
10802
10502
|
const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
|
|
@@ -10823,16 +10523,14 @@ const dependencies = {
|
|
|
10823
10523
|
}
|
|
10824
10524
|
}
|
|
10825
10525
|
async createOfflineProcessor(sampleRate, bufferSize, voices, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, context) {
|
|
10826
|
-
if (!voiceFactory)
|
|
10827
|
-
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10526
|
+
if (!voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
10828
10527
|
const voiceMeta = JSON.parse(voiceFactory.json);
|
|
10829
10528
|
const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
|
|
10830
10529
|
const instance = await FaustWasmInstantiator_default.createAsyncPolyDSPInstance(voiceFactory, mixerModule, voices, effectFactory || void 0);
|
|
10831
10530
|
const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
|
|
10832
10531
|
if (context) {
|
|
10833
10532
|
voiceFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(voiceMeta, voiceFactory.soundfiles || {}, context);
|
|
10834
|
-
if (effectFactory)
|
|
10835
|
-
effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
|
|
10533
|
+
if (effectFactory) effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
|
|
10836
10534
|
}
|
|
10837
10535
|
const soundfiles = { ...effectFactory == null ? void 0 : effectFactory.soundfiles, ...voiceFactory.soundfiles };
|
|
10838
10536
|
const polyDsp = new FaustPolyWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, soundfiles);
|