@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
  *
@@ -8500,7 +8500,7 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8500
8500
  const trimmed = input.replace(/^\{|\}$/g, "");
8501
8501
  return trimmed.split(";").map(
8502
8502
  (str) => str.length <= 2 ? "" : str.substring(1, str.length - 1)
8503
- );
8503
+ ).map((str) => str.trim()).filter((str) => str.length > 0);
8504
8504
  }
8505
8505
  get hasAccInput() {
8506
8506
  return this.fAcc.x.length + this.fAcc.y.length + this.fAcc.z.length > 0;
@@ -9761,7 +9761,7 @@ var FaustOfflineProcessor = class {
9761
9761
  outputs[i].set(output, l);
9762
9762
  }
9763
9763
  }
9764
- l += this.fBufferSize;
9764
+ l += sliceLength;
9765
9765
  onUpdate == null ? void 0 : onUpdate(l);
9766
9766
  }
9767
9767
  this.fDSPCode.stop();
@@ -10310,29 +10310,12 @@ var SoundfileReader = class {
10310
10310
  const callback = (item) => {
10311
10311
  if (item.type === "soundfile") {
10312
10312
  const urls = FaustBaseWebAudioDsp.splitSoundfileNames(item.url);
10313
- urls.forEach((url) => soundfiles[url] = null);
10313
+ urls.filter((url) => url.trim().length > 0).forEach((url) => soundfiles[url] = null);
10314
10314
  }
10315
10315
  };
10316
10316
  FaustBaseWebAudioDsp.parseUI(dspMeta.ui, callback);
10317
10317
  return soundfiles;
10318
10318
  }
10319
- /**
10320
- * Check if the file exists.
10321
- *
10322
- * @param url : the url of the file to check
10323
- * @returns : true if the file exists, otherwise false
10324
- */
10325
- static async checkFileExists(url) {
10326
- try {
10327
- console.log(`"checkFileExists" url: ${url}`);
10328
- const response = await fetch(url);
10329
- console.log(`"checkFileExists" response.ok: ${response.ok}`);
10330
- return response.ok;
10331
- } catch (error) {
10332
- console.error("Fetch error:", error);
10333
- return false;
10334
- }
10335
- }
10336
10319
  /**
10337
10320
  * Fetch the soundfile.
10338
10321
  *
@@ -10367,17 +10350,20 @@ var SoundfileReader = class {
10367
10350
  (path) => new URL(filename, path.endsWith("/") ? path : `${path}/`).href
10368
10351
  )
10369
10352
  ];
10370
- const checkResults = await Promise.all(
10371
- urlsToCheck.map((url) => this.checkFileExists(url))
10372
- );
10373
- const successIndex = checkResults.findIndex((r) => !!r);
10374
- if (successIndex === -1)
10375
- throw new Error(
10376
- `Failed to load sound file ${filename}, all check failed.`
10377
- );
10378
- soundfiles[filename] = await this.fetchSoundfile(
10379
- urlsToCheck[successIndex],
10380
- audioCtx
10353
+ let lastError = null;
10354
+ for (const url of urlsToCheck) {
10355
+ try {
10356
+ soundfiles[filename] = await this.fetchSoundfile(
10357
+ url,
10358
+ audioCtx
10359
+ );
10360
+ return;
10361
+ } catch (error) {
10362
+ lastError = error;
10363
+ }
10364
+ }
10365
+ throw new Error(
10366
+ `Failed to load sound file ${filename}, all check failed. Last error: ${String(lastError)}`
10381
10367
  );
10382
10368
  }
10383
10369
  /**