@grame/faustwasm 0.1.0 → 0.1.1

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.
@@ -710,6 +710,7 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
710
710
  static parseItems(items: FaustUIItem[], callback: (item: FaustUIItem) => any): void;
711
711
  static parseItem(item: FaustUIItem, callback: (item: FaustUIItem) => any): void;
712
712
  static splitNames(input: string): string[];
713
+ private extractURLsFromJSON;
713
714
  /**
714
715
  * Load a soundfile possibly containing several parts.
715
716
  *
@@ -2306,9 +2306,20 @@ var FaustBaseWebAudioDsp = class {
2306
2306
  let trimmed = input.replace(/^\{|\}$/g, "");
2307
2307
  return trimmed.split(";").map((str) => str.length <= 2 ? "" : str.substring(1, str.length - 1));
2308
2308
  }
2309
+ extractURLsFromJSON() {
2310
+ const soundfilesEntry = this.fJSONDsp.meta.find((entry) => entry.soundfiles !== void 0);
2311
+ if (soundfilesEntry) {
2312
+ return soundfilesEntry.soundfiles.split(";").filter((url) => url !== "");
2313
+ } else {
2314
+ return [];
2315
+ }
2316
+ }
2309
2317
  async loadSoundfile(sfReader, sfOffset, name, url) {
2310
2318
  console.log(`Soundfile ${name} paths: ${url}`);
2311
2319
  const sfDirectories = ["", ".", "http://127.0.0.1:8000"];
2320
+ const sfReaderURLs = this.extractURLsFromJSON();
2321
+ console.log(`sfReaderURLs ${sfReaderURLs}`);
2322
+ sfDirectories.push(...sfReaderURLs);
2312
2323
  console.log(`sfDirectories ${sfDirectories}`);
2313
2324
  const sfPathNames = await sfReader.checkFiles(sfDirectories, FaustBaseWebAudioDsp.splitNames(url));
2314
2325
  console.log(`Soundfile ${name} paths: ${sfPathNames}`);