@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.
Files changed (40) hide show
  1. package/assets/standalone/faustwasm/index.d.ts +1 -1
  2. package/assets/standalone/faustwasm/index.js +201 -335
  3. package/assets/standalone/faustwasm/index.js.map +2 -2
  4. package/dist/cjs/index.d.ts +1 -1
  5. package/dist/cjs/index.js +203 -338
  6. package/dist/cjs/index.js.map +2 -2
  7. package/dist/cjs-bundle/index.d.ts +1 -1
  8. package/dist/cjs-bundle/index.js +385 -687
  9. package/dist/cjs-bundle/index.js.map +2 -2
  10. package/dist/esm/index.d.ts +1 -1
  11. package/dist/esm/index.js +201 -335
  12. package/dist/esm/index.js.map +2 -2
  13. package/dist/esm-bundle/index.d.ts +1 -1
  14. package/dist/esm-bundle/index.js +385 -687
  15. package/dist/esm-bundle/index.js.map +2 -2
  16. package/package.json +2 -3
  17. package/src/FaustDspGenerator.ts +2 -1
  18. package/src/FaustWebAudioDsp.ts +2 -2
  19. package/src/SoundfileReader.ts +3 -3
  20. package/src/types.ts +1 -1
  21. package/test/faustlive-wasm/faustwasm/index.d.ts +1 -1
  22. package/test/faustlive-wasm/faustwasm/index.js +201 -335
  23. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
  24. package/test/organ/create-node.js +252 -0
  25. package/test/organ/dsp-meta.json +131 -0
  26. package/test/organ/dsp-module.wasm +0 -0
  27. package/test/organ/faust-pwa.js +344 -0
  28. package/test/organ/faust-ui/index.css +442 -0
  29. package/test/organ/faust-ui/index.css.map +1 -0
  30. package/test/organ/faust-ui/index.d.ts +1 -0
  31. package/test/organ/faust-ui/index.js +3756 -0
  32. package/test/organ/faust-ui/index.js.map +1 -0
  33. package/test/organ/faustwasm/index.d.ts +1705 -0
  34. package/test/organ/faustwasm/index.js +4773 -0
  35. package/test/organ/faustwasm/index.js.map +7 -0
  36. package/test/organ/icon.png +0 -0
  37. package/test/organ/index.html +76 -0
  38. package/test/organ/index.js +69 -0
  39. package/test/organ/manifest.json +17 -0
  40. package/test/organ/service-worker.js +165 -0
@@ -4,11 +4,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
7
10
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
11
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
12
  }) : x)(function(x) {
10
- if (typeof require !== "undefined")
11
- return require.apply(this, arguments);
13
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
14
  throw Error('Dynamic require of "' + x + '" is not supported');
13
15
  });
14
16
  var __commonJS = (cb, mod) => function __require2() {
@@ -30,28 +32,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
32
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
33
  mod
32
34
  ));
33
- var __accessCheck = (obj, member, msg) => {
34
- if (!member.has(obj))
35
- throw TypeError("Cannot " + msg);
36
- };
37
- var __privateGet = (obj, member, getter) => {
38
- __accessCheck(obj, member, "read from private field");
39
- return getter ? getter.call(obj) : member.get(obj);
40
- };
41
- var __privateAdd = (obj, member, value) => {
42
- if (member.has(obj))
43
- throw TypeError("Cannot add the same private member more than once");
44
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
45
- };
46
- var __privateSet = (obj, member, value, setter) => {
47
- __accessCheck(obj, member, "write to private field");
48
- setter ? setter.call(obj, value) : member.set(obj, value);
49
- return value;
50
- };
35
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
36
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
37
+ 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);
38
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
51
39
  var __toBinary = /* @__PURE__ */ (() => {
52
40
  var table = new Uint8Array(128);
53
- for (var i = 0; i < 64; i++)
54
- table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
41
+ for (var i = 0; i < 64; i++) table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
55
42
  return (base64) => {
56
43
  var n = base64.length, bytes = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);
57
44
  for (var i2 = 0, j = 0; i2 < n; ) {
@@ -70,9 +57,8 @@ var require_libfaust_wasm = __commonJS({
70
57
  "libfaust-wasm/libfaust-wasm.cjs"(exports, module) {
71
58
  var FaustModule = (() => {
72
59
  var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : void 0;
73
- if (typeof __filename !== "undefined")
74
- _scriptDir = _scriptDir || __filename;
75
- return function(FaustModule2 = {}) {
60
+ if (typeof __filename !== "undefined") _scriptDir = _scriptDir || __filename;
61
+ return (function(FaustModule2 = {}) {
76
62
  var Module = typeof FaustModule2 != "undefined" ? FaustModule2 : {};
77
63
  var readyPromiseResolve, readyPromiseReject;
78
64
  Module["ready"] = new Promise(function(resolve, reject) {
@@ -89,8 +75,7 @@ var require_libfaust_wasm = __commonJS({
89
75
  }
90
76
  Module.expectedDataFileDownloads++;
91
77
  (function() {
92
- if (Module["ENVIRONMENT_IS_PTHREAD"])
93
- return;
78
+ if (Module["ENVIRONMENT_IS_PTHREAD"]) return;
94
79
  var loadPackage = function(metadata) {
95
80
  var PACKAGE_PATH = "";
96
81
  if (typeof window === "object") {
@@ -123,13 +108,11 @@ var require_libfaust_wasm = __commonJS({
123
108
  xhr.onprogress = function(event) {
124
109
  var url = packageName;
125
110
  var size = packageSize;
126
- if (event.total)
127
- size = event.total;
111
+ if (event.total) size = event.total;
128
112
  if (event.loaded) {
129
113
  if (!xhr.addedTotal) {
130
114
  xhr.addedTotal = true;
131
- if (!Module.dataFileDownloads)
132
- Module.dataFileDownloads = {};
115
+ if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
133
116
  Module.dataFileDownloads[url] = { loaded: event.loaded, total: size };
134
117
  } else {
135
118
  Module.dataFileDownloads[url].loaded = event.loaded;
@@ -144,11 +127,9 @@ var require_libfaust_wasm = __commonJS({
144
127
  num++;
145
128
  }
146
129
  total = Math.ceil(total * Module.expectedDataFileDownloads / num);
147
- if (Module["setStatus"])
148
- Module["setStatus"]("Downloading data... (" + loaded + "/" + total + ")");
130
+ if (Module["setStatus"]) Module["setStatus"]("Downloading data... (" + loaded + "/" + total + ")");
149
131
  } else if (!Module.dataFileDownloads) {
150
- if (Module["setStatus"])
151
- Module["setStatus"]("Downloading data...");
132
+ if (Module["setStatus"]) Module["setStatus"]("Downloading data...");
152
133
  }
153
134
  };
154
135
  xhr.onerror = function(event) {
@@ -169,19 +150,17 @@ var require_libfaust_wasm = __commonJS({
169
150
  }
170
151
  var fetchedCallback = null;
171
152
  var fetched = Module["getPreloadedPackage"] ? Module["getPreloadedPackage"](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
172
- if (!fetched)
173
- fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
174
- if (fetchedCallback) {
175
- fetchedCallback(data);
176
- fetchedCallback = null;
177
- } else {
178
- fetched = data;
179
- }
180
- }, handleError);
153
+ if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
154
+ if (fetchedCallback) {
155
+ fetchedCallback(data);
156
+ fetchedCallback = null;
157
+ } else {
158
+ fetched = data;
159
+ }
160
+ }, handleError);
181
161
  function runWithFS() {
182
162
  function assert2(check, msg) {
183
- if (!check)
184
- throw msg + new Error().stack;
163
+ if (!check) throw msg + new Error().stack;
185
164
  }
186
165
  Module["FS_createPath"]("/", "usr", true, true);
187
166
  Module["FS_createPath"]("/usr", "rsrc", true, true);
@@ -222,8 +201,7 @@ var require_libfaust_wasm = __commonJS({
222
201
  Module["removeRunDependency"]("datafile_libfaust-wasm.data");
223
202
  }
224
203
  Module["addRunDependency"]("datafile_libfaust-wasm.data");
225
- if (!Module.preloadResults)
226
- Module.preloadResults = {};
204
+ if (!Module.preloadResults) Module.preloadResults = {};
227
205
  Module.preloadResults[PACKAGE_NAME] = { fromCache: false };
228
206
  if (fetched) {
229
207
  processPackageData(fetched);
@@ -235,21 +213,17 @@ var require_libfaust_wasm = __commonJS({
235
213
  if (Module["calledRun"]) {
236
214
  runWithFS();
237
215
  } else {
238
- if (!Module["preRun"])
239
- Module["preRun"] = [];
216
+ if (!Module["preRun"]) Module["preRun"] = [];
240
217
  Module["preRun"].push(runWithFS);
241
218
  }
242
219
  };
243
220
  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 });
244
221
  })();
245
- if (Module["ENVIRONMENT_IS_PTHREAD"])
246
- Module["preRun"] = [];
222
+ if (Module["ENVIRONMENT_IS_PTHREAD"]) Module["preRun"] = [];
247
223
  var necessaryPreJSTasks = Module["preRun"].slice();
248
- if (!Module["preRun"])
249
- throw "Module.preRun should exist because file support used it; did a pre-js delete it?";
224
+ if (!Module["preRun"]) throw "Module.preRun should exist because file support used it; did a pre-js delete it?";
250
225
  necessaryPreJSTasks.forEach(function(task) {
251
- if (Module["preRun"].indexOf(task) < 0)
252
- throw "All preRun tasks that exist before user pre-js code should remain after; did you replace Module or modify Module.preRun?";
226
+ 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?";
253
227
  });
254
228
  var moduleOverrides = Object.assign({}, Module);
255
229
  var arguments_ = [];
@@ -273,8 +247,7 @@ var require_libfaust_wasm = __commonJS({
273
247
  }
274
248
  var read_, readAsync, readBinary, setWindowTitle;
275
249
  function logExceptionOnExit(e) {
276
- if (e instanceof ExitStatus)
277
- return;
250
+ if (e instanceof ExitStatus) return;
278
251
  let toLog = e;
279
252
  if (e && typeof e == "object" && e.stack) {
280
253
  toLog = [e, e.stack];
@@ -282,8 +255,7 @@ var require_libfaust_wasm = __commonJS({
282
255
  err("exiting due to exception: " + toLog);
283
256
  }
284
257
  if (ENVIRONMENT_IS_NODE) {
285
- if (typeof process == "undefined" || !process.release || process.release.name !== "node")
286
- 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?)");
258
+ 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?)");
287
259
  var fs = __require("fs");
288
260
  var nodePath = __require("path");
289
261
  if (ENVIRONMENT_IS_WORKER) {
@@ -306,10 +278,8 @@ var require_libfaust_wasm = __commonJS({
306
278
  readAsync = (filename, onload, onerror) => {
307
279
  filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
308
280
  fs.readFile(filename, function(err2, data) {
309
- if (err2)
310
- onerror(err2);
311
- else
312
- onload(data.buffer);
281
+ if (err2) onerror(err2);
282
+ else onload(data.buffer);
313
283
  });
314
284
  };
315
285
  if (process["argv"].length > 1) {
@@ -339,8 +309,7 @@ var require_libfaust_wasm = __commonJS({
339
309
  return "[Emscripten Module object]";
340
310
  };
341
311
  } else if (ENVIRONMENT_IS_SHELL) {
342
- if (typeof process == "object" && typeof __require === "function" || typeof window == "object" || typeof importScripts == "function")
343
- 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?)");
312
+ 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?)");
344
313
  if (typeof read != "undefined") {
345
314
  read_ = function shell_read(f) {
346
315
  return read(f);
@@ -374,8 +343,7 @@ var require_libfaust_wasm = __commonJS({
374
343
  };
375
344
  }
376
345
  if (typeof print != "undefined") {
377
- if (typeof console == "undefined")
378
- console = {};
346
+ if (typeof console == "undefined") console = {};
379
347
  console.log = print;
380
348
  console.warn = console.error = typeof printErr != "undefined" ? printErr : print;
381
349
  }
@@ -393,8 +361,7 @@ var require_libfaust_wasm = __commonJS({
393
361
  } else {
394
362
  scriptDirectory = "";
395
363
  }
396
- if (!(typeof window == "object" || typeof importScripts == "function"))
397
- 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?)");
364
+ 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?)");
398
365
  {
399
366
  read_ = (url) => {
400
367
  var xhr = new XMLHttpRequest();
@@ -435,14 +402,11 @@ var require_libfaust_wasm = __commonJS({
435
402
  Object.assign(Module, moduleOverrides);
436
403
  moduleOverrides = null;
437
404
  checkIncomingModuleAPI();
438
- if (Module["arguments"])
439
- arguments_ = Module["arguments"];
405
+ if (Module["arguments"]) arguments_ = Module["arguments"];
440
406
  legacyModuleProp("arguments", "arguments_");
441
- if (Module["thisProgram"])
442
- thisProgram = Module["thisProgram"];
407
+ if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
443
408
  legacyModuleProp("thisProgram", "thisProgram");
444
- if (Module["quit"])
445
- quit_ = Module["quit"];
409
+ if (Module["quit"]) quit_ = Module["quit"];
446
410
  legacyModuleProp("quit", "quit_");
447
411
  assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
448
412
  assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
@@ -459,8 +423,7 @@ var require_libfaust_wasm = __commonJS({
459
423
  legacyModuleProp("setWindowTitle", "setWindowTitle");
460
424
  assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");
461
425
  var wasmBinary;
462
- if (Module["wasmBinary"])
463
- wasmBinary = Module["wasmBinary"];
426
+ if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
464
427
  legacyModuleProp("wasmBinary", "wasmBinary");
465
428
  var noExitRuntime = Module["noExitRuntime"] || true;
466
429
  legacyModuleProp("noExitRuntime", "noExitRuntime");
@@ -479,8 +442,7 @@ var require_libfaust_wasm = __commonJS({
479
442
  function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
480
443
  var endIdx = idx + maxBytesToRead;
481
444
  var endPtr = idx;
482
- while (heapOrArray[endPtr] && !(endPtr >= endIdx))
483
- ++endPtr;
445
+ while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
484
446
  if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
485
447
  return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
486
448
  }
@@ -500,8 +462,7 @@ var require_libfaust_wasm = __commonJS({
500
462
  if ((u0 & 240) == 224) {
501
463
  u0 = (u0 & 15) << 12 | u1 << 6 | u2;
502
464
  } else {
503
- if ((u0 & 248) != 240)
504
- warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
465
+ 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!");
505
466
  u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
506
467
  }
507
468
  if (u0 < 65536) {
@@ -517,8 +478,7 @@ var require_libfaust_wasm = __commonJS({
517
478
  return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
518
479
  }
519
480
  function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
520
- if (!(maxBytesToWrite > 0))
521
- return 0;
481
+ if (!(maxBytesToWrite > 0)) return 0;
522
482
  var startIdx = outIdx;
523
483
  var endIdx = outIdx + maxBytesToWrite - 1;
524
484
  for (var i = 0; i < str.length; ++i) {
@@ -528,25 +488,20 @@ var require_libfaust_wasm = __commonJS({
528
488
  u = 65536 + ((u & 1023) << 10) | u1 & 1023;
529
489
  }
530
490
  if (u <= 127) {
531
- if (outIdx >= endIdx)
532
- break;
491
+ if (outIdx >= endIdx) break;
533
492
  heap[outIdx++] = u;
534
493
  } else if (u <= 2047) {
535
- if (outIdx + 1 >= endIdx)
536
- break;
494
+ if (outIdx + 1 >= endIdx) break;
537
495
  heap[outIdx++] = 192 | u >> 6;
538
496
  heap[outIdx++] = 128 | u & 63;
539
497
  } else if (u <= 65535) {
540
- if (outIdx + 2 >= endIdx)
541
- break;
498
+ if (outIdx + 2 >= endIdx) break;
542
499
  heap[outIdx++] = 224 | u >> 12;
543
500
  heap[outIdx++] = 128 | u >> 6 & 63;
544
501
  heap[outIdx++] = 128 | u & 63;
545
502
  } else {
546
- if (outIdx + 3 >= endIdx)
547
- break;
548
- if (u > 1114111)
549
- 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).");
503
+ if (outIdx + 3 >= endIdx) break;
504
+ 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).");
550
505
  heap[outIdx++] = 240 | u >> 18;
551
506
  heap[outIdx++] = 128 | u >> 12 & 63;
552
507
  heap[outIdx++] = 128 | u >> 6 & 63;
@@ -605,8 +560,7 @@ var require_libfaust_wasm = __commonJS({
605
560
  HEAPU32[0] = 1668509029;
606
561
  }
607
562
  function checkStackCookie() {
608
- if (ABORT)
609
- return;
563
+ if (ABORT) return;
610
564
  var max = _emscripten_stack_get_end();
611
565
  if (max == 0) {
612
566
  max += 4;
@@ -624,8 +578,7 @@ var require_libfaust_wasm = __commonJS({
624
578
  var h16 = new Int16Array(1);
625
579
  var h8 = new Int8Array(h16.buffer);
626
580
  h16[0] = 25459;
627
- if (h8[0] !== 115 || h8[1] !== 99)
628
- throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
581
+ if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)";
629
582
  })();
630
583
  var __ATPRERUN__ = [];
631
584
  var __ATINIT__ = [];
@@ -636,8 +589,7 @@ var require_libfaust_wasm = __commonJS({
636
589
  }
637
590
  function preRun() {
638
591
  if (Module["preRun"]) {
639
- if (typeof Module["preRun"] == "function")
640
- Module["preRun"] = [Module["preRun"]];
592
+ if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
641
593
  while (Module["preRun"].length) {
642
594
  addOnPreRun(Module["preRun"].shift());
643
595
  }
@@ -648,8 +600,7 @@ var require_libfaust_wasm = __commonJS({
648
600
  assert(!runtimeInitialized);
649
601
  runtimeInitialized = true;
650
602
  checkStackCookie();
651
- if (!Module["noFSInit"] && !FS.init.initialized)
652
- FS.init();
603
+ if (!Module["noFSInit"] && !FS.init.initialized) FS.init();
653
604
  FS.ignorePermissions = false;
654
605
  TTY.init();
655
606
  SOCKFS.root = FS.mount(SOCKFS, {}, null);
@@ -658,8 +609,7 @@ var require_libfaust_wasm = __commonJS({
658
609
  function postRun() {
659
610
  checkStackCookie();
660
611
  if (Module["postRun"]) {
661
- if (typeof Module["postRun"] == "function")
662
- Module["postRun"] = [Module["postRun"]];
612
+ if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
663
613
  while (Module["postRun"].length) {
664
614
  addOnPostRun(Module["postRun"].shift());
665
615
  }
@@ -686,8 +636,7 @@ var require_libfaust_wasm = __commonJS({
686
636
  function getUniqueRunDependency(id) {
687
637
  var orig = id;
688
638
  while (1) {
689
- if (!runDependencyTracking[id])
690
- return id;
639
+ if (!runDependencyTracking[id]) return id;
691
640
  id = orig + Math.random();
692
641
  }
693
642
  }
@@ -965,12 +914,10 @@ var require_libfaust_wasm = __commonJS({
965
914
  return "0x" + ptr.toString(16).padStart(8, "0");
966
915
  }
967
916
  function warnOnce(text) {
968
- if (!warnOnce.shown)
969
- warnOnce.shown = {};
917
+ if (!warnOnce.shown) warnOnce.shown = {};
970
918
  if (!warnOnce.shown[text]) {
971
919
  warnOnce.shown[text] = 1;
972
- if (ENVIRONMENT_IS_NODE)
973
- text = "warning: " + text;
920
+ if (ENVIRONMENT_IS_NODE) text = "warning: " + text;
974
921
  err(text);
975
922
  }
976
923
  }
@@ -1039,8 +986,7 @@ var require_libfaust_wasm = __commonJS({
1039
986
  return HEAPU32[this.excPtr >> 2];
1040
987
  }
1041
988
  var adjusted = this.get_adjusted_ptr();
1042
- if (adjusted !== 0)
1043
- return adjusted;
989
+ if (adjusted !== 0) return adjusted;
1044
990
  return this.excPtr;
1045
991
  };
1046
992
  }
@@ -1096,13 +1042,11 @@ var require_libfaust_wasm = __commonJS({
1096
1042
  }
1097
1043
  return root + dir;
1098
1044
  }, basename: (path) => {
1099
- if (path === "/")
1100
- return "/";
1045
+ if (path === "/") return "/";
1101
1046
  path = PATH.normalize(path);
1102
1047
  path = path.replace(/\/$/, "");
1103
1048
  var lastSlash = path.lastIndexOf("/");
1104
- if (lastSlash === -1)
1105
- return path;
1049
+ if (lastSlash === -1) return path;
1106
1050
  return path.substr(lastSlash + 1);
1107
1051
  }, join: function() {
1108
1052
  var paths = Array.prototype.slice.call(arguments);
@@ -1146,16 +1090,13 @@ var require_libfaust_wasm = __commonJS({
1146
1090
  function trim(arr) {
1147
1091
  var start = 0;
1148
1092
  for (; start < arr.length; start++) {
1149
- if (arr[start] !== "")
1150
- break;
1093
+ if (arr[start] !== "") break;
1151
1094
  }
1152
1095
  var end = arr.length - 1;
1153
1096
  for (; end >= 0; end--) {
1154
- if (arr[end] !== "")
1155
- break;
1097
+ if (arr[end] !== "") break;
1156
1098
  }
1157
- if (start > end)
1158
- return [];
1099
+ if (start > end) return [];
1159
1100
  return arr.slice(start, end - start + 1);
1160
1101
  }
1161
1102
  var fromParts = trim(from.split("/"));
@@ -1179,8 +1120,7 @@ var require_libfaust_wasm = __commonJS({
1179
1120
  var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
1180
1121
  var u8array = new Array(len);
1181
1122
  var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
1182
- if (dontAddNull)
1183
- u8array.length = numBytesWritten;
1123
+ if (dontAddNull) u8array.length = numBytesWritten;
1184
1124
  return u8array;
1185
1125
  }
1186
1126
  var TTY = { ttys: [], init: function() {
@@ -1214,8 +1154,7 @@ var require_libfaust_wasm = __commonJS({
1214
1154
  if (result === void 0 && bytesRead === 0) {
1215
1155
  throw new FS.ErrnoError(6);
1216
1156
  }
1217
- if (result === null || result === void 0)
1218
- break;
1157
+ if (result === null || result === void 0) break;
1219
1158
  bytesRead++;
1220
1159
  buffer[offset + i] = result;
1221
1160
  }
@@ -1248,10 +1187,8 @@ var require_libfaust_wasm = __commonJS({
1248
1187
  try {
1249
1188
  bytesRead = fs.readSync(process.stdin.fd, buf, 0, BUFSIZE, -1);
1250
1189
  } catch (e) {
1251
- if (e.toString().includes("EOF"))
1252
- bytesRead = 0;
1253
- else
1254
- throw e;
1190
+ if (e.toString().includes("EOF")) bytesRead = 0;
1191
+ else throw e;
1255
1192
  }
1256
1193
  if (bytesRead > 0) {
1257
1194
  result = buf.slice(0, bytesRead).toString("utf-8");
@@ -1280,8 +1217,7 @@ var require_libfaust_wasm = __commonJS({
1280
1217
  out(UTF8ArrayToString(tty.output, 0));
1281
1218
  tty.output = [];
1282
1219
  } else {
1283
- if (val != 0)
1284
- tty.output.push(val);
1220
+ if (val != 0) tty.output.push(val);
1285
1221
  }
1286
1222
  }, fsync: function(tty) {
1287
1223
  if (tty.output && tty.output.length > 0) {
@@ -1293,8 +1229,7 @@ var require_libfaust_wasm = __commonJS({
1293
1229
  err(UTF8ArrayToString(tty.output, 0));
1294
1230
  tty.output = [];
1295
1231
  } else {
1296
- if (val != 0)
1297
- tty.output.push(val);
1232
+ if (val != 0) tty.output.push(val);
1298
1233
  }
1299
1234
  }, fsync: function(tty) {
1300
1235
  if (tty.output && tty.output.length > 0) {
@@ -1338,26 +1273,20 @@ var require_libfaust_wasm = __commonJS({
1338
1273
  }
1339
1274
  return node;
1340
1275
  }, getFileDataAsTypedArray: function(node) {
1341
- if (!node.contents)
1342
- return new Uint8Array(0);
1343
- if (node.contents.subarray)
1344
- return node.contents.subarray(0, node.usedBytes);
1276
+ if (!node.contents) return new Uint8Array(0);
1277
+ if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes);
1345
1278
  return new Uint8Array(node.contents);
1346
1279
  }, expandFileStorage: function(node, newCapacity) {
1347
1280
  var prevCapacity = node.contents ? node.contents.length : 0;
1348
- if (prevCapacity >= newCapacity)
1349
- return;
1281
+ if (prevCapacity >= newCapacity) return;
1350
1282
  var CAPACITY_DOUBLING_MAX = 1024 * 1024;
1351
1283
  newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
1352
- if (prevCapacity != 0)
1353
- newCapacity = Math.max(newCapacity, 256);
1284
+ if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
1354
1285
  var oldContents = node.contents;
1355
1286
  node.contents = new Uint8Array(newCapacity);
1356
- if (node.usedBytes > 0)
1357
- node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
1287
+ if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
1358
1288
  }, resizeFileStorage: function(node, newSize) {
1359
- if (node.usedBytes == newSize)
1360
- return;
1289
+ if (node.usedBytes == newSize) return;
1361
1290
  if (newSize == 0) {
1362
1291
  node.contents = null;
1363
1292
  node.usedBytes = 0;
@@ -1456,15 +1385,13 @@ var require_libfaust_wasm = __commonJS({
1456
1385
  return node.link;
1457
1386
  } }, stream_ops: { read: function(stream, buffer, offset, length, position) {
1458
1387
  var contents = stream.node.contents;
1459
- if (position >= stream.node.usedBytes)
1460
- return 0;
1388
+ if (position >= stream.node.usedBytes) return 0;
1461
1389
  var size = Math.min(stream.node.usedBytes - position, length);
1462
1390
  assert(size >= 0);
1463
1391
  if (size > 8 && contents.subarray) {
1464
1392
  buffer.set(contents.subarray(position, position + size), offset);
1465
1393
  } else {
1466
- for (var i = 0; i < size; i++)
1467
- buffer[offset + i] = contents[position + i];
1394
+ for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
1468
1395
  }
1469
1396
  return size;
1470
1397
  }, write: function(stream, buffer, offset, length, position, canOwn) {
@@ -1472,8 +1399,7 @@ var require_libfaust_wasm = __commonJS({
1472
1399
  if (buffer.buffer === HEAP8.buffer) {
1473
1400
  canOwn = false;
1474
1401
  }
1475
- if (!length)
1476
- return 0;
1402
+ if (!length) return 0;
1477
1403
  var node = stream.node;
1478
1404
  node.timestamp = Date.now();
1479
1405
  if (buffer.subarray && (!node.contents || node.contents.subarray)) {
@@ -1552,8 +1478,7 @@ var require_libfaust_wasm = __commonJS({
1552
1478
  readAsync(url, (arrayBuffer) => {
1553
1479
  assert(arrayBuffer, 'Loading data file "' + url + '" failed (no arrayBuffer).');
1554
1480
  onload(new Uint8Array(arrayBuffer));
1555
- if (dep)
1556
- removeRunDependency(dep);
1481
+ if (dep) removeRunDependency(dep);
1557
1482
  }, (event) => {
1558
1483
  if (onerror) {
1559
1484
  onerror();
@@ -1561,8 +1486,7 @@ var require_libfaust_wasm = __commonJS({
1561
1486
  throw 'Loading data file "' + url + '" failed.';
1562
1487
  }
1563
1488
  });
1564
- if (dep)
1565
- addRunDependency(dep);
1489
+ if (dep) addRunDependency(dep);
1566
1490
  }
1567
1491
  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" };
1568
1492
  var ERRNO_CODES = {};
@@ -1579,8 +1503,7 @@ var require_libfaust_wasm = __commonJS({
1579
1503
  }
1580
1504
  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 = {}) => {
1581
1505
  path = PATH_FS.resolve(path);
1582
- if (!path)
1583
- return { path: "", node: null };
1506
+ if (!path) return { path: "", node: null };
1584
1507
  var defaults = { follow_mount: true, recurse_count: 0 };
1585
1508
  opts = Object.assign(defaults, opts);
1586
1509
  if (opts.recurse_count > 8) {
@@ -1620,8 +1543,7 @@ var require_libfaust_wasm = __commonJS({
1620
1543
  while (true) {
1621
1544
  if (FS.isRoot(node)) {
1622
1545
  var mount = node.mount.mountpoint;
1623
- if (!path)
1624
- return mount;
1546
+ if (!path) return mount;
1625
1547
  return mount[mount.length - 1] !== "/" ? mount + "/" + path : mount + path;
1626
1548
  }
1627
1549
  path = path ? node.name + "/" + path : node.name;
@@ -1715,10 +1637,8 @@ var require_libfaust_wasm = __commonJS({
1715
1637
  return 0;
1716
1638
  }, mayLookup: (dir) => {
1717
1639
  var errCode = FS.nodePermissions(dir, "x");
1718
- if (errCode)
1719
- return errCode;
1720
- if (!dir.node_ops.lookup)
1721
- return 2;
1640
+ if (errCode) return errCode;
1641
+ if (!dir.node_ops.lookup) return 2;
1722
1642
  return 0;
1723
1643
  }, mayCreate: (dir, name) => {
1724
1644
  try {
@@ -1942,14 +1862,12 @@ var require_libfaust_wasm = __commonJS({
1942
1862
  var dirs = path.split("/");
1943
1863
  var d = "";
1944
1864
  for (var i = 0; i < dirs.length; ++i) {
1945
- if (!dirs[i])
1946
- continue;
1865
+ if (!dirs[i]) continue;
1947
1866
  d += "/" + dirs[i];
1948
1867
  try {
1949
1868
  FS.mkdir(d, mode);
1950
1869
  } catch (e) {
1951
- if (e.errno != 20)
1952
- throw e;
1870
+ if (e.errno != 20) throw e;
1953
1871
  }
1954
1872
  }
1955
1873
  }, mkdev: (path, mode, dev) => {
@@ -1987,8 +1905,7 @@ var require_libfaust_wasm = __commonJS({
1987
1905
  old_dir = lookup.node;
1988
1906
  lookup = FS.lookupPath(new_path, { parent: true });
1989
1907
  new_dir = lookup.node;
1990
- if (!old_dir || !new_dir)
1991
- throw new FS.ErrnoError(44);
1908
+ if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
1992
1909
  if (old_dir.mount !== new_dir.mount) {
1993
1910
  throw new FS.ErrnoError(75);
1994
1911
  }
@@ -2239,8 +2156,7 @@ var require_libfaust_wasm = __commonJS({
2239
2156
  stream.stream_ops.open(stream);
2240
2157
  }
2241
2158
  if (Module["logReadFiles"] && !(flags & 1)) {
2242
- if (!FS.readFiles)
2243
- FS.readFiles = {};
2159
+ if (!FS.readFiles) FS.readFiles = {};
2244
2160
  if (!(path in FS.readFiles)) {
2245
2161
  FS.readFiles[path] = 1;
2246
2162
  }
@@ -2250,8 +2166,7 @@ var require_libfaust_wasm = __commonJS({
2250
2166
  if (FS.isClosed(stream)) {
2251
2167
  throw new FS.ErrnoError(8);
2252
2168
  }
2253
- if (stream.getdents)
2254
- stream.getdents = null;
2169
+ if (stream.getdents) stream.getdents = null;
2255
2170
  try {
2256
2171
  if (stream.stream_ops.close) {
2257
2172
  stream.stream_ops.close(stream);
@@ -2300,8 +2215,7 @@ var require_libfaust_wasm = __commonJS({
2300
2215
  throw new FS.ErrnoError(70);
2301
2216
  }
2302
2217
  var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
2303
- if (!seeking)
2304
- stream.position += bytesRead;
2218
+ if (!seeking) stream.position += bytesRead;
2305
2219
  return bytesRead;
2306
2220
  }, write: (stream, buffer, offset, length, position, canOwn) => {
2307
2221
  if (length < 0 || position < 0) {
@@ -2329,8 +2243,7 @@ var require_libfaust_wasm = __commonJS({
2329
2243
  throw new FS.ErrnoError(70);
2330
2244
  }
2331
2245
  var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
2332
- if (!seeking)
2333
- stream.position += bytesWritten;
2246
+ if (!seeking) stream.position += bytesWritten;
2334
2247
  return bytesWritten;
2335
2248
  }, allocate: (stream, offset, length) => {
2336
2249
  if (FS.isClosed(stream)) {
@@ -2441,8 +2354,7 @@ var require_libfaust_wasm = __commonJS({
2441
2354
  node.node_ops = { lookup: (parent, name) => {
2442
2355
  var fd = +name;
2443
2356
  var stream = FS.getStream(fd);
2444
- if (!stream)
2445
- throw new FS.ErrnoError(8);
2357
+ if (!stream) throw new FS.ErrnoError(8);
2446
2358
  var ret = { parent: null, mount: { mountpoint: "fake" }, node_ops: { readlink: () => stream.path } };
2447
2359
  ret.parent = ret;
2448
2360
  return ret;
@@ -2472,8 +2384,7 @@ var require_libfaust_wasm = __commonJS({
2472
2384
  assert(stdout.fd === 1, "invalid handle for stdout (" + stdout.fd + ")");
2473
2385
  assert(stderr.fd === 2, "invalid handle for stderr (" + stderr.fd + ")");
2474
2386
  }, ensureErrnoError: () => {
2475
- if (FS.ErrnoError)
2476
- return;
2387
+ if (FS.ErrnoError) return;
2477
2388
  FS.ErrnoError = function ErrnoError(errno, node) {
2478
2389
  this.node = node;
2479
2390
  this.setErrno = function(errno2) {
@@ -2526,10 +2437,8 @@ var require_libfaust_wasm = __commonJS({
2526
2437
  }
2527
2438
  }, getMode: (canRead, canWrite) => {
2528
2439
  var mode = 0;
2529
- if (canRead)
2530
- mode |= 292 | 73;
2531
- if (canWrite)
2532
- mode |= 146;
2440
+ if (canRead) mode |= 292 | 73;
2441
+ if (canWrite) mode |= 146;
2533
2442
  return mode;
2534
2443
  }, findObject: (path, dontResolveLastLink) => {
2535
2444
  var ret = FS.analyzePath(path, dontResolveLastLink);
@@ -2565,8 +2474,7 @@ var require_libfaust_wasm = __commonJS({
2565
2474
  var parts = path.split("/").reverse();
2566
2475
  while (parts.length) {
2567
2476
  var part = parts.pop();
2568
- if (!part)
2569
- continue;
2477
+ if (!part) continue;
2570
2478
  var current = PATH.join2(parent, part);
2571
2479
  try {
2572
2480
  FS.mkdir(current);
@@ -2590,8 +2498,7 @@ var require_libfaust_wasm = __commonJS({
2590
2498
  if (data) {
2591
2499
  if (typeof data == "string") {
2592
2500
  var arr = new Array(data.length);
2593
- for (var i = 0, len = data.length; i < len; ++i)
2594
- arr[i] = data.charCodeAt(i);
2501
+ for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
2595
2502
  data = arr;
2596
2503
  }
2597
2504
  FS.chmod(node, mode | 146);
@@ -2604,8 +2511,7 @@ var require_libfaust_wasm = __commonJS({
2604
2511
  }, createDevice: (parent, name, input, output) => {
2605
2512
  var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2606
2513
  var mode = FS.getMode(!!input, !!output);
2607
- if (!FS.createDevice.major)
2608
- FS.createDevice.major = 64;
2514
+ if (!FS.createDevice.major) FS.createDevice.major = 64;
2609
2515
  var dev = FS.makedev(FS.createDevice.major++, 0);
2610
2516
  FS.registerDevice(dev, { open: (stream) => {
2611
2517
  stream.seekable = false;
@@ -2625,8 +2531,7 @@ var require_libfaust_wasm = __commonJS({
2625
2531
  if (result === void 0 && bytesRead === 0) {
2626
2532
  throw new FS.ErrnoError(6);
2627
2533
  }
2628
- if (result === null || result === void 0)
2629
- break;
2534
+ if (result === null || result === void 0) break;
2630
2535
  bytesRead++;
2631
2536
  buffer[offset + i] = result;
2632
2537
  }
@@ -2649,8 +2554,7 @@ var require_libfaust_wasm = __commonJS({
2649
2554
  } });
2650
2555
  return FS.mkdev(path, mode, dev);
2651
2556
  }, forceLoadFile: (obj) => {
2652
- if (obj.isDevice || obj.isFolder || obj.link || obj.contents)
2653
- return true;
2557
+ if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
2654
2558
  if (typeof XMLHttpRequest != "undefined") {
2655
2559
  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.");
2656
2560
  } else if (read_) {
@@ -2683,31 +2587,25 @@ var require_libfaust_wasm = __commonJS({
2683
2587
  var xhr = new XMLHttpRequest();
2684
2588
  xhr.open("HEAD", url, false);
2685
2589
  xhr.send(null);
2686
- if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))
2687
- throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
2590
+ if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
2688
2591
  var datalength = Number(xhr.getResponseHeader("Content-length"));
2689
2592
  var header;
2690
2593
  var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
2691
2594
  var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
2692
2595
  var chunkSize = 1024 * 1024;
2693
- if (!hasByteServing)
2694
- chunkSize = datalength;
2596
+ if (!hasByteServing) chunkSize = datalength;
2695
2597
  var doXHR = (from, to) => {
2696
- if (from > to)
2697
- throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
2698
- if (to > datalength - 1)
2699
- throw new Error("only " + datalength + " bytes available! programmer error!");
2598
+ if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
2599
+ if (to > datalength - 1) throw new Error("only " + datalength + " bytes available! programmer error!");
2700
2600
  var xhr2 = new XMLHttpRequest();
2701
2601
  xhr2.open("GET", url, false);
2702
- if (datalength !== chunkSize)
2703
- xhr2.setRequestHeader("Range", "bytes=" + from + "-" + to);
2602
+ if (datalength !== chunkSize) xhr2.setRequestHeader("Range", "bytes=" + from + "-" + to);
2704
2603
  xhr2.responseType = "arraybuffer";
2705
2604
  if (xhr2.overrideMimeType) {
2706
2605
  xhr2.overrideMimeType("text/plain; charset=x-user-defined");
2707
2606
  }
2708
2607
  xhr2.send(null);
2709
- if (!(xhr2.status >= 200 && xhr2.status < 300 || xhr2.status === 304))
2710
- throw new Error("Couldn't load " + url + ". Status: " + xhr2.status);
2608
+ if (!(xhr2.status >= 200 && xhr2.status < 300 || xhr2.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr2.status);
2711
2609
  if (xhr2.response !== void 0) {
2712
2610
  return new Uint8Array(xhr2.response || []);
2713
2611
  }
@@ -2721,8 +2619,7 @@ var require_libfaust_wasm = __commonJS({
2721
2619
  if (typeof lazyArray2.chunks[chunkNum] == "undefined") {
2722
2620
  lazyArray2.chunks[chunkNum] = doXHR(start, end);
2723
2621
  }
2724
- if (typeof lazyArray2.chunks[chunkNum] == "undefined")
2725
- throw new Error("doXHR failed!");
2622
+ if (typeof lazyArray2.chunks[chunkNum] == "undefined") throw new Error("doXHR failed!");
2726
2623
  return lazyArray2.chunks[chunkNum];
2727
2624
  });
2728
2625
  if (usesGzip || !datalength) {
@@ -2736,8 +2633,7 @@ var require_libfaust_wasm = __commonJS({
2736
2633
  this.lengthKnown = true;
2737
2634
  };
2738
2635
  if (typeof XMLHttpRequest != "undefined") {
2739
- if (!ENVIRONMENT_IS_WORKER)
2740
- throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
2636
+ if (!ENVIRONMENT_IS_WORKER) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
2741
2637
  var lazyArray = new LazyUint8Array();
2742
2638
  Object.defineProperties(lazyArray, { length: { get: function() {
2743
2639
  if (!this.lengthKnown) {
@@ -2775,8 +2671,7 @@ var require_libfaust_wasm = __commonJS({
2775
2671
  });
2776
2672
  function writeChunks(stream, buffer, offset, length, position) {
2777
2673
  var contents = stream.node.contents;
2778
- if (position >= contents.length)
2779
- return 0;
2674
+ if (position >= contents.length) return 0;
2780
2675
  var size = Math.min(contents.length - position, length);
2781
2676
  assert(size >= 0);
2782
2677
  if (contents.slice) {
@@ -2810,18 +2705,15 @@ var require_libfaust_wasm = __commonJS({
2810
2705
  var dep = getUniqueRunDependency("cp " + fullname);
2811
2706
  function processData(byteArray) {
2812
2707
  function finish(byteArray2) {
2813
- if (preFinish)
2814
- preFinish();
2708
+ if (preFinish) preFinish();
2815
2709
  if (!dontCreateFile) {
2816
2710
  FS.createDataFile(parent, name, byteArray2, canRead, canWrite, canOwn);
2817
2711
  }
2818
- if (onload)
2819
- onload();
2712
+ if (onload) onload();
2820
2713
  removeRunDependency(dep);
2821
2714
  }
2822
2715
  if (Browser.handledByPreloadPlugin(byteArray, fullname, finish, () => {
2823
- if (onerror)
2824
- onerror();
2716
+ if (onerror) onerror();
2825
2717
  removeRunDependency(dep);
2826
2718
  })) {
2827
2719
  return;
@@ -2838,9 +2730,9 @@ var require_libfaust_wasm = __commonJS({
2838
2730
  return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
2839
2731
  }, DB_NAME: () => {
2840
2732
  return "EM_FS_" + window.location.pathname;
2841
- }, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: (paths, onload = () => {
2842
- }, onerror = () => {
2843
- }) => {
2733
+ }, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: (paths, onload = (() => {
2734
+ }), onerror = (() => {
2735
+ })) => {
2844
2736
  var indexedDB = FS.indexedDB();
2845
2737
  try {
2846
2738
  var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
@@ -2858,30 +2750,26 @@ var require_libfaust_wasm = __commonJS({
2858
2750
  var files = transaction.objectStore(FS.DB_STORE_NAME);
2859
2751
  var ok = 0, fail = 0, total = paths.length;
2860
2752
  function finish() {
2861
- if (fail == 0)
2862
- onload();
2863
- else
2864
- onerror();
2753
+ if (fail == 0) onload();
2754
+ else onerror();
2865
2755
  }
2866
2756
  paths.forEach((path) => {
2867
2757
  var putRequest = files.put(FS.analyzePath(path).object.contents, path);
2868
2758
  putRequest.onsuccess = () => {
2869
2759
  ok++;
2870
- if (ok + fail == total)
2871
- finish();
2760
+ if (ok + fail == total) finish();
2872
2761
  };
2873
2762
  putRequest.onerror = () => {
2874
2763
  fail++;
2875
- if (ok + fail == total)
2876
- finish();
2764
+ if (ok + fail == total) finish();
2877
2765
  };
2878
2766
  });
2879
2767
  transaction.onerror = onerror;
2880
2768
  };
2881
2769
  openRequest.onerror = onerror;
2882
- }, loadFilesFromDB: (paths, onload = () => {
2883
- }, onerror = () => {
2884
- }) => {
2770
+ }, loadFilesFromDB: (paths, onload = (() => {
2771
+ }), onerror = (() => {
2772
+ })) => {
2885
2773
  var indexedDB = FS.indexedDB();
2886
2774
  try {
2887
2775
  var openRequest = indexedDB.open(FS.DB_NAME(), FS.DB_VERSION);
@@ -2900,10 +2788,8 @@ var require_libfaust_wasm = __commonJS({
2900
2788
  var files = transaction.objectStore(FS.DB_STORE_NAME);
2901
2789
  var ok = 0, fail = 0, total = paths.length;
2902
2790
  function finish() {
2903
- if (fail == 0)
2904
- onload();
2905
- else
2906
- onerror();
2791
+ if (fail == 0) onload();
2792
+ else onerror();
2907
2793
  }
2908
2794
  paths.forEach((path) => {
2909
2795
  var getRequest = files.get(path);
@@ -2913,13 +2799,11 @@ var require_libfaust_wasm = __commonJS({
2913
2799
  }
2914
2800
  FS.createDataFile(PATH.dirname(path), PATH.basename(path), getRequest.result, true, true, true);
2915
2801
  ok++;
2916
- if (ok + fail == total)
2917
- finish();
2802
+ if (ok + fail == total) finish();
2918
2803
  };
2919
2804
  getRequest.onerror = () => {
2920
2805
  fail++;
2921
- if (ok + fail == total)
2922
- finish();
2806
+ if (ok + fail == total) finish();
2923
2807
  };
2924
2808
  });
2925
2809
  transaction.onerror = onerror;
@@ -3005,8 +2889,7 @@ var require_libfaust_wasm = __commonJS({
3005
2889
  return ret;
3006
2890
  }, getStreamFromFD: function(fd) {
3007
2891
  var stream = FS.getStream(fd);
3008
- if (!stream)
3009
- throw new FS.ErrnoError(8);
2892
+ if (!stream) throw new FS.ErrnoError(8);
3010
2893
  return stream;
3011
2894
  } };
3012
2895
  function ___syscall__newselect(nfds, readfds, writefds, exceptfds, timeout) {
@@ -3062,8 +2945,7 @@ var require_libfaust_wasm = __commonJS({
3062
2945
  }
3063
2946
  return total;
3064
2947
  } catch (e) {
3065
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3066
- throw e;
2948
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3067
2949
  return -e.errno;
3068
2950
  }
3069
2951
  }
@@ -3073,8 +2955,7 @@ var require_libfaust_wasm = __commonJS({
3073
2955
  FS.chdir(path);
3074
2956
  return 0;
3075
2957
  } catch (e) {
3076
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3077
- throw e;
2958
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3078
2959
  return -e.errno;
3079
2960
  }
3080
2961
  }
@@ -3334,10 +3215,8 @@ var require_libfaust_wasm = __commonJS({
3334
3215
  try {
3335
3216
  sock.sock_ops.listen(sock, 0);
3336
3217
  } catch (e) {
3337
- if (!(e instanceof FS.ErrnoError))
3338
- throw e;
3339
- if (e.errno !== 138)
3340
- throw e;
3218
+ if (!(e instanceof FS.ErrnoError)) throw e;
3219
+ if (e.errno !== 138) throw e;
3341
3220
  }
3342
3221
  }
3343
3222
  }, connect: function(sock, addr, port) {
@@ -3484,8 +3363,7 @@ var require_libfaust_wasm = __commonJS({
3484
3363
  } } };
3485
3364
  function getSocketFromFD(fd) {
3486
3365
  var socket = SOCKFS.getSocket(fd);
3487
- if (!socket)
3488
- throw new FS.ErrnoError(8);
3366
+ if (!socket) throw new FS.ErrnoError(8);
3489
3367
  return socket;
3490
3368
  }
3491
3369
  function setErrNo(value) {
@@ -3521,10 +3399,8 @@ var require_libfaust_wasm = __commonJS({
3521
3399
  }
3522
3400
  if (parts[5] === 0) {
3523
3401
  str = "::";
3524
- if (v4part === "0.0.0.0")
3525
- v4part = "";
3526
- if (v4part === "0.0.0.1")
3527
- v4part = "1";
3402
+ if (v4part === "0.0.0.0") v4part = "";
3403
+ if (v4part === "0.0.0.1") v4part = "1";
3528
3404
  str += v4part;
3529
3405
  return str;
3530
3406
  }
@@ -3547,8 +3423,7 @@ var require_libfaust_wasm = __commonJS({
3547
3423
  if (parts[word] === 0 && word >= zstart && word < zstart + longest) {
3548
3424
  if (word === zstart) {
3549
3425
  str += ":";
3550
- if (zstart === 0)
3551
- str += ":";
3426
+ if (zstart === 0) str += ":";
3552
3427
  }
3553
3428
  continue;
3554
3429
  }
@@ -3586,8 +3461,7 @@ var require_libfaust_wasm = __commonJS({
3586
3461
  var b = str.split(".");
3587
3462
  for (var i = 0; i < 4; i++) {
3588
3463
  var tmp = Number(b[i]);
3589
- if (isNaN(tmp))
3590
- return null;
3464
+ if (isNaN(tmp)) return null;
3591
3465
  b[i] = tmp;
3592
3466
  }
3593
3467
  return (b[0] | b[1] << 8 | b[2] << 16 | b[3] << 24) >>> 0;
@@ -3665,11 +3539,9 @@ var require_libfaust_wasm = __commonJS({
3665
3539
  return null;
3666
3540
  } };
3667
3541
  function getSocketAddress(addrp, addrlen, allowNull) {
3668
- if (allowNull && addrp === 0)
3669
- return null;
3542
+ if (allowNull && addrp === 0) return null;
3670
3543
  var info = readSockaddr(addrp, addrlen);
3671
- if (info.errno)
3672
- throw new FS.ErrnoError(info.errno);
3544
+ if (info.errno) throw new FS.ErrnoError(info.errno);
3673
3545
  info.addr = DNS.lookup_addr(info.addr) || info.addr;
3674
3546
  return info;
3675
3547
  }
@@ -3680,8 +3552,7 @@ var require_libfaust_wasm = __commonJS({
3680
3552
  sock.sock_ops.connect(sock, info.addr, info.port);
3681
3553
  return 0;
3682
3554
  } catch (e) {
3683
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3684
- throw e;
3555
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3685
3556
  return -e.errno;
3686
3557
  }
3687
3558
  }
@@ -3729,24 +3600,20 @@ var require_libfaust_wasm = __commonJS({
3729
3600
  }
3730
3601
  }
3731
3602
  } catch (e) {
3732
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3733
- throw e;
3603
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3734
3604
  return -e.errno;
3735
3605
  }
3736
3606
  }
3737
3607
  function ___syscall_getcwd(buf, size) {
3738
3608
  try {
3739
- if (size === 0)
3740
- return -28;
3609
+ if (size === 0) return -28;
3741
3610
  var cwd = FS.cwd();
3742
3611
  var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1;
3743
- if (size < cwdLengthInBytes)
3744
- return -68;
3612
+ if (size < cwdLengthInBytes) return -68;
3745
3613
  stringToUTF8(cwd, buf, size);
3746
3614
  return cwdLengthInBytes;
3747
3615
  } catch (e) {
3748
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3749
- throw e;
3616
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3750
3617
  return -e.errno;
3751
3618
  }
3752
3619
  }
@@ -3757,8 +3624,7 @@ var require_libfaust_wasm = __commonJS({
3757
3624
  switch (op) {
3758
3625
  case 21509:
3759
3626
  case 21505: {
3760
- if (!stream.tty)
3761
- return -59;
3627
+ if (!stream.tty) return -59;
3762
3628
  return 0;
3763
3629
  }
3764
3630
  case 21510:
@@ -3767,20 +3633,17 @@ var require_libfaust_wasm = __commonJS({
3767
3633
  case 21506:
3768
3634
  case 21507:
3769
3635
  case 21508: {
3770
- if (!stream.tty)
3771
- return -59;
3636
+ if (!stream.tty) return -59;
3772
3637
  return 0;
3773
3638
  }
3774
3639
  case 21519: {
3775
- if (!stream.tty)
3776
- return -59;
3640
+ if (!stream.tty) return -59;
3777
3641
  var argp = SYSCALLS.get();
3778
3642
  HEAP32[argp >> 2] = 0;
3779
3643
  return 0;
3780
3644
  }
3781
3645
  case 21520: {
3782
- if (!stream.tty)
3783
- return -59;
3646
+ if (!stream.tty) return -59;
3784
3647
  return -28;
3785
3648
  }
3786
3649
  case 21531: {
@@ -3788,21 +3651,18 @@ var require_libfaust_wasm = __commonJS({
3788
3651
  return FS.ioctl(stream, op, argp);
3789
3652
  }
3790
3653
  case 21523: {
3791
- if (!stream.tty)
3792
- return -59;
3654
+ if (!stream.tty) return -59;
3793
3655
  return 0;
3794
3656
  }
3795
3657
  case 21524: {
3796
- if (!stream.tty)
3797
- return -59;
3658
+ if (!stream.tty) return -59;
3798
3659
  return 0;
3799
3660
  }
3800
3661
  default:
3801
3662
  return -28;
3802
3663
  }
3803
3664
  } catch (e) {
3804
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3805
- throw e;
3665
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3806
3666
  return -e.errno;
3807
3667
  }
3808
3668
  }
@@ -3811,13 +3671,11 @@ var require_libfaust_wasm = __commonJS({
3811
3671
  path = SYSCALLS.getStr(path);
3812
3672
  path = SYSCALLS.calculateAt(dirfd, path);
3813
3673
  path = PATH.normalize(path);
3814
- if (path[path.length - 1] === "/")
3815
- path = path.substr(0, path.length - 1);
3674
+ if (path[path.length - 1] === "/") path = path.substr(0, path.length - 1);
3816
3675
  FS.mkdir(path, mode, 0);
3817
3676
  return 0;
3818
3677
  } catch (e) {
3819
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3820
- throw e;
3678
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3821
3679
  return -e.errno;
3822
3680
  }
3823
3681
  }
@@ -3829,8 +3687,7 @@ var require_libfaust_wasm = __commonJS({
3829
3687
  var mode = varargs ? SYSCALLS.get() : 0;
3830
3688
  return FS.open(path, flags, mode).fd;
3831
3689
  } catch (e) {
3832
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3833
- throw e;
3690
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3834
3691
  return -e.errno;
3835
3692
  }
3836
3693
  }
@@ -3838,8 +3695,7 @@ var require_libfaust_wasm = __commonJS({
3838
3695
  try {
3839
3696
  path = SYSCALLS.getStr(path);
3840
3697
  path = SYSCALLS.calculateAt(dirfd, path);
3841
- if (bufsize <= 0)
3842
- return -28;
3698
+ if (bufsize <= 0) return -28;
3843
3699
  var ret = FS.readlink(path);
3844
3700
  var len = Math.min(bufsize, lengthBytesUTF8(ret));
3845
3701
  var endChar = HEAP8[buf + len];
@@ -3847,8 +3703,7 @@ var require_libfaust_wasm = __commonJS({
3847
3703
  HEAP8[buf + len] = endChar;
3848
3704
  return len;
3849
3705
  } catch (e) {
3850
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3851
- throw e;
3706
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3852
3707
  return -e.errno;
3853
3708
  }
3854
3709
  }
@@ -3858,8 +3713,7 @@ var require_libfaust_wasm = __commonJS({
3858
3713
  assert(sock.stream.fd < 64);
3859
3714
  return sock.stream.fd;
3860
3715
  } catch (e) {
3861
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
3862
- throw e;
3716
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
3863
3717
  return -e.errno;
3864
3718
  }
3865
3719
  }
@@ -4556,8 +4410,7 @@ var require_libfaust_wasm = __commonJS({
4556
4410
  function getWasmTableEntry(funcPtr) {
4557
4411
  var func = wasmTableMirror[funcPtr];
4558
4412
  if (!func) {
4559
- if (funcPtr >= wasmTableMirror.length)
4560
- wasmTableMirror.length = funcPtr + 1;
4413
+ if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
4561
4414
  wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
4562
4415
  }
4563
4416
  assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!");
@@ -5042,16 +4895,13 @@ var require_libfaust_wasm = __commonJS({
5042
4895
  var endPtr = ptr;
5043
4896
  var idx = endPtr >> 1;
5044
4897
  var maxIdx = idx + maxBytesToRead / 2;
5045
- while (!(idx >= maxIdx) && HEAPU16[idx])
5046
- ++idx;
4898
+ while (!(idx >= maxIdx) && HEAPU16[idx]) ++idx;
5047
4899
  endPtr = idx << 1;
5048
- if (endPtr - ptr > 32 && UTF16Decoder)
5049
- return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
4900
+ if (endPtr - ptr > 32 && UTF16Decoder) return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
5050
4901
  var str = "";
5051
4902
  for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {
5052
4903
  var codeUnit = HEAP16[ptr + i * 2 >> 1];
5053
- if (codeUnit == 0)
5054
- break;
4904
+ if (codeUnit == 0) break;
5055
4905
  str += String.fromCharCode(codeUnit);
5056
4906
  }
5057
4907
  return str;
@@ -5062,8 +4912,7 @@ var require_libfaust_wasm = __commonJS({
5062
4912
  if (maxBytesToWrite === void 0) {
5063
4913
  maxBytesToWrite = 2147483647;
5064
4914
  }
5065
- if (maxBytesToWrite < 2)
5066
- return 0;
4915
+ if (maxBytesToWrite < 2) return 0;
5067
4916
  maxBytesToWrite -= 2;
5068
4917
  var startPtr = outPtr;
5069
4918
  var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
@@ -5084,8 +4933,7 @@ var require_libfaust_wasm = __commonJS({
5084
4933
  var str = "";
5085
4934
  while (!(i >= maxBytesToRead / 4)) {
5086
4935
  var utf32 = HEAP32[ptr + i * 4 >> 2];
5087
- if (utf32 == 0)
5088
- break;
4936
+ if (utf32 == 0) break;
5089
4937
  ++i;
5090
4938
  if (utf32 >= 65536) {
5091
4939
  var ch = utf32 - 65536;
@@ -5102,8 +4950,7 @@ var require_libfaust_wasm = __commonJS({
5102
4950
  if (maxBytesToWrite === void 0) {
5103
4951
  maxBytesToWrite = 2147483647;
5104
4952
  }
5105
- if (maxBytesToWrite < 4)
5106
- return 0;
4953
+ if (maxBytesToWrite < 4) return 0;
5107
4954
  var startPtr = outPtr;
5108
4955
  var endPtr = startPtr + maxBytesToWrite - 4;
5109
4956
  for (var i = 0; i < str.length; ++i) {
@@ -5114,8 +4961,7 @@ var require_libfaust_wasm = __commonJS({
5114
4961
  }
5115
4962
  HEAP32[outPtr >> 2] = codeUnit;
5116
4963
  outPtr += 4;
5117
- if (outPtr + 4 > endPtr)
5118
- break;
4964
+ if (outPtr + 4 > endPtr) break;
5119
4965
  }
5120
4966
  HEAP32[outPtr >> 2] = 0;
5121
4967
  return outPtr - startPtr;
@@ -5124,8 +4970,7 @@ var require_libfaust_wasm = __commonJS({
5124
4970
  var len = 0;
5125
4971
  for (var i = 0; i < str.length; ++i) {
5126
4972
  var codeUnit = str.charCodeAt(i);
5127
- if (codeUnit >= 55296 && codeUnit <= 57343)
5128
- ++i;
4973
+ if (codeUnit >= 55296 && codeUnit <= 57343) ++i;
5129
4974
  len += 4;
5130
4975
  }
5131
4976
  return len;
@@ -5249,8 +5094,7 @@ var require_libfaust_wasm = __commonJS({
5249
5094
  function allocateUTF8(str) {
5250
5095
  var size = lengthBytesUTF8(str) + 1;
5251
5096
  var ret = _malloc(size);
5252
- if (ret)
5253
- stringToUTF8Array(str, HEAP8, ret, size);
5097
+ if (ret) stringToUTF8Array(str, HEAP8, ret, size);
5254
5098
  return ret;
5255
5099
  }
5256
5100
  function __tzset_js(timezone, daylight, tzname) {
@@ -5300,8 +5144,7 @@ var require_libfaust_wasm = __commonJS({
5300
5144
  }
5301
5145
  function runEmAsmFunction(code, sigPtr, argbuf) {
5302
5146
  var args = readEmAsmArgs(sigPtr, argbuf);
5303
- if (!ASM_CONSTS.hasOwnProperty(code))
5304
- abort("No EM_ASM constant found at address " + code);
5147
+ if (!ASM_CONSTS.hasOwnProperty(code)) abort("No EM_ASM constant found at address " + code);
5305
5148
  return ASM_CONSTS[code].apply(null, args);
5306
5149
  }
5307
5150
  function _emscripten_asm_const_int(code, sigPtr, argbuf) {
@@ -5357,10 +5200,8 @@ var require_libfaust_wasm = __commonJS({
5357
5200
  var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
5358
5201
  var env = { "USER": "web_user", "LOGNAME": "web_user", "PATH": "/", "PWD": "/", "HOME": "/home/web_user", "LANG": lang, "_": getExecutableName() };
5359
5202
  for (var x in ENV) {
5360
- if (ENV[x] === void 0)
5361
- delete env[x];
5362
- else
5363
- env[x] = ENV[x];
5203
+ if (ENV[x] === void 0) delete env[x];
5204
+ else env[x] = ENV[x];
5364
5205
  }
5365
5206
  var strings = [];
5366
5207
  for (var x in env) {
@@ -5375,8 +5216,7 @@ var require_libfaust_wasm = __commonJS({
5375
5216
  assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255));
5376
5217
  HEAP8[buffer++ >> 0] = str.charCodeAt(i);
5377
5218
  }
5378
- if (!dontAddNull)
5379
- HEAP8[buffer >> 0] = 0;
5219
+ if (!dontAddNull) HEAP8[buffer >> 0] = 0;
5380
5220
  }
5381
5221
  function _environ_get(__environ, environ_buf) {
5382
5222
  var bufSize = 0;
@@ -5404,8 +5244,7 @@ var require_libfaust_wasm = __commonJS({
5404
5244
  FS.close(stream);
5405
5245
  return 0;
5406
5246
  } catch (e) {
5407
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
5408
- throw e;
5247
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
5409
5248
  return e.errno;
5410
5249
  }
5411
5250
  }
@@ -5416,8 +5255,7 @@ var require_libfaust_wasm = __commonJS({
5416
5255
  HEAP8[pbuf >> 0] = type;
5417
5256
  return 0;
5418
5257
  } catch (e) {
5419
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
5420
- throw e;
5258
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
5421
5259
  return e.errno;
5422
5260
  }
5423
5261
  }
@@ -5428,11 +5266,9 @@ var require_libfaust_wasm = __commonJS({
5428
5266
  var len = HEAPU32[iov + 4 >> 2];
5429
5267
  iov += 8;
5430
5268
  var curr = FS.read(stream, HEAP8, ptr, len, offset);
5431
- if (curr < 0)
5432
- return -1;
5269
+ if (curr < 0) return -1;
5433
5270
  ret += curr;
5434
- if (curr < len)
5435
- break;
5271
+ if (curr < len) break;
5436
5272
  if (typeof offset !== "undefined") {
5437
5273
  offset += curr;
5438
5274
  }
@@ -5446,8 +5282,7 @@ var require_libfaust_wasm = __commonJS({
5446
5282
  HEAPU32[pnum >> 2] = num;
5447
5283
  return 0;
5448
5284
  } catch (e) {
5449
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
5450
- throw e;
5285
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
5451
5286
  return e.errno;
5452
5287
  }
5453
5288
  }
@@ -5459,17 +5294,14 @@ var require_libfaust_wasm = __commonJS({
5459
5294
  function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
5460
5295
  try {
5461
5296
  var offset = convertI32PairToI53Checked(offset_low, offset_high);
5462
- if (isNaN(offset))
5463
- return 61;
5297
+ if (isNaN(offset)) return 61;
5464
5298
  var stream = SYSCALLS.getStreamFromFD(fd);
5465
5299
  FS.llseek(stream, offset, whence);
5466
5300
  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];
5467
- if (stream.getdents && offset === 0 && whence === 0)
5468
- stream.getdents = null;
5301
+ if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
5469
5302
  return 0;
5470
5303
  } catch (e) {
5471
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
5472
- throw e;
5304
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
5473
5305
  return e.errno;
5474
5306
  }
5475
5307
  }
@@ -5480,8 +5312,7 @@ var require_libfaust_wasm = __commonJS({
5480
5312
  var len = HEAPU32[iov + 4 >> 2];
5481
5313
  iov += 8;
5482
5314
  var curr = FS.write(stream, HEAP8, ptr, len, offset);
5483
- if (curr < 0)
5484
- return -1;
5315
+ if (curr < 0) return -1;
5485
5316
  ret += curr;
5486
5317
  if (typeof offset !== "undefined") {
5487
5318
  offset += curr;
@@ -5496,8 +5327,7 @@ var require_libfaust_wasm = __commonJS({
5496
5327
  HEAPU32[pnum >> 2] = num;
5497
5328
  return 0;
5498
5329
  } catch (e) {
5499
- if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError))
5500
- throw e;
5330
+ if (typeof FS == "undefined" || !(e instanceof FS.ErrnoError)) throw e;
5501
5331
  return e.errno;
5502
5332
  }
5503
5333
  }
@@ -5643,10 +5473,8 @@ var require_libfaust_wasm = __commonJS({
5643
5473
  return leadingNulls(date2.tm_hour, 2);
5644
5474
  }, "%I": function(date2) {
5645
5475
  var twelveHour = date2.tm_hour;
5646
- if (twelveHour == 0)
5647
- twelveHour = 12;
5648
- else if (twelveHour > 12)
5649
- twelveHour -= 12;
5476
+ if (twelveHour == 0) twelveHour = 12;
5477
+ else if (twelveHour > 12) twelveHour -= 12;
5650
5478
  return leadingNulls(twelveHour, 2);
5651
5479
  }, "%j": function(date2) {
5652
5480
  return leadingNulls(date2.tm_mday + __arraySum(__isLeapYear(date2.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date2.tm_mon - 1), 3);
@@ -5683,8 +5511,7 @@ var require_libfaust_wasm = __commonJS({
5683
5511
  }
5684
5512
  } else if (val == 53) {
5685
5513
  var jan1 = (date2.tm_wday + 371 - date2.tm_yday) % 7;
5686
- if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year)))
5687
- val = 1;
5514
+ if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date2.tm_year))) val = 1;
5688
5515
  }
5689
5516
  return leadingNulls(val, 2);
5690
5517
  }, "%w": function(date2) {
@@ -5868,10 +5695,8 @@ var require_libfaust_wasm = __commonJS({
5868
5695
  unexportedSymbols.forEach(unexportedRuntimeSymbol);
5869
5696
  var calledRun;
5870
5697
  dependenciesFulfilled = function runCaller() {
5871
- if (!calledRun)
5872
- run();
5873
- if (!calledRun)
5874
- dependenciesFulfilled = runCaller;
5698
+ if (!calledRun) run();
5699
+ if (!calledRun) dependenciesFulfilled = runCaller;
5875
5700
  };
5876
5701
  function stackCheckInit() {
5877
5702
  _emscripten_stack_init();
@@ -5887,16 +5712,13 @@ var require_libfaust_wasm = __commonJS({
5887
5712
  return;
5888
5713
  }
5889
5714
  function doRun() {
5890
- if (calledRun)
5891
- return;
5715
+ if (calledRun) return;
5892
5716
  calledRun = true;
5893
5717
  Module["calledRun"] = true;
5894
- if (ABORT)
5895
- return;
5718
+ if (ABORT) return;
5896
5719
  initRuntime();
5897
5720
  readyPromiseResolve(Module);
5898
- if (Module["onRuntimeInitialized"])
5899
- Module["onRuntimeInitialized"]();
5721
+ if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
5900
5722
  assert(!Module["_main"], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
5901
5723
  postRun();
5902
5724
  }
@@ -5914,15 +5736,14 @@ var require_libfaust_wasm = __commonJS({
5914
5736
  checkStackCookie();
5915
5737
  }
5916
5738
  if (Module["preInit"]) {
5917
- if (typeof Module["preInit"] == "function")
5918
- Module["preInit"] = [Module["preInit"]];
5739
+ if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
5919
5740
  while (Module["preInit"].length > 0) {
5920
5741
  Module["preInit"].pop()();
5921
5742
  }
5922
5743
  }
5923
5744
  run();
5924
5745
  return FaustModule2.ready;
5925
- };
5746
+ });
5926
5747
  })();
5927
5748
  if (typeof exports === "object" && typeof module === "object")
5928
5749
  module.exports = FaustModule;
@@ -6023,8 +5844,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6023
5844
  const faustModule = await FaustModule({
6024
5845
  wasmBinary,
6025
5846
  getPreloadedPackage: (remotePackageName, remotePackageSize) => {
6026
- if (remotePackageName === "libfaust-wasm.data")
6027
- return dataBinary;
5847
+ if (remotePackageName === "libfaust-wasm.data") return dataBinary;
6028
5848
  return new ArrayBuffer(0);
6029
5849
  }
6030
5850
  });
@@ -6050,8 +5870,7 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6050
5870
  const analysePolyParameters = (item) => {
6051
5871
  const polyKeywords = ["/gate", "/freq", "/gain", "/key", "/vel", "/velocity"];
6052
5872
  const isPolyReserved = "address" in item && !!polyKeywords.find((k) => item.address.endsWith(k));
6053
- if (poly && isPolyReserved)
6054
- return null;
5873
+ if (poly && isPolyReserved) return null;
6055
5874
  if (item.type === "vslider" || item.type === "hslider" || item.type === "nentry") {
6056
5875
  return { name: item.address, defaultValue: item.init || 0, minValue: item.min || 0, maxValue: item.max || 0 };
6057
5876
  } else if (item.type === "button" || item.type === "checkbox") {
@@ -6069,37 +5888,30 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6069
5888
  this.paramValuesCache[pd.name] = pd.defaultValue || 0;
6070
5889
  });
6071
5890
  const { moduleId, instanceId } = options.processorOptions;
6072
- if (!moduleId || !instanceId)
6073
- return;
5891
+ if (!moduleId || !instanceId) return;
6074
5892
  this.wamInfo = { moduleId, instanceId };
6075
5893
  }
6076
5894
  static get parameterDescriptors() {
6077
5895
  const params = [];
6078
5896
  const callback = (item) => {
6079
5897
  const param = analysePolyParameters(item);
6080
- if (param)
6081
- params.push(param);
5898
+ if (param) params.push(param);
6082
5899
  };
6083
5900
  FaustBaseWebAudioDsp2.parseUI(dspMeta.ui, callback);
6084
- if (effectMeta)
6085
- FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
5901
+ if (effectMeta) FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
6086
5902
  return params;
6087
5903
  }
6088
5904
  setupWamEventHandler() {
6089
5905
  var _a;
6090
- if (!this.wamInfo)
6091
- return;
5906
+ if (!this.wamInfo) return;
6092
5907
  const { moduleId, instanceId } = this.wamInfo;
6093
5908
  const { webAudioModules } = globalThis;
6094
5909
  const ModuleScope = webAudioModules.getModuleScope(moduleId);
6095
5910
  const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
6096
- if (!paramMgrProcessor)
6097
- return;
6098
- if (paramMgrProcessor.handleEvent)
6099
- return;
5911
+ if (!paramMgrProcessor) return;
5912
+ if (paramMgrProcessor.handleEvent) return;
6100
5913
  paramMgrProcessor.handleEvent = (event) => {
6101
- if (event.type === "wam-midi")
6102
- this.midiMessage(event.data.bytes);
5914
+ if (event.type === "wam-midi") this.midiMessage(event.data.bytes);
6103
5915
  };
6104
5916
  }
6105
5917
  process(inputs, outputs, parameters) {
@@ -6129,10 +5941,12 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6129
5941
  handleMessageAux(e) {
6130
5942
  const msg = e.data;
6131
5943
  switch (msg.type) {
5944
+ // Generic MIDI message
6132
5945
  case "midi": {
6133
5946
  this.midiMessage(msg.data);
6134
5947
  break;
6135
5948
  }
5949
+ // Typed MIDI message
6136
5950
  case "ctrlChange": {
6137
5951
  this.ctrlChange(msg.data[0], msg.data[1], msg.data[2]);
6138
5952
  break;
@@ -6149,10 +5963,12 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6149
5963
  this.keyOff(msg.data[0], msg.data[1], msg.data[2]);
6150
5964
  break;
6151
5965
  }
5966
+ // Generic data message
6152
5967
  case "param": {
6153
5968
  this.setParamValue(msg.data.path, msg.data.value);
6154
5969
  break;
6155
5970
  }
5971
+ // Plot handler set on demand
6156
5972
  case "setPlotHandler": {
6157
5973
  if (msg.data) {
6158
5974
  this.fDSPCode.setPlotHandler((output, index, events) => this.port.postMessage({ type: "plot", value: output, index, events }));
@@ -6256,12 +6072,9 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
6256
6072
  const channel = data[0] & 15;
6257
6073
  const data1 = data[1];
6258
6074
  const data2 = data[2];
6259
- if (cmd === 8 || cmd === 9 && data2 === 0)
6260
- this.keyOff(channel, data1, data2);
6261
- else if (cmd === 9)
6262
- this.keyOn(channel, data1, data2);
6263
- else
6264
- super.midiMessage(data);
6075
+ if (cmd === 8 || cmd === 9 && data2 === 0) this.keyOff(channel, data1, data2);
6076
+ else if (cmd === 9) this.keyOn(channel, data1, data2);
6077
+ else super.midiMessage(data);
6265
6078
  }
6266
6079
  // Public API
6267
6080
  keyOn(channel, pitch, velocity) {
@@ -6327,10 +6140,8 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6327
6140
  while (spilled < spillLength) {
6328
6141
  const $spillLength = Math.min(spillLength - spilled, toLength - $to, fromLength - $from);
6329
6142
  const $fromEnd = $from + $spillLength;
6330
- if ($from === 0 && $fromEnd === fromLength)
6331
- to.set(from, $to);
6332
- else
6333
- to.set(from.subarray($from, $fromEnd), $to);
6143
+ if ($from === 0 && $fromEnd === fromLength) to.set(from, $to);
6144
+ else to.set(from.subarray($from, $fromEnd), $to);
6334
6145
  $to = ($to + $spillLength) % toLength;
6335
6146
  $from = $fromEnd % fromLength;
6336
6147
  spilled += $spillLength;
@@ -6339,8 +6150,7 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6339
6150
  };
6340
6151
  const analyseParameters = (item) => {
6341
6152
  const isFFTReserved = "address" in item && !!fftParamKeywords.find((k) => item.address.endsWith(k));
6342
- if (isFFTReserved)
6343
- return null;
6153
+ if (isFFTReserved) return null;
6344
6154
  if (item.type === "vslider" || item.type === "hslider" || item.type === "nentry") {
6345
6155
  return { name: item.address, defaultValue: item.init || 0, minValue: item.min || 0, maxValue: item.max || 0 };
6346
6156
  } else if (item.type === "button" || item.type === "checkbox") {
@@ -6381,23 +6191,26 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6381
6191
  var _a, _b, _c;
6382
6192
  const msg = e.data;
6383
6193
  switch (msg.type) {
6194
+ // Generic MIDI message
6384
6195
  case "midi":
6385
6196
  this.midiMessage(msg.data);
6386
6197
  break;
6198
+ // Typed MIDI message
6387
6199
  case "ctrlChange":
6388
6200
  this.ctrlChange(msg.data[0], msg.data[1], msg.data[2]);
6389
6201
  break;
6390
6202
  case "pitchWheel":
6391
6203
  this.pitchWheel(msg.data[0], msg.data[1]);
6392
6204
  break;
6205
+ // Generic data message
6393
6206
  case "param":
6394
6207
  this.setParamValue(msg.data.path, msg.data.value);
6395
6208
  break;
6209
+ // Plot handler set on demand
6396
6210
  case "setPlotHandler": {
6397
6211
  if (msg.data) {
6398
6212
  this.fPlotHandler = (output, index, events) => {
6399
- if (events)
6400
- this.fCachedEvents.push(...events);
6213
+ if (events) this.fCachedEvents.push(...events);
6401
6214
  };
6402
6215
  } else {
6403
6216
  this.fPlotHandler = null;
@@ -6439,8 +6252,7 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6439
6252
  this.soundfiles = factory.soundfiles;
6440
6253
  this.initFFT();
6441
6254
  const { moduleId, instanceId } = options.processorOptions;
6442
- if (!moduleId || !instanceId)
6443
- return;
6255
+ if (!moduleId || !instanceId) return;
6444
6256
  this.wamInfo = { moduleId, instanceId };
6445
6257
  }
6446
6258
  get fftProcessorBufferSize() {
@@ -6455,8 +6267,7 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6455
6267
  const params = [];
6456
6268
  const callback = (item) => {
6457
6269
  const param = analyseParameters(item);
6458
- if (param)
6459
- params.push(param);
6270
+ if (param) params.push(param);
6460
6271
  };
6461
6272
  FaustBaseWebAudioDsp2.parseUI(dspMeta.ui, callback);
6462
6273
  return [
@@ -6489,19 +6300,15 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6489
6300
  }
6490
6301
  setupWamEventHandler() {
6491
6302
  var _a;
6492
- if (!this.wamInfo)
6493
- return;
6303
+ if (!this.wamInfo) return;
6494
6304
  const { moduleId, instanceId } = this.wamInfo;
6495
6305
  const { webAudioModules } = globalThis;
6496
6306
  const ModuleScope = webAudioModules.getModuleScope(moduleId);
6497
6307
  const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
6498
- if (!paramMgrProcessor)
6499
- return;
6500
- if (paramMgrProcessor.handleEvent)
6501
- return;
6308
+ if (!paramMgrProcessor) return;
6309
+ if (paramMgrProcessor.handleEvent) return;
6502
6310
  paramMgrProcessor.handleEvent = (event) => {
6503
- if (event.type === "wam-midi")
6504
- this.midiMessage(event.data.bytes);
6311
+ if (event.type === "wam-midi") this.midiMessage(event.data.bytes);
6505
6312
  };
6506
6313
  }
6507
6314
  processFFT() {
@@ -6519,10 +6326,8 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6519
6326
  fftToSignal(ffted, inputs[i * 3], inputs[i * 3 + 1], inputs[i * 3 + 2]);
6520
6327
  }
6521
6328
  for (let i = this.fftInput.length * 3; i < inputs.length; i++) {
6522
- if (i % 3 === 2)
6523
- inputs[i].forEach((v, j) => inputs[i][j] = j);
6524
- else
6525
- inputs[i].fill(0);
6329
+ if (i % 3 === 2) inputs[i].forEach((v, j) => inputs[i][j] = j);
6330
+ else inputs[i].fill(0);
6526
6331
  }
6527
6332
  }, (outputs) => {
6528
6333
  fftProcessorOutputs = outputs;
@@ -6547,14 +6352,12 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6547
6352
  for (let j = 0; j < iffted.length - this.fftHopSize; j++) {
6548
6353
  $ = mod(this.$outputWrite + j, this.fftBufferSize);
6549
6354
  this.fftOutput[i][$] += iffted[j];
6550
- if (i === 0)
6551
- this.windowSumSquare[$] += this.noIFFT ? this.window[j] : this.window[j] ** 2;
6355
+ if (i === 0) this.windowSumSquare[$] += this.noIFFT ? this.window[j] : this.window[j] ** 2;
6552
6356
  }
6553
6357
  for (let j = iffted.length - this.fftHopSize; j < iffted.length; j++) {
6554
6358
  $ = mod(this.$outputWrite + j, this.fftBufferSize);
6555
6359
  this.fftOutput[i][$] = iffted[j];
6556
- if (i === 0)
6557
- this.windowSumSquare[$] = this.noIFFT ? this.window[j] : this.window[j] ** 2;
6360
+ if (i === 0) this.windowSumSquare[$] = this.noIFFT ? this.window[j] : this.window[j] ** 2;
6558
6361
  }
6559
6362
  }
6560
6363
  this.$outputWrite += this.fftHopSize;
@@ -6562,10 +6365,8 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6562
6365
  }
6563
6366
  }
6564
6367
  process(inputs, outputs, parameters) {
6565
- if (this.destroyed)
6566
- return false;
6567
- if (!this.FFT)
6568
- return true;
6368
+ if (this.destroyed) return false;
6369
+ if (!this.FFT) return true;
6569
6370
  const input = inputs[0];
6570
6371
  const output = outputs[0];
6571
6372
  const inputChannels = (input == null ? void 0 : input.length) || 0;
@@ -6573,11 +6374,9 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6573
6374
  const bufferSize = (input == null ? void 0 : input.length) ? Math.max(...input.map((c) => c.length)) || 128 : 128;
6574
6375
  this.noIFFT = !!parameters.noIFFT[0];
6575
6376
  this.resetFFT(~~parameters.fftSize[0], ~~parameters.fftOverlap[0], ~~parameters.windowFunction[0], inputChannels, outputChannels, bufferSize);
6576
- if (!this.fDSPCode)
6577
- return true;
6377
+ if (!this.fDSPCode) return true;
6578
6378
  for (const path in parameters) {
6579
- if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k)))
6580
- continue;
6379
+ if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k))) continue;
6581
6380
  const [paramValue] = parameters[path];
6582
6381
  if (paramValue !== this.paramValuesCache[path]) {
6583
6382
  this.setParamValue(path, paramValue);
@@ -6671,8 +6470,7 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6671
6470
  this.$outputWrite = 0;
6672
6471
  this.$outputRead = -latency;
6673
6472
  this.fftBufferSize = Math.max(fftSize * 2 - this.fftHopSize, bufferSize * 2);
6674
- if (!fftSizeChanged && this.fftHopSizeParam)
6675
- (_a = this.fDSPCode) == null ? void 0 : _a.setParamValue(this.fftHopSizeParam, this.fftHopSize);
6473
+ if (!fftSizeChanged && this.fftHopSizeParam) (_a = this.fDSPCode) == null ? void 0 : _a.setParamValue(this.fftHopSizeParam, this.fftHopSize);
6676
6474
  }
6677
6475
  if (fftSizeChanged) {
6678
6476
  (_b = this.rfft) == null ? void 0 : _b.dispose();
@@ -6684,8 +6482,7 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6684
6482
  this.windowFunction = windowFunction;
6685
6483
  this.window = new Float32Array(fftSize);
6686
6484
  this.window.fill(1);
6687
- if (windowFunction)
6688
- apply(this.window, windowFunction);
6485
+ if (windowFunction) apply(this.window, windowFunction);
6689
6486
  this.windowSumSquare = new Float32Array(this.fftBufferSize);
6690
6487
  }
6691
6488
  if (this.fftInput.length > inputChannels) {
@@ -6724,16 +6521,13 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
6724
6521
  const params = this.fDSPCode.getParams();
6725
6522
  this.fDSPCode.start();
6726
6523
  for (const path in this.paramValuesCache) {
6727
- if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k)))
6728
- continue;
6524
+ if (!!fftParamKeywords.find((k) => `/${path}`.endsWith(k))) continue;
6729
6525
  this.fDSPCode.setParamValue(path, this.paramValuesCache[path]);
6730
6526
  }
6731
6527
  const fftSizeParam = params.find((s) => s.endsWith("/fftSize"));
6732
- if (fftSizeParam)
6733
- this.fDSPCode.setParamValue(fftSizeParam, this.fftSize);
6528
+ if (fftSizeParam) this.fDSPCode.setParamValue(fftSizeParam, this.fftSize);
6734
6529
  this.fftHopSizeParam = params.find((s) => s.endsWith("/fftHopSize"));
6735
- if (this.fftHopSizeParam)
6736
- this.fDSPCode.setParamValue(this.fftHopSizeParam, this.fftHopSize);
6530
+ if (this.fftHopSizeParam) this.fDSPCode.setParamValue(this.fftHopSizeParam, this.fftHopSize);
6737
6531
  this.fftProcessorZeros = new Float32Array(this.fftProcessorBufferSize);
6738
6532
  }
6739
6533
  destroy() {
@@ -6786,8 +6580,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
6786
6580
  }
6787
6581
  function __generator(thisArg, body) {
6788
6582
  var _ = { label: 0, sent: function() {
6789
- if (t[0] & 1)
6790
- throw t[1];
6583
+ if (t[0] & 1) throw t[1];
6791
6584
  return t[1];
6792
6585
  }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
6793
6586
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
@@ -6799,64 +6592,58 @@ function __generator(thisArg, body) {
6799
6592
  };
6800
6593
  }
6801
6594
  function step(op) {
6802
- if (f)
6803
- throw new TypeError("Generator is already executing.");
6804
- while (g && (g = 0, op[0] && (_ = 0)), _)
6805
- try {
6806
- 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)
6807
- return t;
6808
- if (y = 0, t)
6809
- op = [op[0] & 2, t.value];
6810
- switch (op[0]) {
6811
- case 0:
6812
- case 1:
6595
+ if (f) throw new TypeError("Generator is already executing.");
6596
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
6597
+ 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;
6598
+ if (y = 0, t) op = [op[0] & 2, t.value];
6599
+ switch (op[0]) {
6600
+ case 0:
6601
+ case 1:
6602
+ t = op;
6603
+ break;
6604
+ case 4:
6605
+ _.label++;
6606
+ return { value: op[1], done: false };
6607
+ case 5:
6608
+ _.label++;
6609
+ y = op[1];
6610
+ op = [0];
6611
+ continue;
6612
+ case 7:
6613
+ op = _.ops.pop();
6614
+ _.trys.pop();
6615
+ continue;
6616
+ default:
6617
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
6618
+ _ = 0;
6619
+ continue;
6620
+ }
6621
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
6622
+ _.label = op[1];
6623
+ break;
6624
+ }
6625
+ if (op[0] === 6 && _.label < t[1]) {
6626
+ _.label = t[1];
6813
6627
  t = op;
6814
6628
  break;
6815
- case 4:
6816
- _.label++;
6817
- return { value: op[1], done: false };
6818
- case 5:
6819
- _.label++;
6820
- y = op[1];
6821
- op = [0];
6822
- continue;
6823
- case 7:
6824
- op = _.ops.pop();
6825
- _.trys.pop();
6826
- continue;
6827
- default:
6828
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
6829
- _ = 0;
6830
- continue;
6831
- }
6832
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
6833
- _.label = op[1];
6834
- break;
6835
- }
6836
- if (op[0] === 6 && _.label < t[1]) {
6837
- _.label = t[1];
6838
- t = op;
6839
- break;
6840
- }
6841
- if (t && _.label < t[2]) {
6842
- _.label = t[2];
6843
- _.ops.push(op);
6844
- break;
6845
- }
6846
- if (t[2])
6847
- _.ops.pop();
6848
- _.trys.pop();
6849
- continue;
6850
- }
6851
- op = body.call(thisArg, _);
6852
- } catch (e) {
6853
- op = [6, e];
6854
- y = 0;
6855
- } finally {
6856
- f = t = 0;
6629
+ }
6630
+ if (t && _.label < t[2]) {
6631
+ _.label = t[2];
6632
+ _.ops.push(op);
6633
+ break;
6634
+ }
6635
+ if (t[2]) _.ops.pop();
6636
+ _.trys.pop();
6637
+ continue;
6857
6638
  }
6858
- if (op[0] & 5)
6859
- throw op[1];
6639
+ op = body.call(thisArg, _);
6640
+ } catch (e) {
6641
+ op = [6, e];
6642
+ y = 0;
6643
+ } finally {
6644
+ f = t = 0;
6645
+ }
6646
+ if (op[0] & 5) throw op[1];
6860
6647
  return { value: op[0] ? op[1] : void 0, done: true };
6861
6648
  }
6862
6649
  }
@@ -6945,7 +6732,7 @@ var MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1;
6945
6732
  // node_modules/@aws-crypto/sha256-js/build/module/RawSha256.js
6946
6733
  var RawSha256 = (
6947
6734
  /** @class */
6948
- function() {
6735
+ (function() {
6949
6736
  function RawSha2562() {
6950
6737
  this.state = Int32Array.from(INIT);
6951
6738
  this.temp = new Int32Array(64);
@@ -7037,7 +6824,7 @@ var RawSha256 = (
7037
6824
  state[7] += state7;
7038
6825
  };
7039
6826
  return RawSha2562;
7040
- }()
6827
+ })()
7041
6828
  );
7042
6829
 
7043
6830
  // node_modules/@smithy/util-utf8/dist-es/fromUtf8.browser.js
@@ -7070,7 +6857,7 @@ function isEmptyData(data) {
7070
6857
  // node_modules/@aws-crypto/sha256-js/build/module/jsSha256.js
7071
6858
  var Sha256 = (
7072
6859
  /** @class */
7073
- function() {
6860
+ (function() {
7074
6861
  function Sha2562(secret) {
7075
6862
  this.secret = secret;
7076
6863
  this.hash = new RawSha256();
@@ -7124,7 +6911,7 @@ var Sha256 = (
7124
6911
  }
7125
6912
  };
7126
6913
  return Sha2562;
7127
- }()
6914
+ })()
7128
6915
  );
7129
6916
  function bufferFromSecret(secret) {
7130
6917
  var input = convertToBuffer(secret);
@@ -7272,8 +7059,7 @@ var _FaustCompiler = class _FaustCompiler {
7272
7059
  async getAsyncInternalMixerModule(isDouble = false) {
7273
7060
  const bufferKey = isDouble ? "mixer64Buffer" : "mixer32Buffer";
7274
7061
  const moduleKey = isDouble ? "mixer64Module" : "mixer32Module";
7275
- if (this[moduleKey])
7276
- return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
7062
+ if (this[moduleKey]) return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
7277
7063
  const path = isDouble ? "/usr/rsrc/mixer64.wasm" : "/usr/rsrc/mixer32.wasm";
7278
7064
  const mixerBuffer = this.fs().readFile(path, { encoding: "binary" });
7279
7065
  this[bufferKey] = mixerBuffer;
@@ -7284,8 +7070,7 @@ var _FaustCompiler = class _FaustCompiler {
7284
7070
  getSyncInternalMixerModule(isDouble = false) {
7285
7071
  const bufferKey = isDouble ? "mixer64Buffer" : "mixer32Buffer";
7286
7072
  const moduleKey = isDouble ? "mixer64Module" : "mixer32Module";
7287
- if (this[moduleKey])
7288
- return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
7073
+ if (this[moduleKey]) return { mixerBuffer: this[bufferKey], mixerModule: this[moduleKey] };
7289
7074
  const path = isDouble ? "/usr/rsrc/mixer64.wasm" : "/usr/rsrc/mixer32.wasm";
7290
7075
  const mixerBuffer = this.fs().readFile(path, { encoding: "binary" });
7291
7076
  this[bufferKey] = mixerBuffer;
@@ -7626,10 +7411,8 @@ var FaustSensors = class _FaustSensors {
7626
7411
  this.fHi = Math.max(x, y);
7627
7412
  }
7628
7413
  clip(x) {
7629
- if (x < this.fLo)
7630
- return this.fLo;
7631
- if (x > this.fHi)
7632
- return this.fHi;
7414
+ if (x < this.fLo) return this.fLo;
7415
+ if (x > this.fHi) return this.fHi;
7633
7416
  return x;
7634
7417
  }
7635
7418
  };
@@ -8038,8 +7821,7 @@ var Soundfile = class _Soundfile {
8038
7821
  console.log(`fSR: ${this.fSR}`);
8039
7822
  console.log(`fOffset: ${this.fOffset}`);
8040
7823
  const HEAP32 = this.fAllocator.getInt32Array();
8041
- if (mem)
8042
- console.log(`HEAP32: ${HEAP32}`);
7824
+ if (mem) console.log(`HEAP32: ${HEAP32}`);
8043
7825
  console.log(`HEAP32[this.fPtr >> 2]: ${HEAP32[this.fPtr >> 2]}`);
8044
7826
  console.log(`HEAP32[(this.fPtr + ptrSize) >> 2]: ${HEAP32[this.fPtr + this.fPtrSize >> 2]}`);
8045
7827
  console.log(`HEAP32[(this.fPtr + 2 * ptrSize) >> 2]: ${HEAP32[this.fPtr + 2 * this.fPtrSize >> 2]}`);
@@ -8093,8 +7875,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8093
7875
  this.fInputsItems.push(item.address);
8094
7876
  this.fPathTable[item.address] = item.index;
8095
7877
  this.fDescriptor.push(item);
8096
- if (!item.meta)
8097
- return;
7878
+ if (!item.meta) return;
8098
7879
  item.meta.forEach((meta) => {
8099
7880
  var _a, _b, _c, _d, _e, _f;
8100
7881
  const { midi, acc, gyr } = meta;
@@ -8190,19 +7971,13 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8190
7971
  propagateAcc(accelerationIncludingGravity, invert = false) {
8191
7972
  const { x, y, z } = accelerationIncludingGravity;
8192
7973
  if (invert) {
8193
- if (x !== null)
8194
- this.fAcc.x.forEach((handler) => handler(-x));
8195
- if (y !== null)
8196
- this.fAcc.y.forEach((handler) => handler(-y));
8197
- if (z !== null)
8198
- this.fAcc.z.forEach((handler) => handler(-z));
7974
+ if (x !== null) this.fAcc.x.forEach((handler) => handler(-x));
7975
+ if (y !== null) this.fAcc.y.forEach((handler) => handler(-y));
7976
+ if (z !== null) this.fAcc.z.forEach((handler) => handler(-z));
8199
7977
  } else {
8200
- if (x !== null)
8201
- this.fAcc.x.forEach((handler) => handler(x));
8202
- if (y !== null)
8203
- this.fAcc.y.forEach((handler) => handler(y));
8204
- if (z !== null)
8205
- this.fAcc.z.forEach((handler) => handler(z));
7978
+ if (x !== null) this.fAcc.x.forEach((handler) => handler(x));
7979
+ if (y !== null) this.fAcc.y.forEach((handler) => handler(y));
7980
+ if (z !== null) this.fAcc.z.forEach((handler) => handler(z));
8206
7981
  }
8207
7982
  }
8208
7983
  get hasGyrInput() {
@@ -8210,12 +7985,9 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8210
7985
  }
8211
7986
  propagateGyr(event) {
8212
7987
  const { alpha, beta, gamma } = event;
8213
- if (alpha !== null)
8214
- this.fGyr.x.forEach((handler) => handler(alpha));
8215
- if (beta !== null)
8216
- this.fGyr.y.forEach((handler) => handler(beta));
8217
- if (gamma !== null)
8218
- this.fGyr.z.forEach((handler) => handler(gamma));
7988
+ if (alpha !== null) this.fGyr.x.forEach((handler) => handler(alpha));
7989
+ if (beta !== null) this.fGyr.y.forEach((handler) => handler(beta));
7990
+ if (gamma !== null) this.fGyr.z.forEach((handler) => handler(gamma));
8219
7991
  }
8220
7992
  /** Build the accelerometer handler */
8221
7993
  setupAccHandler(path, axis, curve, amin, amid, amax, min, init, max) {
@@ -8270,8 +8042,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8270
8042
  console.log(`Soundfile ${name} paths: ${url}`);
8271
8043
  const soundfileIds = _FaustBaseWebAudioDsp.splitSoundfileNames(url);
8272
8044
  const item = this.fSoundfiles.find((item2) => item2.url === url);
8273
- if (!item)
8274
- throw new Error(`Soundfile with ${url} cannot be found !}`);
8045
+ if (!item) throw new Error(`Soundfile with ${url} cannot be found !}`);
8275
8046
  if (item.basePtr !== -1) {
8276
8047
  const HEAP32 = allocator.getInt32Array();
8277
8048
  console.log(`Soundfile CACHE ${url}} : ${name} loaded at ${item.basePtr} in wasm memory with index ${item.index}`);
@@ -8294,7 +8065,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8294
8065
  for (const soundfileId of soundfileIdList) {
8295
8066
  let chan = 0;
8296
8067
  let len = 0;
8297
- const audioData = soundfiles[soundfileId];
8068
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
8298
8069
  if (audioData) {
8299
8070
  chan = audioData.audioBuffer.length;
8300
8071
  len = audioData.audioBuffer[0].length;
@@ -8310,7 +8081,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8310
8081
  let offset = 0;
8311
8082
  for (let part = 0; part < soundfileIdList.length; part++) {
8312
8083
  const soundfileId = soundfileIdList[part];
8313
- const audioData = soundfiles[soundfileId];
8084
+ const audioData = soundfiles == null ? void 0 : soundfiles[soundfileId];
8314
8085
  if (audioData) {
8315
8086
  soundfile.copyToOut(part, maxChan, offset, audioData);
8316
8087
  offset += audioData.audioBuffer[0].length;
@@ -8386,16 +8157,13 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8386
8157
  return -1;
8387
8158
  }
8388
8159
  midiMessage(data) {
8389
- if (this.fPlotHandler)
8390
- this.fCachedEvents.push({ data, type: "midi" });
8160
+ if (this.fPlotHandler) this.fCachedEvents.push({ data, type: "midi" });
8391
8161
  const cmd = data[0] >> 4;
8392
8162
  const channel = data[0] & 15;
8393
8163
  const data1 = data[1];
8394
8164
  const data2 = data[2];
8395
- if (cmd === 11)
8396
- return this.ctrlChange(channel, data1, data2);
8397
- if (cmd === 14)
8398
- return this.pitchWheel(channel, data2 * 128 + data1);
8165
+ if (cmd === 11) return this.ctrlChange(channel, data1, data2);
8166
+ if (cmd === 14) return this.pitchWheel(channel, data2 * 128 + data1);
8399
8167
  if (cmd === 9) {
8400
8168
  if (data2 > 0)
8401
8169
  return this.keyOn(channel, data1, data2);
@@ -8407,68 +8175,58 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8407
8175
  }
8408
8176
  }
8409
8177
  ctrlChange(channel, ctrl, value) {
8410
- if (this.fPlotHandler)
8411
- this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
8178
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
8412
8179
  if (this.fCtrlLabel[ctrl].length) {
8413
8180
  this.fCtrlLabel[ctrl].forEach((ctrl2) => {
8414
8181
  const { path, chan } = ctrl2;
8415
8182
  if (chan === 0 || channel === chan - 1) {
8416
8183
  this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
8417
- if (this.fOutputHandler)
8418
- this.fOutputHandler(path, this.getParamValue(path));
8184
+ if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
8419
8185
  }
8420
8186
  });
8421
8187
  }
8422
8188
  }
8423
8189
  keyOn(channel, pitch, velocity) {
8424
- if (this.fPlotHandler)
8425
- this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
8190
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
8426
8191
  this.fMidiKeyOnLabel[pitch].forEach((key) => {
8427
8192
  const { path, chan } = key;
8428
8193
  if (chan === 0 || channel === chan - 1) {
8429
8194
  this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
8430
- if (this.fOutputHandler)
8431
- this.fOutputHandler(path, this.getParamValue(path));
8195
+ if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
8432
8196
  }
8433
8197
  });
8434
8198
  this.fMidiKeyLabel[pitch].forEach((key) => {
8435
8199
  const { path, chan } = key;
8436
8200
  if (chan === 0 || channel === chan - 1) {
8437
8201
  this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
8438
- if (this.fOutputHandler)
8439
- this.fOutputHandler(path, this.getParamValue(path));
8202
+ if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
8440
8203
  }
8441
8204
  });
8442
8205
  }
8443
8206
  keyOff(channel, pitch, velocity) {
8444
- if (this.fPlotHandler)
8445
- this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
8207
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
8446
8208
  this.fMidiKeyOffLabel[pitch].forEach((key) => {
8447
8209
  const { path, chan } = key;
8448
8210
  if (chan === 0 || channel === chan - 1) {
8449
8211
  this.setParamValue(path, _FaustBaseWebAudioDsp.remap(velocity, 0, 127, key.min, key.max));
8450
- if (this.fOutputHandler)
8451
- this.fOutputHandler(path, this.getParamValue(path));
8212
+ if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
8452
8213
  }
8453
8214
  });
8454
8215
  this.fMidiKeyLabel[pitch].forEach((key) => {
8455
8216
  const { path, chan } = key;
8456
8217
  if (chan === 0 || channel === chan - 1) {
8457
8218
  this.setParamValue(path, 0);
8458
- if (this.fOutputHandler)
8459
- this.fOutputHandler(path, this.getParamValue(path));
8219
+ if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
8460
8220
  }
8461
8221
  });
8462
8222
  }
8463
8223
  pitchWheel(channel, wheel) {
8464
- if (this.fPlotHandler)
8465
- this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
8224
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
8466
8225
  this.fPitchwheelLabel.forEach((pw) => {
8467
8226
  const { path, chan } = pw;
8468
8227
  if (chan === 0 || channel === chan - 1) {
8469
8228
  this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
8470
- if (this.fOutputHandler)
8471
- this.fOutputHandler(path, this.getParamValue(path));
8229
+ if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
8472
8230
  }
8473
8231
  });
8474
8232
  }
@@ -8569,10 +8327,8 @@ var FaustMonoWebAudioDsp = class extends FaustBaseWebAudioDsp {
8569
8327
  }
8570
8328
  // Public API
8571
8329
  compute(input, output) {
8572
- if (this.fDestroyed)
8573
- return false;
8574
- if (!this.fProcessing)
8575
- return true;
8330
+ if (this.fDestroyed) return false;
8331
+ if (!this.fProcessing) return true;
8576
8332
  if (this.fFirstCall) {
8577
8333
  this.initMemory();
8578
8334
  this.fFirstCall = false;
@@ -8593,8 +8349,7 @@ var FaustMonoWebAudioDsp = class extends FaustBaseWebAudioDsp {
8593
8349
  }
8594
8350
  }
8595
8351
  }
8596
- if (this.fComputeHandler)
8597
- this.fComputeHandler(this.fBufferSize);
8352
+ if (this.fComputeHandler) this.fComputeHandler(this.fBufferSize);
8598
8353
  this.fInstance.api.compute(this.fDSP, this.fBufferSize, this.fAudioInputs, this.fAudioOutputs);
8599
8354
  this.updateOutputs();
8600
8355
  let forPlot = this.fOutChannels;
@@ -8623,8 +8378,7 @@ var FaustMonoWebAudioDsp = class extends FaustBaseWebAudioDsp {
8623
8378
  return this.fInstance.api.getNumOutputs(this.fDSP);
8624
8379
  }
8625
8380
  setParamValue(path, value) {
8626
- if (this.fPlotHandler)
8627
- this.fCachedEvents.push({ type: "param", data: { path, value } });
8381
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "param", data: { path, value } });
8628
8382
  this.fInstance.api.setParamValue(this.fDSP, this.fPathTable[path], value);
8629
8383
  }
8630
8384
  getParamValue(path) {
@@ -8750,8 +8504,7 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8750
8504
  this.fJSONDsp = JSON.parse(this.fInstance.voiceJSON);
8751
8505
  this.fJSONEffect = this.fInstance.effectAPI && this.fInstance.effectJSON ? JSON.parse(this.fInstance.effectJSON) : null;
8752
8506
  FaustBaseWebAudioDsp.parseUI(this.fJSONDsp.ui, this.fUICallback);
8753
- if (this.fJSONEffect)
8754
- FaustBaseWebAudioDsp.parseUI(this.fJSONEffect.ui, this.fUICallback);
8507
+ if (this.fJSONEffect) FaustBaseWebAudioDsp.parseUI(this.fJSONEffect.ui, this.fUICallback);
8755
8508
  this.fEndMemory = this.initMemory();
8756
8509
  this.fVoiceTable = [];
8757
8510
  for (let voice = 0; voice < this.fInstance.voices; voice++) {
@@ -8763,8 +8516,7 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8763
8516
  sampleRate
8764
8517
  ));
8765
8518
  }
8766
- if (this.fInstance.effectAPI)
8767
- this.fInstance.effectAPI.init(this.fEffect, sampleRate);
8519
+ if (this.fInstance.effectAPI) this.fInstance.effectAPI.init(this.fEffect, sampleRate);
8768
8520
  if (this.fSoundfiles.length > 0) {
8769
8521
  const allocator = new WasmAllocator(this.fInstance.memory, this.fEndMemory);
8770
8522
  for (let voice = 0; voice < this.fInstance.voices; voice++) {
@@ -8870,14 +8622,12 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8870
8622
  }
8871
8623
  // Public API
8872
8624
  compute(input, output) {
8873
- if (this.fDestroyed)
8874
- return false;
8625
+ if (this.fDestroyed) return false;
8875
8626
  if (this.fFirstCall) {
8876
8627
  this.initMemory();
8877
8628
  this.fFirstCall = false;
8878
8629
  }
8879
- if (!this.fProcessing)
8880
- return true;
8630
+ if (!this.fProcessing) return true;
8881
8631
  if (this.getNumInputs() > 0 && (!input || !input[0] || input[0].length === 0)) {
8882
8632
  return true;
8883
8633
  }
@@ -8890,8 +8640,7 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8890
8640
  dspInput.set(input[chan]);
8891
8641
  }
8892
8642
  }
8893
- if (this.fComputeHandler)
8894
- this.fComputeHandler(this.fBufferSize);
8643
+ if (this.fComputeHandler) this.fComputeHandler(this.fBufferSize);
8895
8644
  this.fInstance.mixerAPI.clearOutput(this.fBufferSize, this.getNumOutputs(), this.fAudioOutputs);
8896
8645
  this.fVoiceTable.forEach((voice) => {
8897
8646
  if (voice.fCurNote === FaustWebAudioDspVoice.kLegatoVoice) {
@@ -8906,8 +8655,7 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8906
8655
  }
8907
8656
  }
8908
8657
  });
8909
- if (this.fInstance.effectAPI)
8910
- this.fInstance.effectAPI.compute(this.fEffect, this.fBufferSize, this.fAudioOutputs, this.fAudioOutputs);
8658
+ if (this.fInstance.effectAPI) this.fInstance.effectAPI.compute(this.fEffect, this.fBufferSize, this.fAudioOutputs, this.fAudioOutputs);
8911
8659
  this.updateOutputs();
8912
8660
  if (output !== void 0) {
8913
8661
  for (let chan = 0; chan < Math.min(this.getNumOutputs(), output.length); chan++) {
@@ -8934,15 +8682,13 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8934
8682
  return o.address === p;
8935
8683
  } else {
8936
8684
  for (const k in o) {
8937
- if (_FaustPolyWebAudioDsp.findPath(o[k], p))
8938
- return true;
8685
+ if (_FaustPolyWebAudioDsp.findPath(o[k], p)) return true;
8939
8686
  }
8940
8687
  return false;
8941
8688
  }
8942
8689
  }
8943
8690
  setParamValue(path, value) {
8944
- if (this.fPlotHandler)
8945
- this.fCachedEvents.push({ type: "param", data: { path, value } });
8691
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "param", data: { path, value } });
8946
8692
  if (this.fJSONEffect && _FaustPolyWebAudioDsp.findPath(this.fJSONEffect.ui, path) && this.fInstance.effectAPI) {
8947
8693
  this.fInstance.effectAPI.setParamValue(this.fEffect, this.fPathTable[path], value);
8948
8694
  } else {
@@ -8994,12 +8740,9 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
8994
8740
  const channel = data[0] & 15;
8995
8741
  const data1 = data[1];
8996
8742
  const data2 = data[2];
8997
- if (cmd === 8 || cmd === 9 && data2 === 0)
8998
- return this.keyOff(channel, data1, data2);
8999
- else if (cmd === 9)
9000
- return this.keyOn(channel, data1, data2);
9001
- else
9002
- super.midiMessage(data);
8743
+ if (cmd === 8 || cmd === 9 && data2 === 0) return this.keyOff(channel, data1, data2);
8744
+ else if (cmd === 9) return this.keyOn(channel, data1, data2);
8745
+ else super.midiMessage(data);
9003
8746
  }
9004
8747
  ctrlChange(channel, ctrl, value) {
9005
8748
  if (ctrl === 123 || ctrl === 120) {
@@ -9009,14 +8752,12 @@ var FaustPolyWebAudioDsp = class _FaustPolyWebAudioDsp extends FaustBaseWebAudio
9009
8752
  }
9010
8753
  }
9011
8754
  keyOn(channel, pitch, velocity) {
9012
- if (this.fPlotHandler)
9013
- this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
8755
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOn", data: [channel, pitch, velocity] });
9014
8756
  const voice = this.getFreeVoice();
9015
8757
  this.fVoiceTable[voice].keyOn(pitch, velocity, this.fVoiceTable[voice].fCurNote == FaustWebAudioDspVoice.kLegatoVoice);
9016
8758
  }
9017
8759
  keyOff(channel, pitch, velocity) {
9018
- if (this.fPlotHandler)
9019
- this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
8760
+ if (this.fPlotHandler) this.fCachedEvents.push({ type: "keyOff", data: [channel, pitch, velocity] });
9020
8761
  const voice = this.getPlayingVoice(pitch);
9021
8762
  if (voice !== FaustWebAudioDspVoice.kNoVoice) {
9022
8763
  this.fVoiceTable[voice].keyOff();
@@ -9052,8 +8793,7 @@ var FaustOfflineProcessor = class {
9052
8793
  param = { name: item.address, defaultValue: item.init || 0, minValue: 0, maxValue: 1 };
9053
8794
  }
9054
8795
  }
9055
- if (param)
9056
- params.push(param);
8796
+ if (param) params.push(param);
9057
8797
  };
9058
8798
  FaustBaseWebAudioDsp.parseUI(this.fDSPCode.getUI(), callback);
9059
8799
  return params;
@@ -9224,8 +8964,7 @@ var FaustSvgDiagrams = class {
9224
8964
  } catch {
9225
8965
  }
9226
8966
  const success = this.compiler.generateAuxFiles(name, code, `-lang wasm -o binary -svg ${args}`);
9227
- if (!success)
9228
- throw new Error(this.compiler.getErrorMessage());
8967
+ if (!success) throw new Error(this.compiler.getErrorMessage());
9229
8968
  const svgs = {};
9230
8969
  const files = fs.readdir(`/${name}-svg/`);
9231
8970
  files.filter((file) => file !== "." && file !== "..").forEach((file) => svgs[file] = fs.readFile(`/${name}-svg/${file}`, { encoding: "utf8" }));
@@ -9728,8 +9467,7 @@ var SoundfileReader = class {
9728
9467
  static async fetchSoundfile(url, audioCtx) {
9729
9468
  console.log(`Loading sound file from ${url}`);
9730
9469
  const response = await fetch(url);
9731
- if (!response.ok)
9732
- throw new Error(`Failed to load sound file from ${url}: ${response.statusText}`);
9470
+ if (!response.ok) throw new Error(`Failed to load sound file from ${url}: ${response.statusText}`);
9733
9471
  const arrayBuffer = await response.arrayBuffer();
9734
9472
  const audioBuffer = await audioCtx.decodeAudioData(arrayBuffer);
9735
9473
  return this.toAudioData(audioBuffer);
@@ -9743,13 +9481,11 @@ var SoundfileReader = class {
9743
9481
  * @param audioCtx : the audio context
9744
9482
  */
9745
9483
  static async loadSoundfile(filename, metaUrls, soundfiles, audioCtx) {
9746
- if (soundfiles[filename])
9747
- return;
9484
+ if (soundfiles == null ? void 0 : soundfiles[filename]) return;
9748
9485
  const urlsToCheck = [filename, ...[...metaUrls, ...this.fallbackPaths].map((path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href)];
9749
9486
  const checkResults = await Promise.all(urlsToCheck.map((url) => this.checkFileExists(url)));
9750
9487
  const successIndex = checkResults.findIndex((r) => !!r);
9751
- if (successIndex === -1)
9752
- throw new Error(`Failed to load sound file ${filename}, all check failed.`);
9488
+ if (successIndex === -1) throw new Error(`Failed to load sound file ${filename}, all check failed.`);
9753
9489
  soundfiles[filename] = await this.fetchSoundfile(urlsToCheck[successIndex], audioCtx);
9754
9490
  }
9755
9491
  /**
@@ -9764,7 +9500,7 @@ var SoundfileReader = class {
9764
9500
  const metaUrls = FaustBaseWebAudioDsp.extractUrlsFromMeta(dspMeta);
9765
9501
  const soundfiles = this.findSoundfilesFromMeta(dspMeta);
9766
9502
  for (const id in soundfiles) {
9767
- if (soundfilesIn[id]) {
9503
+ if (soundfilesIn == null ? void 0 : soundfilesIn[id]) {
9768
9504
  soundfiles[id] = soundfilesIn[id];
9769
9505
  continue;
9770
9506
  }
@@ -9802,8 +9538,7 @@ var FaustAudioWorkletCommunicator = class {
9802
9538
  ptr += 3 * Float32Array.BYTES_PER_ELEMENT;
9803
9539
  }
9804
9540
  setNewAccDataAvailable(value) {
9805
- if (!this.uin8NewAccData)
9806
- return;
9541
+ if (!this.uin8NewAccData) return;
9807
9542
  this.uin8NewAccData[0] = +value;
9808
9543
  }
9809
9544
  getNewAccDataAvailable() {
@@ -9811,8 +9546,7 @@ var FaustAudioWorkletCommunicator = class {
9811
9546
  return !!((_a = this.uin8NewAccData) == null ? void 0 : _a[0]);
9812
9547
  }
9813
9548
  setNewGyrDataAvailable(value) {
9814
- if (!this.uin8NewGyrData)
9815
- return;
9549
+ if (!this.uin8NewGyrData) return;
9816
9550
  this.uin8NewGyrData[0] = +value;
9817
9551
  }
9818
9552
  getNewGyrDataAvailable() {
@@ -9824,8 +9558,7 @@ var FaustAudioWorkletCommunicator = class {
9824
9558
  const e = { type: "acc", data: { x, y, z }, invert };
9825
9559
  this.port.postMessage(e);
9826
9560
  }
9827
- if (!this.uin8NewAccData)
9828
- return;
9561
+ if (!this.uin8NewAccData) return;
9829
9562
  this.uin8Invert[0] = +invert;
9830
9563
  this.f32Acc[0] = x;
9831
9564
  this.f32Acc[1] = y;
@@ -9833,8 +9566,7 @@ var FaustAudioWorkletCommunicator = class {
9833
9566
  this.uin8NewAccData[0] = 1;
9834
9567
  }
9835
9568
  getAcc() {
9836
- if (!this.uin8NewAccData)
9837
- return;
9569
+ if (!this.uin8NewAccData) return;
9838
9570
  const invert = !!this.uin8Invert[0];
9839
9571
  const [x, y, z] = this.f32Acc;
9840
9572
  return { x, y, z, invert };
@@ -9844,16 +9576,14 @@ var FaustAudioWorkletCommunicator = class {
9844
9576
  const e = { type: "gyr", data: { alpha, beta, gamma } };
9845
9577
  this.port.postMessage(e);
9846
9578
  }
9847
- if (!this.uin8NewGyrData)
9848
- return;
9579
+ if (!this.uin8NewGyrData) return;
9849
9580
  this.f32Gyr[0] = alpha;
9850
9581
  this.f32Gyr[1] = beta;
9851
9582
  this.f32Gyr[2] = gamma;
9852
9583
  this.uin8NewGyrData[0] = 1;
9853
9584
  }
9854
9585
  getGyr() {
9855
- if (!this.uin8NewGyrData)
9856
- return;
9586
+ if (!this.uin8NewGyrData) return;
9857
9587
  const [alpha, beta, gamma] = this.f32Gyr;
9858
9588
  return { alpha, beta, gamma };
9859
9589
  }
@@ -9887,6 +9617,7 @@ var FaustAudioWorkletProcessorCommunicator = class extends FaustAudioWorkletComm
9887
9617
  this.port.addEventListener("message", (event) => {
9888
9618
  const msg = event.data;
9889
9619
  switch (msg.type) {
9620
+ // Sensors messages
9890
9621
  case "acc": {
9891
9622
  this.setAcc(msg.data, msg.invert);
9892
9623
  break;
@@ -9930,8 +9661,7 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
9930
9661
  // Accelerometer and gyroscope handlers
9931
9662
  this.handleDeviceMotion = ({ accelerationIncludingGravity }) => {
9932
9663
  const isAndroid = /Android/i.test(navigator.userAgent);
9933
- if (!accelerationIncludingGravity)
9934
- return;
9664
+ if (!accelerationIncludingGravity) return;
9935
9665
  const { x, y, z } = accelerationIncludingGravity;
9936
9666
  this.propagateAcc({ x, y, z }, isAndroid);
9937
9667
  };
@@ -9949,14 +9679,11 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
9949
9679
  if (item.type === "vslider" || item.type === "hslider" || item.type === "button" || item.type === "checkbox" || item.type === "nentry") {
9950
9680
  this.fInputsItems.push(item.address);
9951
9681
  this.fDescriptor.push(item);
9952
- if (!item.meta)
9953
- return;
9682
+ if (!item.meta) return;
9954
9683
  item.meta.forEach((meta) => {
9955
9684
  const { midi, acc, gyr } = meta;
9956
- if (acc)
9957
- __privateSet(this, _hasAccInput, true);
9958
- if (gyr)
9959
- __privateSet(this, _hasGyrInput, true);
9685
+ if (acc) __privateSet(this, _hasAccInput, true);
9686
+ if (gyr) __privateSet(this, _hasGyrInput, true);
9960
9687
  });
9961
9688
  }
9962
9689
  };
@@ -10044,16 +9771,11 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
10044
9771
  const channel = data[0] & 15;
10045
9772
  const data1 = data[1];
10046
9773
  const data2 = data[2];
10047
- if (cmd === 11)
10048
- this.ctrlChange(channel, data1, data2);
10049
- else if (cmd === 14)
10050
- this.pitchWheel(channel, data2 * 128 + data1);
10051
- if (cmd === 8 || cmd === 9 && data2 === 0)
10052
- this.keyOff(channel, data1, data2);
10053
- else if (cmd === 9)
10054
- this.keyOn(channel, data1, data2);
10055
- else
10056
- this.port.postMessage({ type: "midi", data });
9774
+ if (cmd === 11) this.ctrlChange(channel, data1, data2);
9775
+ else if (cmd === 14) this.pitchWheel(channel, data2 * 128 + data1);
9776
+ if (cmd === 8 || cmd === 9 && data2 === 0) this.keyOff(channel, data1, data2);
9777
+ else if (cmd === 9) this.keyOn(channel, data1, data2);
9778
+ else this.port.postMessage({ type: "midi", data });
10057
9779
  }
10058
9780
  ctrlChange(channel, ctrl, value) {
10059
9781
  const e = { type: "ctrlChange", data: [channel, ctrl, value] };
@@ -10075,8 +9797,7 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
10075
9797
  return __privateGet(this, _hasAccInput);
10076
9798
  }
10077
9799
  propagateAcc(accelerationIncludingGravity, invert = false) {
10078
- if (!accelerationIncludingGravity)
10079
- return;
9800
+ if (!accelerationIncludingGravity) return;
10080
9801
  const { x, y, z } = accelerationIncludingGravity;
10081
9802
  this.fCommunicator.setAcc({ x, y, z }, invert);
10082
9803
  }
@@ -10084,8 +9805,7 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
10084
9805
  return __privateGet(this, _hasGyrInput);
10085
9806
  }
10086
9807
  propagateGyr(event) {
10087
- if (!event)
10088
- return;
9808
+ if (!event) return;
10089
9809
  const { alpha, beta, gamma } = event;
10090
9810
  this.fCommunicator.setGyr({ alpha, beta, gamma });
10091
9811
  }
@@ -10093,8 +9813,7 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
10093
9813
  const e = { type: "param", data: { path, value } };
10094
9814
  this.port.postMessage(e);
10095
9815
  const param = this.parameters.get(path);
10096
- if (param)
10097
- param.setValueAtTime(value, this.context.currentTime);
9816
+ if (param) param.setValueAtTime(value, this.context.currentTime);
10098
9817
  }
10099
9818
  getParamValue(path) {
10100
9819
  const param = this.parameters.get(path);
@@ -10210,8 +9929,7 @@ var FaustScriptProcessorNode = class extends (globalThis.ScriptProcessorNode ||
10210
9929
  this.fOutputs = new Array(this.fDSPCode.getNumOutputs());
10211
9930
  this.handleDeviceMotion = ({ accelerationIncludingGravity }) => {
10212
9931
  const isAndroid = /Android/i.test(navigator.userAgent);
10213
- if (!accelerationIncludingGravity)
10214
- return;
9932
+ if (!accelerationIncludingGravity) return;
10215
9933
  const { x, y, z } = accelerationIncludingGravity;
10216
9934
  this.propagateAcc({ x, y, z }, isAndroid);
10217
9935
  };
@@ -10375,23 +10093,21 @@ var _FaustMonoDspGenerator = class _FaustMonoDspGenerator {
10375
10093
  }
10376
10094
  }
10377
10095
  addSoundfiles(soundfileMap) {
10378
- if (!this.factory)
10379
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10096
+ if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10380
10097
  for (const id in soundfileMap) {
10381
10098
  this.factory.soundfiles[id] = soundfileMap[id];
10382
10099
  }
10383
10100
  }
10384
10101
  getSoundfileList() {
10385
- if (!this.factory)
10386
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10102
+ if (!this.factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10387
10103
  const meta = JSON.parse(this.factory.json);
10388
10104
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10105
+ if (!map) return [];
10389
10106
  return Object.keys(map);
10390
10107
  }
10391
10108
  async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
10392
10109
  var _a, _b;
10393
- if (!factory)
10394
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10110
+ if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10395
10111
  const meta = JSON.parse(factory.json);
10396
10112
  const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
10397
10113
  factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
@@ -10403,8 +10119,7 @@ var _FaustMonoDspGenerator = class _FaustMonoDspGenerator {
10403
10119
  sp2.init(monoDsp);
10404
10120
  return sp2;
10405
10121
  } else {
10406
- if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context))
10407
- _FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
10122
+ if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context)) _FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
10408
10123
  if (!((_a = _FaustMonoDspGenerator.gWorkletProcessors.get(context)) == null ? void 0 : _a.has(processorName))) {
10409
10124
  try {
10410
10125
  const processorCode = `
@@ -10457,13 +10172,11 @@ const dependencies = {
10457
10172
  }
10458
10173
  async createFFTNode(context, fftUtils, name = this.name, factory = this.factory, fftOptions = {}, processorName = (factory == null ? void 0 : factory.shaKey) ? `${factory.shaKey}_fft` : name, processorOptions = {}) {
10459
10174
  var _a, _b;
10460
- if (!factory)
10461
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10175
+ if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10462
10176
  const meta = JSON.parse(factory.json);
10463
10177
  const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
10464
10178
  factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
10465
- if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context))
10466
- _FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
10179
+ if (!_FaustMonoDspGenerator.gWorkletProcessors.has(context)) _FaustMonoDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
10467
10180
  if (!((_a = _FaustMonoDspGenerator.gWorkletProcessors.get(context)) == null ? void 0 : _a.has(processorName))) {
10468
10181
  try {
10469
10182
  const processorCode = `
@@ -10515,29 +10228,24 @@ const dependencies = {
10515
10228
  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 } });
10516
10229
  if (fftOptions.fftSize) {
10517
10230
  const param = node.parameters.get("fftSize");
10518
- if (param)
10519
- param.value = fftOptions.fftSize;
10231
+ if (param) param.value = fftOptions.fftSize;
10520
10232
  }
10521
10233
  if (fftOptions.fftOverlap) {
10522
10234
  const param = node.parameters.get("fftOverlap");
10523
- if (param)
10524
- param.value = fftOptions.fftOverlap;
10235
+ if (param) param.value = fftOptions.fftOverlap;
10525
10236
  }
10526
10237
  if (typeof fftOptions.defaultWindowFunction === "number") {
10527
10238
  const param = node.parameters.get("windowFunction");
10528
- if (param)
10529
- param.value = fftOptions.defaultWindowFunction + 1;
10239
+ if (param) param.value = fftOptions.defaultWindowFunction + 1;
10530
10240
  }
10531
10241
  if (typeof fftOptions.noIFFT === "boolean") {
10532
10242
  const param = node.parameters.get("noIFFT");
10533
- if (param)
10534
- param.value = +fftOptions.noIFFT;
10243
+ if (param) param.value = +fftOptions.noIFFT;
10535
10244
  }
10536
10245
  return node;
10537
10246
  }
10538
10247
  async createAudioWorkletProcessor(name = this.name, factory = this.factory, processorName = (factory == null ? void 0 : factory.shaKey) || name) {
10539
- if (!factory)
10540
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10248
+ if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10541
10249
  const meta = JSON.parse(factory.json);
10542
10250
  const dependencies = {
10543
10251
  FaustBaseWebAudioDsp,
@@ -10561,13 +10269,11 @@ const dependencies = {
10561
10269
  }
10562
10270
  }
10563
10271
  async createOfflineProcessor(sampleRate, bufferSize, factory = this.factory, context) {
10564
- if (!factory)
10565
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10272
+ if (!factory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10566
10273
  const meta = JSON.parse(factory.json);
10567
10274
  const instance = await FaustWasmInstantiator_default.createAsyncMonoDSPInstance(factory);
10568
10275
  const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
10569
- if (context)
10570
- factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
10276
+ if (context) factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
10571
10277
  const monoDsp = new FaustMonoWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, factory.soundfiles);
10572
10278
  return new FaustMonoOfflineProcessor(monoDsp, bufferSize);
10573
10279
  }
@@ -10658,33 +10364,29 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
10658
10364
  }
10659
10365
  }
10660
10366
  addSoundfiles(soundfileMap) {
10661
- if (!this.voiceFactory)
10662
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10367
+ if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10663
10368
  for (const id in soundfileMap) {
10664
10369
  this.voiceFactory.soundfiles[id] = soundfileMap[id];
10665
10370
  }
10666
10371
  }
10667
10372
  getSoundfileList() {
10668
- if (!this.voiceFactory)
10669
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10373
+ if (!this.voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10670
10374
  const meta = JSON.parse(this.voiceFactory.json);
10671
10375
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10672
- if (!this.effectFactory)
10673
- return Object.keys(map);
10376
+ if (!map) return [];
10377
+ if (!this.effectFactory) return Object.keys(map);
10674
10378
  const effectMeta = JSON.parse(this.effectFactory.json);
10675
10379
  const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);
10676
10380
  return Object.keys({ ...effectMap, ...map });
10677
10381
  }
10678
10382
  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 = {}) {
10679
10383
  var _a, _b;
10680
- if (!voiceFactory)
10681
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10384
+ if (!voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10682
10385
  const voiceMeta = JSON.parse(voiceFactory.json);
10683
10386
  const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
10684
10387
  const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
10685
10388
  voiceFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(voiceMeta, voiceFactory.soundfiles || {}, context);
10686
- if (effectFactory)
10687
- effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
10389
+ if (effectFactory) effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
10688
10390
  if (sp) {
10689
10391
  const instance = await FaustWasmInstantiator_default.createAsyncPolyDSPInstance(voiceFactory, mixerModule, voices, effectFactory || void 0);
10690
10392
  const soundfiles = { ...effectFactory == null ? void 0 : effectFactory.soundfiles, ...voiceFactory.soundfiles };
@@ -10694,8 +10396,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
10694
10396
  sp2.init(polyDsp);
10695
10397
  return sp2;
10696
10398
  } else {
10697
- if (!_FaustPolyDspGenerator.gWorkletProcessors.has(context))
10698
- _FaustPolyDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
10399
+ if (!_FaustPolyDspGenerator.gWorkletProcessors.has(context)) _FaustPolyDspGenerator.gWorkletProcessors.set(context, /* @__PURE__ */ new Set());
10699
10400
  if (!((_a = _FaustPolyDspGenerator.gWorkletProcessors.get(context)) == null ? void 0 : _a.has(processorName))) {
10700
10401
  try {
10701
10402
  const processorCode = `
@@ -10750,8 +10451,7 @@ const dependencies = {
10750
10451
  }
10751
10452
  }
10752
10453
  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`) {
10753
- if (!voiceFactory)
10754
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10454
+ if (!voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10755
10455
  const voiceMeta = JSON.parse(voiceFactory.json);
10756
10456
  const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
10757
10457
  const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
@@ -10778,16 +10478,14 @@ const dependencies = {
10778
10478
  }
10779
10479
  }
10780
10480
  async createOfflineProcessor(sampleRate, bufferSize, voices, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, context) {
10781
- if (!voiceFactory)
10782
- throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10481
+ if (!voiceFactory) throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
10783
10482
  const voiceMeta = JSON.parse(voiceFactory.json);
10784
10483
  const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
10785
10484
  const instance = await FaustWasmInstantiator_default.createAsyncPolyDSPInstance(voiceFactory, mixerModule, voices, effectFactory || void 0);
10786
10485
  const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
10787
10486
  if (context) {
10788
10487
  voiceFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(voiceMeta, voiceFactory.soundfiles || {}, context);
10789
- if (effectFactory)
10790
- effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
10488
+ if (effectFactory) effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
10791
10489
  }
10792
10490
  const soundfiles = { ...effectFactory == null ? void 0 : effectFactory.soundfiles, ...voiceFactory.soundfiles };
10793
10491
  const polyDsp = new FaustPolyWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, soundfiles);