@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
|
@@ -1400,9 +1400,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1400
1400
|
* @param sampleRate - the sample rate in Hz
|
|
1401
1401
|
* @param bufferSize - the buffer size in frames
|
|
1402
1402
|
* @param factory - default is the compiled factory
|
|
1403
|
+
* @param context - if this exists, will be used to fetch soundfiles online
|
|
1403
1404
|
* @returns the compiled processor or 'null' if failure
|
|
1404
1405
|
*/
|
|
1405
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory): Promise<IFaustMonoOfflineProcessor | null>;
|
|
1406
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, context?: BaseAudioContext): Promise<IFaustMonoOfflineProcessor | null>;
|
|
1406
1407
|
/**
|
|
1407
1408
|
* Get DSP JSON description with its UI and metadata as object.
|
|
1408
1409
|
*
|
|
@@ -1459,9 +1460,10 @@ export interface IFaustPolyDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1459
1460
|
* @param voiceFactory - the Faust factory for voices, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
|
|
1460
1461
|
* @param mixerModule - the wasm Mixer module (loaded from 'mixer32.wasm' or 'mixer64.wasm' files)
|
|
1461
1462
|
* @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
|
|
1463
|
+
* @param context - if this exists, will be used to fetch soundfiles online
|
|
1462
1464
|
* @returns the compiled processor or 'null' if failure
|
|
1463
1465
|
*/
|
|
1464
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null,
|
|
1466
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, context?: BaseAudioContext): Promise<IFaustPolyOfflineProcessor | null>;
|
|
1465
1467
|
/**
|
|
1466
1468
|
* Get DSP JSON description with its UI and metadata as object.
|
|
1467
1469
|
*
|
|
@@ -1496,7 +1498,7 @@ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
|
|
|
1496
1498
|
prototype: AudioWorkletProcessor;
|
|
1497
1499
|
parameterDescriptors: AudioParamDescriptor[];
|
|
1498
1500
|
}>;
|
|
1499
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory): Promise<FaustMonoOfflineProcessor>;
|
|
1501
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, factory?: LooseFaustDspFactory, context?: BaseAudioContext): Promise<FaustMonoOfflineProcessor>;
|
|
1500
1502
|
getMeta(): any;
|
|
1501
1503
|
getJSON(): string;
|
|
1502
1504
|
getUI(): any;
|
|
@@ -1518,7 +1520,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1518
1520
|
prototype: AudioWorkletProcessor;
|
|
1519
1521
|
parameterDescriptors: AudioParamDescriptor[];
|
|
1520
1522
|
}>;
|
|
1521
|
-
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null): Promise<FaustPolyOfflineProcessor>;
|
|
1523
|
+
createOfflineProcessor(sampleRate: number, bufferSize: number, voices: number, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, context?: BaseAudioContext): Promise<FaustPolyOfflineProcessor>;
|
|
1522
1524
|
getMeta(): FaustDspMeta;
|
|
1523
1525
|
getJSON(): string;
|
|
1524
1526
|
getUI(): FaustUIDescriptor;
|
package/dist/cjs-bundle/index.js
CHANGED
|
@@ -9763,12 +9763,14 @@ const dependencies = {
|
|
|
9763
9763
|
throw e;
|
|
9764
9764
|
}
|
|
9765
9765
|
}
|
|
9766
|
-
async createOfflineProcessor(sampleRate, bufferSize, factory = this.factory) {
|
|
9766
|
+
async createOfflineProcessor(sampleRate, bufferSize, factory = this.factory, context) {
|
|
9767
9767
|
if (!factory)
|
|
9768
9768
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
9769
9769
|
const meta = JSON.parse(factory.json);
|
|
9770
9770
|
const instance = await FaustWasmInstantiator_default.createAsyncMonoDSPInstance(factory);
|
|
9771
9771
|
const sampleSize = meta.compile_options.match("-double") ? 8 : 4;
|
|
9772
|
+
if (context)
|
|
9773
|
+
factory.soundfiles = await SoundfileReader_default.loadSoundfiles(meta, factory.soundfiles || {}, context);
|
|
9772
9774
|
const monoDsp = new FaustMonoWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, factory.soundfiles);
|
|
9773
9775
|
return new FaustMonoOfflineProcessor(monoDsp, bufferSize);
|
|
9774
9776
|
}
|
|
@@ -9970,13 +9972,18 @@ const dependencies = {
|
|
|
9970
9972
|
throw e;
|
|
9971
9973
|
}
|
|
9972
9974
|
}
|
|
9973
|
-
async createOfflineProcessor(sampleRate, bufferSize, voices, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory) {
|
|
9975
|
+
async createOfflineProcessor(sampleRate, bufferSize, voices, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, context) {
|
|
9974
9976
|
if (!voiceFactory)
|
|
9975
9977
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
9976
9978
|
const voiceMeta = JSON.parse(voiceFactory.json);
|
|
9977
9979
|
const effectMeta = effectFactory ? JSON.parse(effectFactory.json) : void 0;
|
|
9978
9980
|
const instance = await FaustWasmInstantiator_default.createAsyncPolyDSPInstance(voiceFactory, mixerModule, voices, effectFactory || void 0);
|
|
9979
9981
|
const sampleSize = voiceMeta.compile_options.match("-double") ? 8 : 4;
|
|
9982
|
+
if (context) {
|
|
9983
|
+
voiceFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(voiceMeta, voiceFactory.soundfiles || {}, context);
|
|
9984
|
+
if (effectFactory)
|
|
9985
|
+
effectFactory.soundfiles = await SoundfileReader_default.loadSoundfiles(effectMeta, effectFactory.soundfiles || {}, context);
|
|
9986
|
+
}
|
|
9980
9987
|
const soundfiles = { ...effectFactory == null ? void 0 : effectFactory.soundfiles, ...voiceFactory.soundfiles };
|
|
9981
9988
|
const polyDsp = new FaustPolyWebAudioDsp(instance, sampleRate, sampleSize, bufferSize, soundfiles);
|
|
9982
9989
|
return new FaustPolyOfflineProcessor(polyDsp, bufferSize);
|