@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
  *
@@ -8332,9 +8332,20 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8332
8332
  let trimmed = input.replace(/^\{|\}$/g, "");
8333
8333
  return trimmed.split(";").map((str) => str.length <= 2 ? "" : str.substring(1, str.length - 1));
8334
8334
  }
8335
+ extractURLsFromJSON() {
8336
+ const soundfilesEntry = this.fJSONDsp.meta.find((entry) => entry.soundfiles !== void 0);
8337
+ if (soundfilesEntry) {
8338
+ return soundfilesEntry.soundfiles.split(";").filter((url) => url !== "");
8339
+ } else {
8340
+ return [];
8341
+ }
8342
+ }
8335
8343
  async loadSoundfile(sfReader, sfOffset, name, url) {
8336
8344
  console.log(`Soundfile ${name} paths: ${url}`);
8337
8345
  const sfDirectories = ["", ".", "http://127.0.0.1:8000"];
8346
+ const sfReaderURLs = this.extractURLsFromJSON();
8347
+ console.log(`sfReaderURLs ${sfReaderURLs}`);
8348
+ sfDirectories.push(...sfReaderURLs);
8338
8349
  console.log(`sfDirectories ${sfDirectories}`);
8339
8350
  const sfPathNames = await sfReader.checkFiles(sfDirectories, FaustBaseWebAudioDsp.splitNames(url));
8340
8351
  console.log(`Soundfile ${name} paths: ${sfPathNames}`);