@grame/faustwasm 0.4.5 → 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.
Files changed (34) hide show
  1. package/COPYING.txt +520 -0
  2. package/assets/standalone/faust-ui/index.css +8 -0
  3. package/assets/standalone/faust-ui/index.css.map +1 -1
  4. package/assets/standalone/faust-ui/index.js +56 -30
  5. package/assets/standalone/faust-ui/index.js.map +1 -1
  6. package/assets/standalone/faustwasm/index.d.ts +18 -10
  7. package/assets/standalone/faustwasm/index.js +69 -24
  8. package/assets/standalone/faustwasm/index.js.map +2 -2
  9. package/dist/cjs/index.d.ts +18 -10
  10. package/dist/cjs/index.js +69 -24
  11. package/dist/cjs/index.js.map +2 -2
  12. package/dist/cjs-bundle/index.d.ts +18 -10
  13. package/dist/cjs-bundle/index.js +69 -24
  14. package/dist/cjs-bundle/index.js.map +2 -2
  15. package/dist/esm/index.d.ts +18 -10
  16. package/dist/esm/index.js +69 -24
  17. package/dist/esm/index.js.map +2 -2
  18. package/dist/esm-bundle/index.d.ts +18 -10
  19. package/dist/esm-bundle/index.js +69 -24
  20. package/dist/esm-bundle/index.js.map +2 -2
  21. package/node +0 -0
  22. package/package.json +4 -2
  23. package/src/FaustAudioWorkletNode.ts +13 -24
  24. package/src/FaustAudioWorkletProcessor.ts +28 -1
  25. package/src/FaustDspGenerator.ts +18 -9
  26. package/src/FaustFFTAudioWorkletProcessor.ts +27 -0
  27. package/src/instantiateFaustModule.js +82 -0
  28. package/test/faustlive-wasm/faust-ui/index.css +8 -0
  29. package/test/faustlive-wasm/faust-ui/index.css.map +1 -1
  30. package/test/faustlive-wasm/faust-ui/index.js +56 -30
  31. package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
  32. package/test/faustlive-wasm/faustwasm/index.d.ts +18 -10
  33. package/test/faustlive-wasm/faustwasm/index.js +69 -24
  34. package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
@@ -894,6 +894,8 @@ export interface FaustPolyAudioWorkletNodeOptions extends AudioWorkletNodeOption
894
894
  export interface FaustAudioWorkletProcessorOptions {
895
895
  name: string;
896
896
  sampleSize: number;
897
+ moduleId?: string;
898
+ instanceId?: string;
897
899
  }
898
900
  export interface FaustMonoAudioWorkletProcessorOptions extends FaustAudioWorkletProcessorOptions {
899
901
  factory: LooseFaustDspFactory;
@@ -938,6 +940,8 @@ export interface FaustFFTAudioWorkletProcessorOptions {
938
940
  name: string;
939
941
  sampleSize: number;
940
942
  factory: LooseFaustDspFactory;
943
+ moduleId?: string;
944
+ instanceId?: string;
941
945
  }
942
946
  export declare const getFaustFFTAudioWorkletProcessor: (dependencies: FaustFFTAudioWorkletProcessorDependencies, faustData: FaustFFTData, register?: boolean) => {
943
947
  new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
@@ -1273,7 +1277,7 @@ export declare class SoundfileReader {
1273
1277
  static loadSoundfiles(dspMeta: FaustDspMeta, soundfilesIn: LooseFaustDspFactory["soundfiles"], audioCtx: BaseAudioContext): Promise<LooseFaustDspFactory["soundfiles"]>;
1274
1278
  }
1275
1279
  declare const FaustAudioWorkletNode_base: {
1276
- new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions | undefined): AudioWorkletNode;
1280
+ new (context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
1277
1281
  prototype: AudioWorkletNode;
1278
1282
  };
1279
1283
  /**
@@ -1289,7 +1293,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1289
1293
  protected fPlotHandler: PlotHandler | null;
1290
1294
  protected fUICallback: UIHandler;
1291
1295
  protected fDescriptor: FaustUIInputItem[];
1292
- constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options: FaustAudioWorkletNodeOptions<Poly>["processorOptions"], nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1296
+ constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options?: Partial<FaustAudioWorkletNodeOptions<Poly>>);
1293
1297
  /** Setup accelerometer and gyroscope handlers */
1294
1298
  listenSensors(): Promise<void>;
1295
1299
  setOutputParamHandler(handler: OutputParamHandler | null): void;
@@ -1298,6 +1302,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1298
1302
  getComputeHandler(): ComputeHandler | null;
1299
1303
  setPlotHandler(handler: PlotHandler | null): void;
1300
1304
  getPlotHandler(): PlotHandler | null;
1305
+ setupWamEventHandler(): void;
1301
1306
  getNumInputs(): number;
1302
1307
  getNumOutputs(): number;
1303
1308
  compute(inputs: Float32Array[], outputs: Float32Array[]): boolean;
@@ -1325,7 +1330,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1325
1330
  */
1326
1331
  export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<false> implements IFaustMonoWebAudioDsp {
1327
1332
  onprocessorerror: (e: Event) => never;
1328
- constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, sampleSize: number, nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1333
+ constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<false>> & Pick<FaustAudioWorkletNodeOptions<false>, "processorOptions">);
1329
1334
  }
1330
1335
  /**
1331
1336
  * Polyphonic AudioWorkletNode
@@ -1333,7 +1338,7 @@ export declare class FaustMonoAudioWorkletNode extends FaustAudioWorkletNode<fal
1333
1338
  export declare class FaustPolyAudioWorkletNode extends FaustAudioWorkletNode<true> implements IFaustPolyWebAudioDsp {
1334
1339
  private fJSONEffect;
1335
1340
  onprocessorerror: (e: Event) => never;
1336
- constructor(context: BaseAudioContext, name: string, voiceFactory: LooseFaustDspFactory, mixerModule: WebAssembly.Module, voices: number, sampleSize: number, effectFactory?: LooseFaustDspFactory, nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1341
+ constructor(context: BaseAudioContext, options: Partial<FaustAudioWorkletNodeOptions<true>> & Pick<FaustAudioWorkletNodeOptions<true>, "processorOptions">);
1337
1342
  keyOn(channel: number, pitch: number, velocity: number): void;
1338
1343
  keyOff(channel: number, pitch: number, velocity: number): void;
1339
1344
  allNotesOff(hard: boolean): void;
@@ -1426,9 +1431,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
1426
1431
  * @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
1427
1432
  * @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
1428
1433
  * @param processorName - AudioWorklet Processor name
1434
+ * @param processorOptions - Additional AudioWorklet Processor options
1429
1435
  * @returns the compiled WebAudio node or 'null' if failure
1430
1436
  */
1431
- createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string): Promise<IFaustMonoWebAudioNode | null>;
1437
+ createNode(context: BaseAudioContext, name?: string, factory?: LooseFaustDspFactory, sp?: boolean, bufferSize?: number, processorName?: string, processorOptions?: Record<string, any>): Promise<IFaustMonoWebAudioNode | null>;
1432
1438
  /**
1433
1439
  * Create a monophonic WebAudio node (either ScriptProcessorNode or AudioWorkletNode).
1434
1440
  *
@@ -1438,9 +1444,10 @@ export interface IFaustMonoDspGenerator extends GeneratorSupportingSoundfiles {
1438
1444
  * @param factory - default is the compiled factory
1439
1445
  * @param fftOptions - initial FFT options
1440
1446
  * @param processorName - AudioWorklet Processor name
1447
+ * @param processorOptions - Additional AudioWorklet Processor options
1441
1448
  * @returns the compiled WebAudio node or 'null' if failure
1442
1449
  */
1443
- createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string): Promise<FaustMonoAudioWorkletNode | null>;
1450
+ createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
1444
1451
  /**
1445
1452
  * Create a monophonic Offline processor.
1446
1453
  *
@@ -1496,9 +1503,10 @@ export interface IFaustPolyDspGenerator extends GeneratorSupportingSoundfiles {
1496
1503
  * @param effectFactory - the Faust factory for the effect, either obtained with a compiler (createDSPFactory) or loaded from files (loadDSPFactory)
1497
1504
  * @param sp - whether to compile a ScriptProcessorNode or an AudioWorkletNode
1498
1505
  * @param bufferSize - the buffer size in frames to be used in ScriptProcessorNode only, since AudioWorkletNode always uses 128 frames
1506
+ * @param processorOptions - Additional AudioWorklet Processor options
1499
1507
  * @returns the compiled WebAudio node or 'null' if failure
1500
1508
  */
1501
- createNode(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: boolean, bufferSize?: number, processorName?: string): Promise<IFaustPolyWebAudioNode | null>;
1509
+ 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>;
1502
1510
  /**
1503
1511
  * Create a monophonic Offline processor.
1504
1512
  *
@@ -1538,8 +1546,8 @@ export declare class FaustMonoDspGenerator implements IFaustMonoDspGenerator {
1538
1546
  compile(compiler: IFaustCompiler, name: string, code: string, args: string): Promise<this | null>;
1539
1547
  addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1540
1548
  getSoundfileList(): string[];
1541
- 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>;
1542
- createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string): Promise<FaustMonoAudioWorkletNode | null>;
1549
+ 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>;
1550
+ createFFTNode(context: BaseAudioContext, fftUtils: typeof FFTUtils, name?: string, factory?: LooseFaustDspFactory, fftOptions?: Partial<FaustFFTOptionsData>, processorName?: string, processorOptions?: Record<string, any>): Promise<FaustMonoAudioWorkletNode | null>;
1543
1551
  createAudioWorkletProcessor(name?: string, factory?: LooseFaustDspFactory, processorName?: string): Promise<{
1544
1552
  new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
1545
1553
  prototype: AudioWorkletProcessor;
@@ -1561,7 +1569,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
1561
1569
  compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCodeAux?: string): Promise<this | null>;
1562
1570
  addSoundfiles(soundfileMap: Record<string, AudioData>): void;
1563
1571
  getSoundfileList(): string[];
1564
- 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>;
1572
+ 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>;
1565
1573
  createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
1566
1574
  new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
1567
1575
  prototype: AudioWorkletProcessor;
@@ -6158,6 +6158,10 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6158
6158
  parameterDescriptors.forEach((pd) => {
6159
6159
  this.paramValuesCache[pd.name] = pd.defaultValue || 0;
6160
6160
  });
6161
+ const { moduleId, instanceId } = options.processorOptions;
6162
+ if (!moduleId || !instanceId)
6163
+ return;
6164
+ this.wamInfo = { moduleId, instanceId };
6161
6165
  }
6162
6166
  static get parameterDescriptors() {
6163
6167
  const params = [];
@@ -6171,6 +6175,23 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6171
6175
  FaustBaseWebAudioDsp2.parseUI(effectMeta.ui, callback);
6172
6176
  return params;
6173
6177
  }
6178
+ setupWamEventHandler() {
6179
+ var _a;
6180
+ if (!this.wamInfo)
6181
+ return;
6182
+ const { moduleId, instanceId } = this.wamInfo;
6183
+ const { webAudioModules } = globalThis;
6184
+ const ModuleScope = webAudioModules.getModuleScope(moduleId);
6185
+ const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
6186
+ if (!paramMgrProcessor)
6187
+ return;
6188
+ if (paramMgrProcessor.handleEvent)
6189
+ return;
6190
+ paramMgrProcessor.handleEvent = (event) => {
6191
+ if (event.type === "wam-midi")
6192
+ this.midiMessage(event.data.bytes);
6193
+ };
6194
+ }
6174
6195
  process(inputs, outputs, parameters) {
6175
6196
  for (const path in parameters) {
6176
6197
  const [paramValue] = parameters[path];
@@ -6216,6 +6237,10 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6216
6237
  }
6217
6238
  break;
6218
6239
  }
6240
+ case "setupWamEventHandler": {
6241
+ this.setupWamEventHandler();
6242
+ break;
6243
+ }
6219
6244
  case "start": {
6220
6245
  this.fDSPCode.start();
6221
6246
  break;
@@ -6425,6 +6450,10 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6425
6450
  this.sampleSize = sampleSize;
6426
6451
  this.soundfiles = factory.soundfiles;
6427
6452
  this.initFFT();
6453
+ const { moduleId, instanceId } = options.processorOptions;
6454
+ if (!moduleId || !instanceId)
6455
+ return;
6456
+ this.wamInfo = { moduleId, instanceId };
6428
6457
  }
6429
6458
  get fftProcessorBufferSize() {
6430
6459
  return this.fftSize / 2 + 1;
@@ -6470,6 +6499,23 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6470
6499
  }
6471
6500
  ];
6472
6501
  }
6502
+ setupWamEventHandler() {
6503
+ var _a;
6504
+ if (!this.wamInfo)
6505
+ return;
6506
+ const { moduleId, instanceId } = this.wamInfo;
6507
+ const { webAudioModules } = globalThis;
6508
+ const ModuleScope = webAudioModules.getModuleScope(moduleId);
6509
+ const paramMgrProcessor = (_a = ModuleScope == null ? void 0 : ModuleScope.paramMgrProcessors) == null ? void 0 : _a[instanceId];
6510
+ if (!paramMgrProcessor)
6511
+ return;
6512
+ if (paramMgrProcessor.handleEvent)
6513
+ return;
6514
+ paramMgrProcessor.handleEvent = (event) => {
6515
+ if (event.type === "wam-midi")
6516
+ this.midiMessage(event.data.bytes);
6517
+ };
6518
+ }
6473
6519
  processFFT() {
6474
6520
  let samplesForFFT = mod(this.$inputWrite - this.$inputRead, this.fftBufferSize) || this.fftBufferSize;
6475
6521
  while (samplesForFFT >= this.fftSize) {
@@ -6607,6 +6653,10 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
6607
6653
  (_a = this.fDSPCode) == null ? void 0 : _a.setPlotHandler(this.fPlotHandler);
6608
6654
  break;
6609
6655
  }
6656
+ case "setupWamEventHandler": {
6657
+ this.setupWamEventHandler();
6658
+ break;
6659
+ }
6610
6660
  case "start": {
6611
6661
  (_b = this.fDSPCode) == null ? void 0 : _b.start();
6612
6662
  break;
@@ -9666,7 +9716,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9666
9716
  // src/FaustAudioWorkletNode.ts
9667
9717
  var _hasAccInput, _hasGyrInput;
9668
9718
  var FaustAudioWorkletNode = class extends (globalThis.AudioWorkletNode || null) {
9669
- constructor(context, name, factory, options, nodeOptions = {}) {
9719
+ constructor(context, name, factory, options = {}) {
9670
9720
  const JSONObj = JSON.parse(factory.json);
9671
9721
  super(context, name, {
9672
9722
  numberOfInputs: JSONObj.inputs > 0 ? 1 : 0,
@@ -9675,8 +9725,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9675
9725
  outputChannelCount: [JSONObj.outputs],
9676
9726
  channelCountMode: "explicit",
9677
9727
  channelInterpretation: "speakers",
9678
- processorOptions: options,
9679
- ...nodeOptions
9728
+ processorOptions: options.processorOptions,
9729
+ ...options
9680
9730
  });
9681
9731
  __privateAdd(this, _hasAccInput, false);
9682
9732
  __privateAdd(this, _hasGyrInput, false);
@@ -9794,6 +9844,9 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9794
9844
  getPlotHandler() {
9795
9845
  return this.fPlotHandler;
9796
9846
  }
9847
+ setupWamEventHandler() {
9848
+ this.port.postMessage({ type: "setupWamEventHandler" });
9849
+ }
9797
9850
  getNumInputs() {
9798
9851
  return this.fJSONDsp.inputs;
9799
9852
  }
@@ -9887,33 +9940,25 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
9887
9940
  _hasAccInput = new WeakMap();
9888
9941
  _hasGyrInput = new WeakMap();
9889
9942
  var FaustMonoAudioWorkletNode = class extends FaustAudioWorkletNode {
9890
- constructor(context, name, factory, sampleSize, nodeOptions = {}) {
9891
- super(context, name, factory, { name, factory, sampleSize }, nodeOptions);
9943
+ constructor(context, options) {
9944
+ super(context, options.processorOptions.name, options.processorOptions.factory, options);
9892
9945
  this.onprocessorerror = (e) => {
9893
9946
  throw e;
9894
9947
  };
9895
9948
  }
9896
9949
  };
9897
9950
  var FaustPolyAudioWorkletNode = class extends FaustAudioWorkletNode {
9898
- constructor(context, name, voiceFactory, mixerModule, voices, sampleSize, effectFactory, nodeOptions = {}) {
9951
+ constructor(context, options) {
9899
9952
  super(
9900
9953
  context,
9901
- name,
9902
- voiceFactory,
9903
- {
9904
- name,
9905
- voiceFactory,
9906
- mixerModule,
9907
- voices,
9908
- sampleSize,
9909
- effectFactory
9910
- },
9911
- nodeOptions
9954
+ options.processorOptions.name,
9955
+ options.processorOptions.voiceFactory,
9956
+ options
9912
9957
  );
9913
9958
  this.onprocessorerror = (e) => {
9914
9959
  throw e;
9915
9960
  };
9916
- this.fJSONEffect = effectFactory ? JSON.parse(effectFactory.json) : null;
9961
+ this.fJSONEffect = options.processorOptions.effectFactory ? JSON.parse(options.processorOptions.effectFactory.json) : null;
9917
9962
  if (this.fJSONEffect) {
9918
9963
  FaustBaseWebAudioDsp.parseUI(this.fJSONEffect.ui, this.fUICallback);
9919
9964
  }
@@ -10163,7 +10208,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
10163
10208
  const map = SoundfileReader_default.findSoundfilesFromMeta(meta);
10164
10209
  return Object.keys(map);
10165
10210
  }
10166
- async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name) {
10211
+ async createNode(context, name = this.name, factory = this.factory, sp = false, bufferSize = 1024, processorName = (factory == null ? void 0 : factory.shaKey) || name, processorOptions = {}) {
10167
10212
  var _a, _b;
10168
10213
  if (!factory)
10169
10214
  throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
@@ -10221,11 +10266,11 @@ const dependencies = {
10221
10266
  throw e;
10222
10267
  }
10223
10268
  }
10224
- const node = new FaustMonoAudioWorkletNode(context, processorName, factory, sampleSize);
10269
+ const node = new FaustMonoAudioWorkletNode(context, { processorOptions: { name: processorName, factory, sampleSize, ...processorOptions } });
10225
10270
  return node;
10226
10271
  }
10227
10272
  }
10228
- async createFFTNode(context, fftUtils, name = this.name, factory = this.factory, fftOptions = {}, processorName = (factory == null ? void 0 : factory.shaKey) ? `${factory.shaKey}_fft` : name) {
10273
+ async createFFTNode(context, fftUtils, name = this.name, factory = this.factory, fftOptions = {}, processorName = (factory == null ? void 0 : factory.shaKey) ? `${factory.shaKey}_fft` : name, processorOptions = {}) {
10229
10274
  var _a, _b;
10230
10275
  if (!factory)
10231
10276
  throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
@@ -10277,7 +10322,7 @@ const dependencies = {
10277
10322
  throw e;
10278
10323
  }
10279
10324
  }
10280
- const node = new FaustMonoAudioWorkletNode(context, processorName, factory, sampleSize, { channelCount: Math.max(1, Math.ceil(meta.inputs / 3)), outputChannelCount: [Math.ceil(meta.outputs / 2)] });
10325
+ 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 } });
10281
10326
  if (fftOptions.fftSize) {
10282
10327
  const param = node.parameters.get("fftSize");
10283
10328
  if (param)
@@ -10439,7 +10484,7 @@ process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;
10439
10484
  const effectMap = SoundfileReader_default.findSoundfilesFromMeta(effectMeta);
10440
10485
  return Object.keys({ ...effectMap, ...map });
10441
10486
  }
10442
- 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`) {
10487
+ 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 = {}) {
10443
10488
  var _a, _b;
10444
10489
  if (!voiceFactory)
10445
10490
  throw new Error("Code is not compiled, please define the factory or call `await this.compile()` first.");
@@ -10504,7 +10549,7 @@ const dependencies = {
10504
10549
  throw e;
10505
10550
  }
10506
10551
  }
10507
- const node = new FaustPolyAudioWorkletNode(context, processorName, voiceFactory, mixerModule, voices, sampleSize, effectFactory || void 0);
10552
+ const node = new FaustPolyAudioWorkletNode(context, { processorOptions: { name: processorName, voiceFactory, mixerModule, voices, sampleSize, effectFactory: effectFactory || void 0, ...processorOptions } });
10508
10553
  return node;
10509
10554
  }
10510
10555
  }