@grame/faustwasm 0.15.6 → 0.15.7

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.
@@ -1385,13 +1385,6 @@ export declare class SoundfileReader {
1385
1385
  * @returns : the URLs
1386
1386
  */
1387
1387
  static findSoundfilesFromMeta(dspMeta: FaustDspMeta): LooseFaustDspFactory["soundfiles"];
1388
- /**
1389
- * Check if the file exists.
1390
- *
1391
- * @param url : the url of the file to check
1392
- * @returns : true if the file exists, otherwise false
1393
- */
1394
- private static checkFileExists;
1395
1388
  /**
1396
1389
  * Fetch the soundfile.
1397
1390
  *
@@ -8546,7 +8546,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8546
8546
  const trimmed = input.replace(/^\{|\}$/g, "");
8547
8547
  return trimmed.split(";").map(
8548
8548
  (str) => str.length <= 2 ? "" : str.substring(1, str.length - 1)
8549
- );
8549
+ ).map((str) => str.trim()).filter((str) => str.length > 0);
8550
8550
  }
8551
8551
  get hasAccInput() {
8552
8552
  return this.fAcc.x.length + this.fAcc.y.length + this.fAcc.z.length > 0;
@@ -9807,7 +9807,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9807
9807
  outputs[i].set(output, l);
9808
9808
  }
9809
9809
  }
9810
- l += this.fBufferSize;
9810
+ l += sliceLength;
9811
9811
  onUpdate == null ? void 0 : onUpdate(l);
9812
9812
  }
9813
9813
  this.fDSPCode.stop();
@@ -10356,29 +10356,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
10356
10356
  const callback = (item) => {
10357
10357
  if (item.type === "soundfile") {
10358
10358
  const urls = FaustBaseWebAudioDsp.splitSoundfileNames(item.url);
10359
- urls.forEach((url) => soundfiles[url] = null);
10359
+ urls.filter((url) => url.trim().length > 0).forEach((url) => soundfiles[url] = null);
10360
10360
  }
10361
10361
  };
10362
10362
  FaustBaseWebAudioDsp.parseUI(dspMeta.ui, callback);
10363
10363
  return soundfiles;
10364
10364
  }
10365
- /**
10366
- * Check if the file exists.
10367
- *
10368
- * @param url : the url of the file to check
10369
- * @returns : true if the file exists, otherwise false
10370
- */
10371
- static async checkFileExists(url) {
10372
- try {
10373
- console.log(`"checkFileExists" url: ${url}`);
10374
- const response = await fetch(url);
10375
- console.log(`"checkFileExists" response.ok: ${response.ok}`);
10376
- return response.ok;
10377
- } catch (error) {
10378
- console.error("Fetch error:", error);
10379
- return false;
10380
- }
10381
- }
10382
10365
  /**
10383
10366
  * Fetch the soundfile.
10384
10367
  *
@@ -10413,17 +10396,20 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
10413
10396
  (path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href
10414
10397
  )
10415
10398
  ];
10416
- const checkResults = await Promise.all(
10417
- urlsToCheck.map((url) => this.checkFileExists(url))
10418
- );
10419
- const successIndex = checkResults.findIndex((r) => !!r);
10420
- if (successIndex === -1)
10421
- throw new Error(
10422
- `Failed to load sound file ${filename}, all check failed.`
10423
- );
10424
- soundfiles[filename] = await this.fetchSoundfile(
10425
- urlsToCheck[successIndex],
10426
- audioCtx
10399
+ let lastError = null;
10400
+ for (const url of urlsToCheck) {
10401
+ try {
10402
+ soundfiles[filename] = await this.fetchSoundfile(
10403
+ url,
10404
+ audioCtx
10405
+ );
10406
+ return;
10407
+ } catch (error) {
10408
+ lastError = error;
10409
+ }
10410
+ }
10411
+ throw new Error(
10412
+ `Failed to load sound file ${filename}, all check failed. Last error: ${String(lastError)}`
10427
10413
  );
10428
10414
  }
10429
10415
  /**