@grame/faustwasm 0.1.1 → 0.1.2
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 +9 -4
- package/assets/standalone/faustwasm/index.js +8 -11
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +9 -4
- package/dist/cjs/index.js +8 -11
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +9 -4
- package/dist/cjs-bundle/index.js +8 -11
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +9 -4
- package/dist/esm/index.js +8 -11
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +9 -4
- package/dist/esm-bundle/index.js +8 -11
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustWebAudioDsp.ts +21 -17
- package/test/faustlive-wasm/faustwasm/index.d.ts +9 -4
- package/test/faustlive-wasm/faustwasm/index.js +8 -11
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -668,6 +668,7 @@ export interface IFaustPolyWebAudioNode extends IFaustPolyWebAudioDsp, AudioNode
|
|
|
668
668
|
export type SoundfileItem = {
|
|
669
669
|
name: string;
|
|
670
670
|
url: string;
|
|
671
|
+
index: number;
|
|
671
672
|
basePtr: number;
|
|
672
673
|
};
|
|
673
674
|
export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
@@ -719,10 +720,13 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
719
720
|
static splitNames(input: string): string[];
|
|
720
721
|
private extractURLsFromJSON;
|
|
721
722
|
/**
|
|
722
|
-
*
|
|
723
|
+
* Load a soundfile possibly containing several parts in the DSP struct.
|
|
724
|
+
* Soundfile pointers are located at 'index' offset, to be read in the JSON file.
|
|
725
|
+
* The DSP struct is located at baseDSP in the wasm memory,
|
|
726
|
+
* either a monophonic DSP, or a voice in a polyphonic context.
|
|
723
727
|
*
|
|
724
728
|
* @param sfReader : the soundfile reader
|
|
725
|
-
* @param
|
|
729
|
+
* @param baseDSP : the base DSP in the wasm memory
|
|
726
730
|
* @param name : the name of the soundfile
|
|
727
731
|
* @param url : the url of the soundfile
|
|
728
732
|
*/
|
|
@@ -730,8 +734,9 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
730
734
|
/**
|
|
731
735
|
* Init soundfiles memory.
|
|
732
736
|
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
737
|
+
* @param allocator : the wasm memory allocator
|
|
738
|
+
* @param sfReader : the soundfile reader
|
|
739
|
+
* @param baseDSP : the DSP struct (either a monophonic DSP of polyphonic voice) base DSP in the wasm memory
|
|
735
740
|
*/
|
|
736
741
|
protected initSoundfileMemory(allocator: WasmAllocator, sfReader: SoundfileReader, baseDSP: number): Promise<void>;
|
|
737
742
|
protected updateOutputs(): void;
|
package/dist/esm-bundle/index.js
CHANGED
|
@@ -8265,7 +8265,7 @@ var FaustBaseWebAudioDsp = class {
|
|
|
8265
8265
|
}
|
|
8266
8266
|
});
|
|
8267
8267
|
} else if (item.type === "soundfile") {
|
|
8268
|
-
this.fSoundfiles.push({ name: item.label, url: item.url, basePtr: -1 });
|
|
8268
|
+
this.fSoundfiles.push({ name: item.label, url: item.url, index: item.index, basePtr: -1 });
|
|
8269
8269
|
}
|
|
8270
8270
|
};
|
|
8271
8271
|
}
|
|
@@ -8302,11 +8302,11 @@ var FaustBaseWebAudioDsp = class {
|
|
|
8302
8302
|
return [];
|
|
8303
8303
|
}
|
|
8304
8304
|
}
|
|
8305
|
-
async loadSoundfile(sfReader,
|
|
8305
|
+
async loadSoundfile(sfReader, baseDSP, name, url) {
|
|
8306
8306
|
console.log(`Soundfile ${name} paths: ${url}`);
|
|
8307
|
-
const sfDirectories = ["", ".", "http://127.0.0.1:8000"];
|
|
8308
8307
|
const sfReaderURLs = this.extractURLsFromJSON();
|
|
8309
8308
|
console.log(`sfReaderURLs ${sfReaderURLs}`);
|
|
8309
|
+
const sfDirectories = ["", ".", "http://127.0.0.1:8000"];
|
|
8310
8310
|
sfDirectories.push(...sfReaderURLs);
|
|
8311
8311
|
console.log(`sfDirectories ${sfDirectories}`);
|
|
8312
8312
|
const sfPathNames = await sfReader.checkFiles(sfDirectories, FaustBaseWebAudioDsp.splitNames(url));
|
|
@@ -8315,16 +8315,15 @@ var FaustBaseWebAudioDsp = class {
|
|
|
8315
8315
|
if (item) {
|
|
8316
8316
|
if (item.basePtr !== -1) {
|
|
8317
8317
|
const HEAP32 = sfReader.getHEAP32();
|
|
8318
|
-
console.log(`Soundfile ${name} loaded at ${item.basePtr} in wasm memory with
|
|
8319
|
-
|
|
8320
|
-
HEAP32[sfOffset >> 2] = item.basePtr;
|
|
8318
|
+
console.log(`Soundfile CACHE ${url}} : ${name} loaded at ${item.basePtr} in wasm memory with index ${item.index}`);
|
|
8319
|
+
HEAP32[baseDSP + item.index >> 2] = item.basePtr;
|
|
8321
8320
|
} else {
|
|
8322
8321
|
const soundfile = await sfReader.createSoundfile(sfPathNames, MAX_CHAN, this.fSampleSize === 8);
|
|
8323
8322
|
if (soundfile) {
|
|
8324
8323
|
const HEAP32 = soundfile.getHEAP32();
|
|
8325
8324
|
item.basePtr = soundfile.getPtr();
|
|
8326
|
-
console.log(`Soundfile ${name} loaded at ${item.basePtr} in wasm memory with
|
|
8327
|
-
HEAP32[
|
|
8325
|
+
console.log(`Soundfile ${name} loaded at ${item.basePtr} in wasm memory with index ${item.index}`);
|
|
8326
|
+
HEAP32[baseDSP + item.index >> 2] = item.basePtr;
|
|
8328
8327
|
} else {
|
|
8329
8328
|
console.log(`Soundfile ${name} for ${url} cannot be created !}`);
|
|
8330
8329
|
}
|
|
@@ -8334,10 +8333,8 @@ var FaustBaseWebAudioDsp = class {
|
|
|
8334
8333
|
}
|
|
8335
8334
|
}
|
|
8336
8335
|
async initSoundfileMemory(allocator, sfReader, baseDSP) {
|
|
8337
|
-
let sfOffset = baseDSP;
|
|
8338
8336
|
for (const { name, url } of this.fSoundfiles) {
|
|
8339
|
-
await this.loadSoundfile(sfReader,
|
|
8340
|
-
sfOffset += this.fPtrSize;
|
|
8337
|
+
await this.loadSoundfile(sfReader, baseDSP, name, url);
|
|
8341
8338
|
}
|
|
8342
8339
|
;
|
|
8343
8340
|
}
|