@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
  *
package/dist/cjs/index.js CHANGED
@@ -2314,9 +2314,20 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2314
2314
  let trimmed = input.replace(/^\{|\}$/g, "");
2315
2315
  return trimmed.split(";").map((str) => str.length <= 2 ? "" : str.substring(1, str.length - 1));
2316
2316
  }
2317
+ extractURLsFromJSON() {
2318
+ const soundfilesEntry = this.fJSONDsp.meta.find((entry) => entry.soundfiles !== void 0);
2319
+ if (soundfilesEntry) {
2320
+ return soundfilesEntry.soundfiles.split(";").filter((url) => url !== "");
2321
+ } else {
2322
+ return [];
2323
+ }
2324
+ }
2317
2325
  async loadSoundfile(sfReader, sfOffset, name, url) {
2318
2326
  console.log(`Soundfile ${name} paths: ${url}`);
2319
2327
  const sfDirectories = ["", ".", "http://127.0.0.1:8000"];
2328
+ const sfReaderURLs = this.extractURLsFromJSON();
2329
+ console.log(`sfReaderURLs ${sfReaderURLs}`);
2330
+ sfDirectories.push(...sfReaderURLs);
2320
2331
  console.log(`sfDirectories ${sfDirectories}`);
2321
2332
  const sfPathNames = await sfReader.checkFiles(sfDirectories, FaustBaseWebAudioDsp.splitNames(url));
2322
2333
  console.log(`Soundfile ${name} paths: ${sfPathNames}`);