@grame/faustwasm 0.0.27 → 0.0.29
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/README.md +10 -8
- package/assets/standalone/faustwasm/index.d.ts +17 -17
- package/assets/standalone/faustwasm/index.js +47 -31
- package/assets/standalone/faustwasm/index.js.map +3 -3
- package/dist/cjs/index.d.ts +17 -17
- package/dist/cjs/index.js +46 -30
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs-bundle/index.d.ts +17 -17
- package/dist/cjs-bundle/index.js +1449 -3153
- package/dist/cjs-bundle/index.js.map +3 -3
- package/dist/esm/index.d.ts +17 -17
- package/dist/esm/index.js +47 -31
- package/dist/esm/index.js.map +3 -3
- package/dist/esm-bundle/index.d.ts +17 -17
- package/dist/esm-bundle/index.js +1452 -3152
- package/dist/esm-bundle/index.js.map +3 -3
- package/libfaust-wasm/libfaust-wasm.data +0 -0
- package/libfaust-wasm/libfaust-wasm.js +3 -4
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/package.json +1 -1
- package/src/FaustDspGenerator.ts +13 -13
- package/src/FaustDspInstance.ts +1 -3
- package/src/FaustWasmInstantiator.ts +1 -1
- package/src/exports.ts +24 -24
- package/test/faustlive-wasm/faustwasm/index.d.ts +17 -17
- package/test/faustlive-wasm/faustwasm/index.js +47 -31
- package/test/faustlive-wasm/faustwasm/index.js.map +3 -3
- package/test/t1.cjs +46 -0
- package/test/t1.js +46 -0
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="emscripten" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export type FaustModuleFactory = EmscriptenModuleFactory<FaustModule>;
|
|
7
7
|
export interface FaustModule extends EmscriptenModule {
|
|
8
8
|
ccall: typeof ccall;
|
|
9
9
|
cwrap: typeof cwrap;
|
|
@@ -22,7 +22,7 @@ export interface FaustModule extends EmscriptenModule {
|
|
|
22
22
|
FS: typeof FS;
|
|
23
23
|
libFaustWasm: new () => LibFaustWasm;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
25
|
+
export type FaustInfoType = "help" | "version" | "libdir" | "includedir" | "archdir" | "dspdir" | "pathslist";
|
|
26
26
|
export interface IntVector {
|
|
27
27
|
size(): number;
|
|
28
28
|
get(i: number): number;
|
|
@@ -125,8 +125,8 @@ export interface FaustDspMeta {
|
|
|
125
125
|
}[];
|
|
126
126
|
ui: FaustUIDescriptor;
|
|
127
127
|
}
|
|
128
|
-
export
|
|
129
|
-
export
|
|
128
|
+
export type FaustUIDescriptor = FaustUIGroup[];
|
|
129
|
+
export type FaustUIItem = FaustUIInputItem | FaustUIOutputItem | FaustUIGroup;
|
|
130
130
|
export interface FaustUIInputItem {
|
|
131
131
|
type: FaustUIInputType;
|
|
132
132
|
label: string;
|
|
@@ -156,15 +156,15 @@ export interface FaustUIMeta {
|
|
|
156
156
|
hidden?: string;
|
|
157
157
|
[key: string]: string | undefined;
|
|
158
158
|
}
|
|
159
|
-
export
|
|
160
|
-
export
|
|
161
|
-
export
|
|
159
|
+
export type FaustUIGroupType = "vgroup" | "hgroup" | "tgroup";
|
|
160
|
+
export type FaustUIOutputType = "hbargraph" | "vbargraph";
|
|
161
|
+
export type FaustUIInputType = "vslider" | "hslider" | "button" | "checkbox" | "nentry";
|
|
162
162
|
export interface FaustUIGroup {
|
|
163
163
|
type: FaustUIGroupType;
|
|
164
164
|
label: string;
|
|
165
165
|
items: FaustUIItem[];
|
|
166
166
|
}
|
|
167
|
-
export
|
|
167
|
+
export type FaustUIType = FaustUIGroupType | FaustUIOutputType | FaustUIInputType;
|
|
168
168
|
export interface AudioParamDescriptor {
|
|
169
169
|
automationRate?: AutomationRate;
|
|
170
170
|
defaultValue?: number;
|
|
@@ -198,12 +198,12 @@ export interface InterfaceFFT {
|
|
|
198
198
|
export declare const InterfaceFFT: {
|
|
199
199
|
new (size: number): InterfaceFFT;
|
|
200
200
|
};
|
|
201
|
-
export
|
|
202
|
-
export
|
|
201
|
+
export type TWindowFunction = (index: number, length: number, ...args: any[]) => number;
|
|
202
|
+
export type Writeable<T> = {
|
|
203
203
|
-readonly [P in keyof T]: T[P];
|
|
204
204
|
};
|
|
205
|
-
export
|
|
206
|
-
export
|
|
205
|
+
export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array;
|
|
206
|
+
export type TypedArrayConstructor = typeof Int8Array | typeof Uint8Array | typeof Int16Array | typeof Uint16Array | typeof Int32Array | typeof Uint32Array | typeof Uint8ClampedArray | typeof Float32Array | typeof Float64Array;
|
|
207
207
|
export declare const FFTUtils: {
|
|
208
208
|
/** Inject window functions as array, no need to add rectangular (no windowing) */
|
|
209
209
|
windowFunctions?: TWindowFunction[];
|
|
@@ -359,14 +359,14 @@ export declare class FaustWasmInstantiator {
|
|
|
359
359
|
static createAsyncPolyDSPInstance(voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, effectFactory?: LooseFaustDspFactory): Promise<FaustPolyDspInstance>;
|
|
360
360
|
static createSyncPolyDSPInstance(voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, effectFactory?: LooseFaustDspFactory): FaustPolyDspInstance;
|
|
361
361
|
}
|
|
362
|
-
export
|
|
363
|
-
export
|
|
364
|
-
export
|
|
362
|
+
export type OutputParamHandler = (path: string, value: number) => void;
|
|
363
|
+
export type ComputeHandler = (buffer_size: number) => void;
|
|
364
|
+
export type PlotHandler = (plotted: Float32Array[] | Float64Array[], index: number, events?: {
|
|
365
365
|
type: string;
|
|
366
366
|
data: any;
|
|
367
367
|
}[]) => void;
|
|
368
|
-
export
|
|
369
|
-
export
|
|
368
|
+
export type MetadataHandler = (key: string, value: string) => void;
|
|
369
|
+
export type UIHandler = (item: FaustUIItem) => void;
|
|
370
370
|
/**
|
|
371
371
|
* DSP implementation: mimic the C++ 'dsp' class:
|
|
372
372
|
* - adding MIDI control: metadata are decoded and incoming MIDI messages will control the associated controllers
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
}
|
|
24
24
|
return to;
|
|
25
25
|
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
27
30
|
|
|
28
31
|
// node_modules/tslib/tslib.js
|
|
29
32
|
var require_tslib = __commonJS({
|
|
@@ -854,8 +857,8 @@
|
|
|
854
857
|
return this.hash.digest();
|
|
855
858
|
};
|
|
856
859
|
Sha2563.prototype.digest = function() {
|
|
857
|
-
return
|
|
858
|
-
return
|
|
860
|
+
return tslib_1.__awaiter(this, void 0, void 0, function() {
|
|
861
|
+
return tslib_1.__generator(this, function(_a) {
|
|
859
862
|
return [2, this.digestSync()];
|
|
860
863
|
});
|
|
861
864
|
});
|
|
@@ -883,7 +886,7 @@
|
|
|
883
886
|
"use strict";
|
|
884
887
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
885
888
|
var tslib_1 = require_tslib();
|
|
886
|
-
|
|
889
|
+
tslib_1.__exportStar(require_jsSha256(), exports);
|
|
887
890
|
}
|
|
888
891
|
});
|
|
889
892
|
|
|
@@ -1728,7 +1731,6 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
1728
1731
|
this.fExports.setParamValue($dsp, index, value);
|
|
1729
1732
|
}
|
|
1730
1733
|
};
|
|
1731
|
-
var FaustDspInstance_default = FaustDspInstance;
|
|
1732
1734
|
|
|
1733
1735
|
// src/FaustWasmInstantiator.ts
|
|
1734
1736
|
var FaustWasmInstantiator = class {
|
|
@@ -1810,13 +1812,15 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
1810
1812
|
return n;
|
|
1811
1813
|
};
|
|
1812
1814
|
const effectSize = effectMeta ? effectMeta.size : 0;
|
|
1813
|
-
let memorySize = pow2limit(
|
|
1815
|
+
let memorySize = pow2limit(
|
|
1816
|
+
effectSize + dspMeta.size * voices + (dspMeta.inputs + dspMeta.outputs * 2) * (ptrSize + bufferSize * sampleSize)
|
|
1817
|
+
) / 65536;
|
|
1814
1818
|
memorySize = Math.max(2, memorySize);
|
|
1815
1819
|
return new WebAssembly.Memory({ initial: memorySize, maximum: memorySize });
|
|
1816
1820
|
}
|
|
1817
1821
|
static createMonoDSPInstanceAux(instance, json) {
|
|
1818
1822
|
const functions = instance.exports;
|
|
1819
|
-
const api = new
|
|
1823
|
+
const api = new FaustDspInstance(functions);
|
|
1820
1824
|
const memory = instance.exports.memory;
|
|
1821
1825
|
return { memory, api, json };
|
|
1822
1826
|
}
|
|
@@ -1879,12 +1883,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
1879
1883
|
const memory = this.createMemoryAux(voices, voiceFactory, effectFactory);
|
|
1880
1884
|
const voiceInstance = await WebAssembly.instantiate(voiceFactory.module, this.createWasmImport(memory));
|
|
1881
1885
|
const voiceFunctions = voiceInstance.exports;
|
|
1882
|
-
const voiceAPI = new
|
|
1886
|
+
const voiceAPI = new FaustDspInstance(voiceFunctions);
|
|
1883
1887
|
const mixerAPI = this.createMixerAux(mixerModule, memory);
|
|
1884
1888
|
if (effectFactory) {
|
|
1885
1889
|
const effectInstance = await WebAssembly.instantiate(effectFactory.module, this.createWasmImport(memory));
|
|
1886
1890
|
const effectFunctions = effectInstance.exports;
|
|
1887
|
-
const effectAPI = new
|
|
1891
|
+
const effectAPI = new FaustDspInstance(effectFunctions);
|
|
1888
1892
|
return {
|
|
1889
1893
|
memory,
|
|
1890
1894
|
voices,
|
|
@@ -1908,12 +1912,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
1908
1912
|
const memory = this.createMemoryAux(voices, voiceFactory, effectFactory);
|
|
1909
1913
|
const voiceInstance = new WebAssembly.Instance(voiceFactory.module, this.createWasmImport(memory));
|
|
1910
1914
|
const voiceFunctions = voiceInstance.exports;
|
|
1911
|
-
const voiceAPI = new
|
|
1915
|
+
const voiceAPI = new FaustDspInstance(voiceFunctions);
|
|
1912
1916
|
const mixerAPI = this.createMixerAux(mixerModule, memory);
|
|
1913
1917
|
if (effectFactory) {
|
|
1914
1918
|
const effectInstance = new WebAssembly.Instance(effectFactory.module, this.createWasmImport(memory));
|
|
1915
1919
|
const effectFunctions = effectInstance.exports;
|
|
1916
|
-
const effectAPI = new
|
|
1920
|
+
const effectAPI = new FaustDspInstance(effectFunctions);
|
|
1917
1921
|
return {
|
|
1918
1922
|
memory,
|
|
1919
1923
|
voices,
|
|
@@ -2324,7 +2328,13 @@ this.fDSP: ${this.fDSP}`;
|
|
|
2324
2328
|
this.initMemory();
|
|
2325
2329
|
this.fVoiceTable = [];
|
|
2326
2330
|
for (let voice = 0; voice < this.fInstance.voices; voice++) {
|
|
2327
|
-
this.fVoiceTable.push(new FaustWebAudioDspVoice(
|
|
2331
|
+
this.fVoiceTable.push(new FaustWebAudioDspVoice(
|
|
2332
|
+
this.fJSONDsp.size * voice,
|
|
2333
|
+
this.fInstance.voiceAPI,
|
|
2334
|
+
this.fInputsItems,
|
|
2335
|
+
this.fPathTable,
|
|
2336
|
+
sampleRate
|
|
2337
|
+
));
|
|
2328
2338
|
}
|
|
2329
2339
|
if (this.fInstance.effectAPI)
|
|
2330
2340
|
this.fInstance.effectAPI.init(this.fEffect, sampleRate);
|
|
@@ -3291,14 +3301,20 @@ this.fAudioMixingHalf: ${this.fAudioMixingHalf}`;
|
|
|
3291
3301
|
};
|
|
3292
3302
|
var FaustPolyAudioWorkletNode = class extends FaustAudioWorkletNode {
|
|
3293
3303
|
constructor(context, name, voiceFactory, mixerModule, voices, sampleSize, effectFactory, nodeOptions = {}) {
|
|
3294
|
-
super(
|
|
3304
|
+
super(
|
|
3305
|
+
context,
|
|
3295
3306
|
name,
|
|
3296
3307
|
voiceFactory,
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3308
|
+
{
|
|
3309
|
+
name,
|
|
3310
|
+
voiceFactory,
|
|
3311
|
+
mixerModule,
|
|
3312
|
+
voices,
|
|
3313
|
+
sampleSize,
|
|
3314
|
+
effectFactory
|
|
3315
|
+
},
|
|
3316
|
+
nodeOptions
|
|
3317
|
+
);
|
|
3302
3318
|
this.onprocessorerror = (e) => {
|
|
3303
3319
|
throw e;
|
|
3304
3320
|
};
|
|
@@ -3490,15 +3506,15 @@ const faustData = ${JSON.stringify({
|
|
|
3490
3506
|
poly: false
|
|
3491
3507
|
})};
|
|
3492
3508
|
// Implementation needed classes of functions
|
|
3493
|
-
const ${
|
|
3509
|
+
const ${FaustDspInstance.name} = ${FaustDspInstance.toString()}
|
|
3494
3510
|
const ${FaustBaseWebAudioDsp.name} = ${FaustBaseWebAudioDsp.toString()}
|
|
3495
3511
|
const ${FaustMonoWebAudioDsp.name} = ${FaustMonoWebAudioDsp.toString()}
|
|
3496
3512
|
const ${FaustWasmInstantiator_default.name} = ${FaustWasmInstantiator_default.toString()}
|
|
3497
3513
|
// Put them in dependencies
|
|
3498
3514
|
const dependencies = {
|
|
3499
|
-
${FaustBaseWebAudioDsp.name},
|
|
3500
|
-
${FaustMonoWebAudioDsp.name},
|
|
3501
|
-
${FaustWasmInstantiator_default.name}
|
|
3515
|
+
FaustBaseWebAudioDsp: ${FaustBaseWebAudioDsp.name},
|
|
3516
|
+
FaustMonoWebAudioDsp: ${FaustMonoWebAudioDsp.name},
|
|
3517
|
+
FaustWasmInstantiator: ${FaustWasmInstantiator_default.name}
|
|
3502
3518
|
};
|
|
3503
3519
|
// Generate the actual AudioWorkletProcessor code
|
|
3504
3520
|
(${FaustAudioWorkletProcessor_default.toString()})(dependencies, faustData);
|
|
@@ -3533,16 +3549,16 @@ const faustData = ${JSON.stringify({
|
|
|
3533
3549
|
fftOptions
|
|
3534
3550
|
})};
|
|
3535
3551
|
// Implementation needed classes of functions
|
|
3536
|
-
const ${
|
|
3552
|
+
const ${FaustDspInstance.name} = ${FaustDspInstance.toString()}
|
|
3537
3553
|
const ${FaustBaseWebAudioDsp.name} = ${FaustBaseWebAudioDsp.toString()}
|
|
3538
3554
|
const ${FaustMonoWebAudioDsp.name} = ${FaustMonoWebAudioDsp.toString()}
|
|
3539
3555
|
const ${FaustWasmInstantiator_default.name} = ${FaustWasmInstantiator_default.toString()}
|
|
3540
3556
|
const FFTUtils = ${fftUtils.toString()}
|
|
3541
3557
|
// Put them in dependencies
|
|
3542
3558
|
const dependencies = {
|
|
3543
|
-
${FaustBaseWebAudioDsp.name},
|
|
3544
|
-
${FaustMonoWebAudioDsp.name},
|
|
3545
|
-
${FaustWasmInstantiator_default.name},
|
|
3559
|
+
FaustBaseWebAudioDsp: ${FaustBaseWebAudioDsp.name},
|
|
3560
|
+
FaustMonoWebAudioDsp: ${FaustMonoWebAudioDsp.name},
|
|
3561
|
+
FaustWasmInstantiator: ${FaustWasmInstantiator_default.name},
|
|
3546
3562
|
FFTUtils
|
|
3547
3563
|
};
|
|
3548
3564
|
// Generate the actual AudioWorkletProcessor code
|
|
@@ -3669,16 +3685,16 @@ const faustData = ${JSON.stringify({
|
|
|
3669
3685
|
effectMeta
|
|
3670
3686
|
})};
|
|
3671
3687
|
// Implementation needed classes of functions
|
|
3672
|
-
const ${
|
|
3688
|
+
const ${FaustDspInstance.name} = ${FaustDspInstance.toString()}
|
|
3673
3689
|
const ${FaustBaseWebAudioDsp.name} = ${FaustBaseWebAudioDsp.toString()}
|
|
3674
3690
|
const ${FaustPolyWebAudioDsp.name} = ${FaustPolyWebAudioDsp.toString()}
|
|
3675
3691
|
const ${FaustWebAudioDspVoice.name} = ${FaustWebAudioDspVoice.toString()}
|
|
3676
3692
|
const ${FaustWasmInstantiator_default.name} = ${FaustWasmInstantiator_default.toString()}
|
|
3677
3693
|
// Put them in dependencies
|
|
3678
3694
|
const dependencies = {
|
|
3679
|
-
${FaustBaseWebAudioDsp.name},
|
|
3680
|
-
${FaustPolyWebAudioDsp.name},
|
|
3681
|
-
${FaustWasmInstantiator_default.name}
|
|
3695
|
+
FaustBaseWebAudioDsp: ${FaustBaseWebAudioDsp.name},
|
|
3696
|
+
FaustPolyWebAudioDsp: ${FaustPolyWebAudioDsp.name},
|
|
3697
|
+
FaustWasmInstantiator: ${FaustWasmInstantiator_default.name}
|
|
3682
3698
|
};
|
|
3683
3699
|
// Generate the actual AudioWorkletProcessor code
|
|
3684
3700
|
(${FaustAudioWorkletProcessor_default.toString()})(dependencies, faustData);
|