@grame/faustwasm 0.2.1 → 0.2.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 +6 -4
- package/assets/standalone/faustwasm/index.js +9 -2
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +6 -4
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +6 -4
- package/dist/cjs-bundle/index.js +9 -2
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +6 -4
- package/dist/esm/index.js +9 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +6 -4
- package/dist/esm-bundle/index.js +9 -2
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustDspGenerator.ts +14 -4
- package/test/faustlive-wasm/faustwasm/index.d.ts +6 -4
- package/test/faustlive-wasm/faustwasm/index.js +9 -2
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -1393,9 +1393,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1393
1393
|
* @param sampleRate - the sample rate in Hz
|
|
1394
1394
|
* @param bufferSize - the buffer size in frames
|
|
1395
1395
|
* @param factory - default is the compiled factory
|
|
1396
|
+
* @param context - if this exists, will be used to fetch soundfiles online
|
|
1396
1397
|
* @returns the compiled processor or 'null' if failure
|
|
1397
1398
|
*/
|
|
1398
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory): Promise<IFaustMonoOfflineProcessor | null>;
|
|
1399
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, context?: BaseAudioContext): Promise<IFaustMonoOfflineProcessor | null>;
|
|
1399
1400
|
/**
|
|
1400
1401
|
* Get DSP JSON description with its UI and metadata as object.
|
|
1401
1402
|
*
|
|
@@ -1452,9 +1453,10 @@ export interface IFaustPolyDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1452
1453
|
* @param voiceFactory - the Faust factory for voices, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
|
|
1453
1454
|
* @param mixerModule - the wasm Mixer module (loaded from 'mixer32.wasm' or 'mixer64.wasm' files)
|
|
1454
1455
|
* @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
|
|
1456
|
+
* @param context - if this exists, will be used to fetch soundfiles online
|
|
1455
1457
|
* @returns the compiled processor or 'null' if failure
|
|
1456
1458
|
*/
|
|
1457
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null,
|
|
1459
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, context?: BaseAudioContext): Promise<IFaustPolyOfflineProcessor | null>;
|
|
1458
1460
|
/**
|
|
1459
1461
|
* Get DSP JSON description with its UI and metadata as object.
|
|
1460
1462
|
*
|
|
@@ -1489,7 +1491,7 @@ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
|
|
|
1489
1491
|
prototype: AudioWorkletProcessor;
|
|
1490
1492
|
parameterDescriptors: AudioParamDescriptor[];
|
|
1491
1493
|
}>;
|
|
1492
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory): Promise<FaustMonoOfflineProcessor>;
|
|
1494
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, context?: BaseAudioContext): Promise<FaustMonoOfflineProcessor>;
|
|
1493
1495
|
getMeta(): any;
|
|
1494
1496
|
getJSON(): string;
|
|
1495
1497
|
getUI(): any;
|
|
@@ -1511,7 +1513,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1511
1513
|
prototype: AudioWorkletProcessor;
|
|
1512
1514
|
parameterDescriptors: AudioParamDescriptor[];
|
|
1513
1515
|
}>;
|
|
1514
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null): Promise<FaustPolyOfflineProcessor>;
|
|
1516
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, context?: BaseAudioContext): Promise<FaustPolyOfflineProcessor>;
|
|
1515
1517
|
getMeta(): FaustDspMeta;
|
|
1516
1518
|
getJSON(): string;
|
|
1517
1519
|
getUI(): FaustUIDescriptor;
|
|
@@ -3715,12 +3715,14 @@ const dependencies = {
|
|
|
3715
3715
|
throw e;
|
|
3716
3716
|
}
|
|
3717
3717
|
}
|
|
3718
|
-
async createOfflineProcessor(sampleRate, bufferSize, factory = this.factory) {
|
|
3718
|
+
async createOfflineProcessor(sampleRate, bufferSize, factory = this.factory, context) {
|
|
3719
3719
|
if (!factory)
|
|
3720
3720
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
3721
3721
|
const meta = JSON.parse(factory.json);
|
|
3722
3722
|
const instance = await FaustWasmInstantiator_default.createAsyncMonoDSPInstance(factory);
|
|
3723
3723
|
const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
|
|
3724
|
+
if (context)
|
|
3725
|
+
factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
|
|
3724
3726
|
const monoDsp = new FaustMonoWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, factory.soundfiles);
|
|
3725
3727
|
return new FaustMonoOfflineProcessor(monoDsp, bufferSize);
|
|
3726
3728
|
}
|
|
@@ -3922,13 +3924,18 @@ const dependencies = {
|
|
|
3922
3924
|
throw e;
|
|
3923
3925
|
}
|
|
3924
3926
|
}
|
|
3925
|
-
async createOfflineProcessor(sampleRate, bufferSize, voices, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory) {
|
|
3927
|
+
async createOfflineProcessor(sampleRate, bufferSize, voices, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, context) {
|
|
3926
3928
|
if (!voiceFactory)
|
|
3927
3929
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
3928
3930
|
const voiceMeta = JSON.parse(voiceFactory.json);
|
|
3929
3931
|
const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
|
|
3930
3932
|
const instance = await FaustWasmInstantiator_default.createAsyncPolyDSPInstance(voiceFactory, mixerModule, voices, effectFactory || void 0);
|
|
3931
3933
|
const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
|
|
3934
|
+
if (context) {
|
|
3935
|
+
voiceFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(voiceMeta, voiceFactory.soundfiles || {}, context);
|
|
3936
|
+
if (effectFactory)
|
|
3937
|
+
effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
|
|
3938
|
+
}
|
|
3932
3939
|
const soundfiles = { ...effectFactory == null ? void 0 : effectFactory.soundfiles, ...voiceFactory.soundfiles };
|
|
3933
3940
|
const polyDsp = new FaustPolyWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, soundfiles);
|
|
3934
3941
|
return new FaustPolyOfflineProcessor(polyDsp, bufferSize);
|