@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.
@@ -717,6 +717,7 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
717
717
  static parseItems(items: FaustUIItem[], callback: (item: FaustUIItem) => any): void;
718
718
  static parseItem(item: FaustUIItem, callback: (item: FaustUIItem) => any): void;
719
719
  static splitNames(input: string): string[];
720
+ private extractURLsFromJSON;
720
721
  /**
721
722
  * Load a soundfile possibly containing several parts.
722
723
  *
@@ -8294,9 +8294,20 @@ var FaustBaseWebAudioDsp = class {
8294
8294
  let trimmed = input.replace(/^\{|\}$/g, "");
8295
8295
  return trimmed.split(";").map((str) => str.length <= 2 ? "" : str.substring(1, str.length - 1));
8296
8296
  }
8297
+ extractURLsFromJSON() {
8298
+ const soundfilesEntry = this.fJSONDsp.meta.find((entry) => entry.soundfiles !== void 0);
8299
+ if (soundfilesEntry) {
8300
+ return soundfilesEntry.soundfiles.split(";").filter((url) => url !== "");
8301
+ } else {
8302
+ return [];
8303
+ }
8304
+ }
8297
8305
  async loadSoundfile(sfReader, sfOffset, name, url) {
8298
8306
  console.log(`Soundfile ${name} paths: ${url}`);
8299
8307
  const sfDirectories = ["", ".", "http://127.0.0.1:8000"];
8308
+ const sfReaderURLs = this.extractURLsFromJSON();
8309
+ console.log(`sfReaderURLs ${sfReaderURLs}`);
8310
+ sfDirectories.push(...sfReaderURLs);
8300
8311
  console.log(`sfDirectories ${sfDirectories}`);
8301
8312
  const sfPathNames = await sfReader.checkFiles(sfDirectories, FaustBaseWebAudioDsp.splitNames(url));
8302
8313
  console.log(`Soundfile ${name} paths: ${sfPathNames}`);