@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.
- package/assets/standalone/faustwasm/index.d.ts +1 -0
- package/assets/standalone/faustwasm/index.js +11 -0
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +1 -0
- package/dist/cjs-bundle/index.js +11 -0
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +1 -0
- package/dist/esm-bundle/index.js +11 -0
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustWebAudioDsp.ts +16 -2
- package/test/faustlive-wasm/faustwasm/index.d.ts +1 -0
- package/test/faustlive-wasm/faustwasm/index.js +11 -0
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
package/package.json
CHANGED
package/src/FaustWebAudioDsp.ts
CHANGED
|
@@ -830,6 +830,18 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
830
830
|
// Split the string into an array of strings and remove first and last characters
|
|
831
831
|
return trimmed.split(";").map(str => str.length <= 2 ? '' : str.substring(1, str.length - 1));
|
|
832
832
|
}
|
|
833
|
+
|
|
834
|
+
private extractURLsFromJSON(): string[] {
|
|
835
|
+
// Find the entry with the "soundfiles" key
|
|
836
|
+
const soundfilesEntry = this.fJSONDsp.meta.find(entry => entry.soundfiles !== undefined);
|
|
837
|
+
// If the entry is found, split the string by semicolon to get the URLs
|
|
838
|
+
if (soundfilesEntry) {
|
|
839
|
+
return soundfilesEntry.soundfiles.split(';').filter(url => url !== '');
|
|
840
|
+
} else {
|
|
841
|
+
return [];
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
833
845
|
/**
|
|
834
846
|
* Load a soundfile possibly containing several parts.
|
|
835
847
|
*
|
|
@@ -842,9 +854,11 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
842
854
|
|
|
843
855
|
console.log(`Soundfile ${name} paths: ${url}`);
|
|
844
856
|
|
|
845
|
-
|
|
846
|
-
|
|
857
|
+
const sfReaderURLs = this.extractURLsFromJSON();
|
|
858
|
+
console.log(`sfReaderURLs ${sfReaderURLs}`);
|
|
847
859
|
|
|
860
|
+
const sfDirectories: string[] = ["", ".", "http://127.0.0.1:8000"];
|
|
861
|
+
sfDirectories.push(...sfReaderURLs);
|
|
848
862
|
console.log(`sfDirectories ${sfDirectories}`);
|
|
849
863
|
|
|
850
864
|
// Check if the soundfile exists in the given directories and return the real path
|
|
@@ -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}`);
|