@grame/faustwasm 0.4.4 → 0.4.6
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/COPYING.txt +520 -0
- package/README.md +3 -0
- package/assets/standalone/faust-ui/index.css +8 -0
- package/assets/standalone/faust-ui/index.css.map +1 -1
- package/assets/standalone/faust-ui/index.js +56 -30
- package/assets/standalone/faust-ui/index.js.map +1 -1
- package/assets/standalone/faustwasm/index.d.ts +18 -10
- package/assets/standalone/faustwasm/index.js +69 -24
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +18 -10
- package/dist/cjs/index.js +69 -24
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +18 -10
- package/dist/cjs-bundle/index.js +72 -27
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +18 -10
- package/dist/esm/index.js +69 -24
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +18 -10
- package/dist/esm-bundle/index.js +72 -27
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.data +0 -0
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/node +0 -0
- package/package.json +4 -2
- package/src/FaustAudioWorkletNode.ts +13 -24
- package/src/FaustAudioWorkletProcessor.ts +28 -1
- package/src/FaustDspGenerator.ts +18 -9
- package/src/FaustFFTAudioWorkletProcessor.ts +27 -0
- package/src/instantiateFaustModule.js +82 -0
- package/test/faustlive-wasm/faust-ui/index.css +8 -0
- package/test/faustlive-wasm/faust-ui/index.css.map +1 -1
- package/test/faustlive-wasm/faust-ui/index.js +56 -30
- package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
- package/test/faustlive-wasm/faustwasm/index.d.ts +18 -10
- package/test/faustlive-wasm/faustwasm/index.js +69 -24
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -887,6 +887,8 @@ export interface FaustPolyAudioWorkletNodeOptions extends AudioWorkletNodeOption
|
|
|
887
887
|
export interface FaustAudioWorkletProcessorOptions {
|
|
888
888
|
name: string;
|
|
889
889
|
sampleSize: number;
|
|
890
|
+
moduleId?: string;
|
|
891
|
+
instanceId?: string;
|
|
890
892
|
}
|
|
891
893
|
export interface FaustMonoAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
|
|
892
894
|
factory: LooseFaustDspFactory;
|
|
@@ -931,6 +933,8 @@ export interface FaustFFTAudioWorkletProcessorOptions {
|
|
|
931
933
|
name: string;
|
|
932
934
|
sampleSize: number;
|
|
933
935
|
factory: LooseFaustDspFactory;
|
|
936
|
+
moduleId?: string;
|
|
937
|
+
instanceId?: string;
|
|
934
938
|
}
|
|
935
939
|
export declare const getFaustFFTAudioWorkletProcessor: (dependencies: FaustFFTAudioWorkletProcessorDependencies, faustData: FaustFFTData, register?: boolean) => {
|
|
936
940
|
new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
|
|
@@ -1266,7 +1270,7 @@ export declare class SoundfileReader {
|
|
|
1266
1270
|
static loadSoundfiles(dspMeta: FaustDspMeta, soundfilesIn: LooseFaustDspFactory["soundfiles"], audioCtx: BaseAudioContext): Promise<LooseFaustDspFactory["soundfiles"]>;
|
|
1267
1271
|
}
|
|
1268
1272
|
declare const FaustAudioWorkletNode_base: {
|
|
1269
|
-
new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions
|
|
1273
|
+
new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
|
|
1270
1274
|
prototype: AudioWorkletNode;
|
|
1271
1275
|
};
|
|
1272
1276
|
/**
|
|
@@ -1282,7 +1286,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1282
1286
|
protected fPlotHandler: PlotHandler | null;
|
|
1283
1287
|
protected fUICallback: UIHandler;
|
|
1284
1288
|
protected fDescriptor: FaustUIInputItem[];
|
|
1285
|
-
constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options
|
|
1289
|
+
constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
|
|
1286
1290
|
/** Setup accelerometer and gyroscope handlers */
|
|
1287
1291
|
listenSensors(): Promise<void>;
|
|
1288
1292
|
setOutputParamHandler(handler: OutputParamHandler | null): void;
|
|
@@ -1291,6 +1295,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1291
1295
|
getComputeHandler(): ComputeHandler | null;
|
|
1292
1296
|
setPlotHandler(handler: PlotHandler | null): void;
|
|
1293
1297
|
getPlotHandler(): PlotHandler | null;
|
|
1298
|
+
setupWamEventHandler(): void;
|
|
1294
1299
|
getNumInputs(): number;
|
|
1295
1300
|
getNumOutputs(): number;
|
|
1296
1301
|
compute(inputs: Float32Array[], outputs: Float32Array[]): boolean;
|
|
@@ -1318,7 +1323,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
|
|
|
1318
1323
|
*/
|
|
1319
1324
|
export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<false> implements IFaustMonoWebAudioDsp {
|
|
1320
1325
|
onprocessorerror: (e: Event) => never;
|
|
1321
|
-
constructor(context: BaseAudioContext,
|
|
1326
|
+
constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<false>> & Pick<FaustAudioWorkletNodeOptions<false>, "processorOptions">);
|
|
1322
1327
|
}
|
|
1323
1328
|
/**
|
|
1324
1329
|
* Polyphonic AudioWorkletNode
|
|
@@ -1326,7 +1331,7 @@ export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<fal
|
|
|
1326
1331
|
export declare class FaustPolyAudioWorkletNode extends FaustAudioWorkletNode<true> implements IFaustPolyWebAudioDsp {
|
|
1327
1332
|
private fJSONEffect;
|
|
1328
1333
|
onprocessorerror: (e: Event) => never;
|
|
1329
|
-
constructor(context: BaseAudioContext,
|
|
1334
|
+
constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<true>> & Pick<FaustAudioWorkletNodeOptions<true>, "processorOptions">);
|
|
1330
1335
|
keyOn(channel: number, pitch: number, velocity: number): void;
|
|
1331
1336
|
keyOff(channel: number, pitch: number, velocity: number): void;
|
|
1332
1337
|
allNotesOff(hard: boolean): void;
|
|
@@ -1419,9 +1424,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1419
1424
|
* @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
|
|
1420
1425
|
* @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
|
|
1421
1426
|
* @param processorName - AudioWorklet Processor name
|
|
1427
|
+
* @param processorOptions - Additional AudioWorklet Processor options
|
|
1422
1428
|
* @returns the compiled WebAudio node or 'null' if failure
|
|
1423
1429
|
*/
|
|
1424
|
-
createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string): Promise<IFaustMonoWebAudioNode | null>;
|
|
1430
|
+
createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<IFaustMonoWebAudioNode | null>;
|
|
1425
1431
|
/**
|
|
1426
1432
|
* Create a monophonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
|
|
1427
1433
|
*
|
|
@@ -1431,9 +1437,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1431
1437
|
* @param factory - default is the compiled factory
|
|
1432
1438
|
* @param fftOptions - initial FFT options
|
|
1433
1439
|
* @param processorName - AudioWorklet Processor name
|
|
1440
|
+
* @param processorOptions - Additional AudioWorklet Processor options
|
|
1434
1441
|
* @returns the compiled WebAudio node or 'null' if failure
|
|
1435
1442
|
*/
|
|
1436
|
-
createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string): Promise<FaustMonoAudioWorkletNode | null>;
|
|
1443
|
+
createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
|
|
1437
1444
|
/**
|
|
1438
1445
|
* Create a monophonic Offline processor.
|
|
1439
1446
|
*
|
|
@@ -1489,9 +1496,10 @@ export interface IFaustPolyDspGenerator extends GeneratorSupportingSoundfiles {
|
|
|
1489
1496
|
* @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
|
|
1490
1497
|
* @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
|
|
1491
1498
|
* @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
|
|
1499
|
+
* @param processorOptions - Additional AudioWorklet Processor options
|
|
1492
1500
|
* @returns the compiled WebAudio node or 'null' if failure
|
|
1493
1501
|
*/
|
|
1494
|
-
createNode(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: boolean, bufferSize?: number, processorName?: string): Promise<IFaustPolyWebAudioNode | null>;
|
|
1502
|
+
createNode(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: boolean, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<IFaustPolyWebAudioNode | null>;
|
|
1495
1503
|
/**
|
|
1496
1504
|
* Create a monophonic Offline processor.
|
|
1497
1505
|
*
|
|
@@ -1531,8 +1539,8 @@ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
|
|
|
1531
1539
|
compile(compiler: IFaustCompiler, name: string, code: string, args: string): Promise<this | null>;
|
|
1532
1540
|
addSoundfiles(soundfileMap: Record<string, AudioData>): void;
|
|
1533
1541
|
getSoundfileList(): string[];
|
|
1534
|
-
createNode<SP extends boolean = false>(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: SP, bufferSize?: number, processorName?: string): Promise<SP extends true ? FaustMonoScriptProcessorNode | null : FaustMonoAudioWorkletNode | null>;
|
|
1535
|
-
createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string): Promise<FaustMonoAudioWorkletNode | null>;
|
|
1542
|
+
createNode<SP extends boolean = false>(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: SP, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<SP extends true ? FaustMonoScriptProcessorNode | null : FaustMonoAudioWorkletNode | null>;
|
|
1543
|
+
createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
|
|
1536
1544
|
createAudioWorkletProcessor(name?: string, factory?: LooseFaustDspFactory, processorName?: string): Promise<{
|
|
1537
1545
|
new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
|
|
1538
1546
|
prototype: AudioWorkletProcessor;
|
|
@@ -1554,7 +1562,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1554
1562
|
compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCodeAux?: string): Promise<this | null>;
|
|
1555
1563
|
addSoundfiles(soundfileMap: Record<string, AudioData>): void;
|
|
1556
1564
|
getSoundfileList(): string[];
|
|
1557
|
-
createNode<SP extends boolean = false>(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: SP, bufferSize?: number, processorName?: string): Promise<SP extends true ? FaustPolyScriptProcessorNode | null : FaustPolyAudioWorkletNode | null>;
|
|
1565
|
+
createNode<SP extends boolean = false>(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: SP, bufferSize?: number, processorName?: string, processorOptions?: {}): Promise<SP extends true ? FaustPolyScriptProcessorNode | null : FaustPolyAudioWorkletNode | null>;
|
|
1558
1566
|
createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
|
|
1559
1567
|
new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
|
|
1560
1568
|
prototype: AudioWorkletProcessor;
|
|
@@ -111,6 +111,10 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
|
|
|
111
111
|
parameterDescriptors.forEach((pd) => {
|
|
112
112
|
this.paramValuesCache[pd.name] = pd.defaultValue || 0;
|
|
113
113
|
});
|
|
114
|
+
const { moduleId, instanceId } = options.processorOptions;
|
|
115
|
+
if (!moduleId || !instanceId)
|
|
116
|
+
return;
|
|
117
|
+
this.wamInfo = { moduleId, instanceId };
|
|
114
118
|
}
|
|
115
119
|
static get parameterDescriptors() {
|
|
116
120
|
const params = [];
|
|
@@ -124,6 +128,23 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
|
|
|
124
128
|
FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
|
|
125
129
|
return params;
|
|
126
130
|
}
|
|
131
|
+
setupWamEventHandler() {
|
|
132
|
+
var _a;
|
|
133
|
+
if (!this.wamInfo)
|
|
134
|
+
return;
|
|
135
|
+
const { moduleId, instanceId } = this.wamInfo;
|
|
136
|
+
const { webAudioModules } = globalThis;
|
|
137
|
+
const ModuleScope = webAudioModules.getModuleScope(moduleId);
|
|
138
|
+
const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
|
|
139
|
+
if (!paramMgrProcessor)
|
|
140
|
+
return;
|
|
141
|
+
if (paramMgrProcessor.handleEvent)
|
|
142
|
+
return;
|
|
143
|
+
paramMgrProcessor.handleEvent = (event) => {
|
|
144
|
+
if (event.type === "wam-midi")
|
|
145
|
+
this.midiMessage(event.data.bytes);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
127
148
|
process(inputs, outputs, parameters) {
|
|
128
149
|
for (const path in parameters) {
|
|
129
150
|
const [paramValue] = parameters[path];
|
|
@@ -169,6 +190,10 @@ var getFaustAudioWorkletProcessor = (dependencies, faustData, register = true) =
|
|
|
169
190
|
}
|
|
170
191
|
break;
|
|
171
192
|
}
|
|
193
|
+
case "setupWamEventHandler": {
|
|
194
|
+
this.setupWamEventHandler();
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
172
197
|
case "start": {
|
|
173
198
|
this.fDSPCode.start();
|
|
174
199
|
break;
|
|
@@ -378,6 +403,10 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
|
|
|
378
403
|
this.sampleSize = sampleSize;
|
|
379
404
|
this.soundfiles = factory.soundfiles;
|
|
380
405
|
this.initFFT();
|
|
406
|
+
const { moduleId, instanceId } = options.processorOptions;
|
|
407
|
+
if (!moduleId || !instanceId)
|
|
408
|
+
return;
|
|
409
|
+
this.wamInfo = { moduleId, instanceId };
|
|
381
410
|
}
|
|
382
411
|
get fftProcessorBufferSize() {
|
|
383
412
|
return this.fftSize / 2 + 1;
|
|
@@ -423,6 +452,23 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
|
|
|
423
452
|
}
|
|
424
453
|
];
|
|
425
454
|
}
|
|
455
|
+
setupWamEventHandler() {
|
|
456
|
+
var _a;
|
|
457
|
+
if (!this.wamInfo)
|
|
458
|
+
return;
|
|
459
|
+
const { moduleId, instanceId } = this.wamInfo;
|
|
460
|
+
const { webAudioModules } = globalThis;
|
|
461
|
+
const ModuleScope = webAudioModules.getModuleScope(moduleId);
|
|
462
|
+
const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
|
|
463
|
+
if (!paramMgrProcessor)
|
|
464
|
+
return;
|
|
465
|
+
if (paramMgrProcessor.handleEvent)
|
|
466
|
+
return;
|
|
467
|
+
paramMgrProcessor.handleEvent = (event) => {
|
|
468
|
+
if (event.type === "wam-midi")
|
|
469
|
+
this.midiMessage(event.data.bytes);
|
|
470
|
+
};
|
|
471
|
+
}
|
|
426
472
|
processFFT() {
|
|
427
473
|
let samplesForFFT = mod(this.$inputWrite - this.$inputRead, this.fftBufferSize) || this.fftBufferSize;
|
|
428
474
|
while (samplesForFFT >= this.fftSize) {
|
|
@@ -560,6 +606,10 @@ var getFaustFFTAudioWorkletProcessor = (dependencies, faustData, register = true
|
|
|
560
606
|
(_a = this.fDSPCode) == null ? void 0 : _a.setPlotHandler(this.fPlotHandler);
|
|
561
607
|
break;
|
|
562
608
|
}
|
|
609
|
+
case "setupWamEventHandler": {
|
|
610
|
+
this.setupWamEventHandler();
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
563
613
|
case "start": {
|
|
564
614
|
(_b = this.fDSPCode) == null ? void 0 : _b.start();
|
|
565
615
|
break;
|
|
@@ -3619,7 +3669,7 @@ var SoundfileReader_default = SoundfileReader;
|
|
|
3619
3669
|
// src/FaustAudioWorkletNode.ts
|
|
3620
3670
|
var _hasAccInput, _hasGyrInput;
|
|
3621
3671
|
var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null) {
|
|
3622
|
-
constructor(context, name, factory, options
|
|
3672
|
+
constructor(context, name, factory, options = {}) {
|
|
3623
3673
|
const JSONObj = JSON.parse(factory.json);
|
|
3624
3674
|
super(context, name, {
|
|
3625
3675
|
numberOfInputs: JSONObj.inputs > 0 ? 1 : 0,
|
|
@@ -3628,8 +3678,8 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
3628
3678
|
outputChannelCount: [JSONObj.outputs],
|
|
3629
3679
|
channelCountMode: "explicit",
|
|
3630
3680
|
channelInterpretation: "speakers",
|
|
3631
|
-
processorOptions: options,
|
|
3632
|
-
...
|
|
3681
|
+
processorOptions: options.processorOptions,
|
|
3682
|
+
...options
|
|
3633
3683
|
});
|
|
3634
3684
|
__privateAdd(this, _hasAccInput, false);
|
|
3635
3685
|
__privateAdd(this, _hasGyrInput, false);
|
|
@@ -3747,6 +3797,9 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
3747
3797
|
getPlotHandler() {
|
|
3748
3798
|
return this.fPlotHandler;
|
|
3749
3799
|
}
|
|
3800
|
+
setupWamEventHandler() {
|
|
3801
|
+
this.port.postMessage({ type: "setupWamEventHandler" });
|
|
3802
|
+
}
|
|
3750
3803
|
getNumInputs() {
|
|
3751
3804
|
return this.fJSONDsp.inputs;
|
|
3752
3805
|
}
|
|
@@ -3840,33 +3893,25 @@ var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null)
|
|
|
3840
3893
|
_hasAccInput = new WeakMap();
|
|
3841
3894
|
_hasGyrInput = new WeakMap();
|
|
3842
3895
|
var FaustMonoAudioWorkletNode = class extends FaustAudioWorkletNode {
|
|
3843
|
-
constructor(context,
|
|
3844
|
-
super(context, name, factory,
|
|
3896
|
+
constructor(context, options) {
|
|
3897
|
+
super(context, options.processorOptions.name, options.processorOptions.factory, options);
|
|
3845
3898
|
this.onprocessorerror = (e) => {
|
|
3846
3899
|
throw e;
|
|
3847
3900
|
};
|
|
3848
3901
|
}
|
|
3849
3902
|
};
|
|
3850
3903
|
var FaustPolyAudioWorkletNode = class extends FaustAudioWorkletNode {
|
|
3851
|
-
constructor(context,
|
|
3904
|
+
constructor(context, options) {
|
|
3852
3905
|
super(
|
|
3853
3906
|
context,
|
|
3854
|
-
name,
|
|
3855
|
-
voiceFactory,
|
|
3856
|
-
|
|
3857
|
-
name,
|
|
3858
|
-
voiceFactory,
|
|
3859
|
-
mixerModule,
|
|
3860
|
-
voices,
|
|
3861
|
-
sampleSize,
|
|
3862
|
-
effectFactory
|
|
3863
|
-
},
|
|
3864
|
-
nodeOptions
|
|
3907
|
+
options.processorOptions.name,
|
|
3908
|
+
options.processorOptions.voiceFactory,
|
|
3909
|
+
options
|
|
3865
3910
|
);
|
|
3866
3911
|
this.onprocessorerror = (e) => {
|
|
3867
3912
|
throw e;
|
|
3868
3913
|
};
|
|
3869
|
-
this.fJSONEffect = effectFactory ? JSON.parse(effectFactory.json) : null;
|
|
3914
|
+
this.fJSONEffect = options.processorOptions.effectFactory ? JSON.parse(options.processorOptions.effectFactory.json) : null;
|
|
3870
3915
|
if (this.fJSONEffect) {
|
|
3871
3916
|
FaustBaseWebAudioDsp.parseUI(this.fJSONEffect.ui, this.fUICallback);
|
|
3872
3917
|
}
|
|
@@ -4116,7 +4161,7 @@ var _FaustMonoDspGenerator = class _FaustMonoDspGenerator {
|
|
|
4116
4161
|
const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
|
|
4117
4162
|
return Object.keys(map);
|
|
4118
4163
|
}
|
|
4119
|
-
async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name) {
|
|
4164
|
+
async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
|
|
4120
4165
|
var _a, _b;
|
|
4121
4166
|
if (!factory)
|
|
4122
4167
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
@@ -4174,11 +4219,11 @@ const dependencies = {
|
|
|
4174
4219
|
throw e;
|
|
4175
4220
|
}
|
|
4176
4221
|
}
|
|
4177
|
-
const node = new FaustMonoAudioWorkletNode(context, processorName, factory, sampleSize);
|
|
4222
|
+
const node = new FaustMonoAudioWorkletNode(context, { processorOptions: { name: processorName, factory, sampleSize, ...processorOptions } });
|
|
4178
4223
|
return node;
|
|
4179
4224
|
}
|
|
4180
4225
|
}
|
|
4181
|
-
async createFFTNode(context, fftUtils, name = this.name, factory = this.factory, fftOptions = {}, processorName = (factory == null ? void 0 : factory.shaKey) ? `${factory.shaKey}_fft` : name) {
|
|
4226
|
+
async createFFTNode(context, fftUtils, name = this.name, factory = this.factory, fftOptions = {}, processorName = (factory == null ? void 0 : factory.shaKey) ? `${factory.shaKey}_fft` : name, processorOptions = {}) {
|
|
4182
4227
|
var _a, _b;
|
|
4183
4228
|
if (!factory)
|
|
4184
4229
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
@@ -4230,7 +4275,7 @@ const dependencies = {
|
|
|
4230
4275
|
throw e;
|
|
4231
4276
|
}
|
|
4232
4277
|
}
|
|
4233
|
-
const node = new FaustMonoAudioWorkletNode(context,
|
|
4278
|
+
const node = new FaustMonoAudioWorkletNode(context, { channelCount: Math.max(1, Math.ceil(meta.inputs / 3)), outputChannelCount: [Math.ceil(meta.outputs / 2)], processorOptions: { name: processorName, factory, sampleSize, ...processorOptions } });
|
|
4234
4279
|
if (fftOptions.fftSize) {
|
|
4235
4280
|
const param = node.parameters.get("fftSize");
|
|
4236
4281
|
if (param)
|
|
@@ -4392,7 +4437,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
|
|
|
4392
4437
|
const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);
|
|
4393
4438
|
return Object.keys({ ...effectMap, ...map });
|
|
4394
4439
|
}
|
|
4395
|
-
async createNode(context, voices, name = this.name, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, sp = false, bufferSize = 1024, processorName = ((voiceFactory == null ? void 0 : voiceFactory.shaKey) || "") + ((effectFactory == null ? void 0 : effectFactory.shaKey) || "") || `${name}_poly
|
|
4440
|
+
async createNode(context, voices, name = this.name, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, sp = false, bufferSize = 1024, processorName = ((voiceFactory == null ? void 0 : voiceFactory.shaKey) || "") + ((effectFactory == null ? void 0 : effectFactory.shaKey) || "") || `${name}_poly`, processorOptions = {}) {
|
|
4396
4441
|
var _a, _b;
|
|
4397
4442
|
if (!voiceFactory)
|
|
4398
4443
|
throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
|
|
@@ -4457,7 +4502,7 @@ const dependencies = {
|
|
|
4457
4502
|
throw e;
|
|
4458
4503
|
}
|
|
4459
4504
|
}
|
|
4460
|
-
const node = new FaustPolyAudioWorkletNode(context, processorName, voiceFactory, mixerModule, voices, sampleSize, effectFactory || void 0);
|
|
4505
|
+
const node = new FaustPolyAudioWorkletNode(context, { processorOptions: { name: processorName, voiceFactory, mixerModule, voices, sampleSize, effectFactory: effectFactory || void 0, ...processorOptions } });
|
|
4461
4506
|
return node;
|
|
4462
4507
|
}
|
|
4463
4508
|
}
|