@grame/faustwasm 0.0.52 → 0.0.54

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grame/faustwasm",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -397,15 +397,21 @@ export class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
397
397
  name: string,
398
398
  dspCode: string,
399
399
  args: string,
400
+ // The ${dspCode} has to be added with wrapping new lines to make is properly formatted and compile
400
401
  effectCode = `
401
- adapt(1,1) = _; adapt(2,2) = _,_; adapt(1,2) = _ <: _,_; adapt(2,1) = _,_ :> _;
402
- adaptor(F,G) = adapt(outputs(F),inputs(G));
403
- dsp_code = environment{${dspCode}};
404
- process = adaptor(dsp_code.process, dsp_code.effect) : dsp_code.effect;`
402
+ adapt(1,1) = _;
403
+ adapt(2,2) = _,_;
404
+ adapt(1,2) = _ <: _,_;
405
+ adapt(2,1) = _,_ :> _;
406
+ adaptor(F,G) = adapt(outputs(F),inputs(G));
407
+ dsp_code = environment{
408
+ ${dspCode}
409
+ };
410
+ process = adaptor(dsp_code.process, dsp_code.effect) : dsp_code.effect;`
405
411
  ) {
406
412
  this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
407
413
  if (!this.voiceFactory) return null;
408
- // Compile effect, possibly failing since 'compilePolyNode2' can be called by called by 'compilePolyNode'
414
+ // Compile effect, possibly failing since 'compilePolyNode2' can be called by 'compilePolyNode'
409
415
  try {
410
416
  this.effectFactory = await compiler.createPolyDSPFactory(name, effectCode, args);
411
417
  } catch (e) {
@@ -2457,8 +2457,11 @@ this.fAudioMixingHalf: ${this.fAudioMixingHalf}`;
2457
2457
  }
2458
2458
  }
2459
2459
  });
2460
- if (this.fInstance.effectAPI)
2460
+ if (this.fInstance.effectAPI) {
2461
+ console.log("effectAPI.getNumInputs() = %d", this.fInstance.effectAPI.getNumInputs(this.fEffect));
2462
+ console.log("effectAPI.getNumOutputs() = %d", this.fInstance.effectAPI.getNumOutputs(this.fEffect));
2461
2463
  this.fInstance.effectAPI.compute(this.fEffect, this.fBufferSize, this.fAudioOutputs, this.fAudioOutputs);
2464
+ }
2462
2465
  this.updateOutputs();
2463
2466
  if (output !== void 0) {
2464
2467
  for (let chan = 0; chan < Math.min(this.getNumOutputs(), output.length); chan++) {
@@ -2476,7 +2479,11 @@ this.fAudioMixingHalf: ${this.fAudioMixingHalf}`;
2476
2479
  return this.fInstance.voiceAPI.getNumInputs(0);
2477
2480
  }
2478
2481
  getNumOutputs() {
2479
- return this.fInstance.voiceAPI.getNumOutputs(0);
2482
+ if (this.fInstance.effectAPI) {
2483
+ console.log("effectAPI.getNumOutputs() = %d", this.fInstance.effectAPI.getNumOutputs(this.fEffect));
2484
+ console.log("VOICE.getNumOutputs() = %d", this.fInstance.voiceAPI.getNumOutputs(0));
2485
+ }
2486
+ return this.fInstance.effectAPI ? this.fInstance.effectAPI.getNumOutputs(this.fEffect) : this.fInstance.voiceAPI.getNumOutputs(0);
2480
2487
  }
2481
2488
  static findPath(o, p) {
2482
2489
  if (typeof o !== "object") {
@@ -3637,10 +3644,15 @@ var _FaustPolyDspGenerator = class {
3637
3644
  this.effectFactory = null;
3638
3645
  }
3639
3646
  async compile(compiler, name, dspCode, args, effectCode = `
3640
- adapt(1,1) = _; adapt(2,2) = _,_; adapt(1,2) = _ <: _,_; adapt(2,1) = _,_ :> _;
3641
- adaptor(F,G) = adapt(outputs(F),inputs(G));
3642
- dsp_code = environment{${dspCode}};
3643
- process = adaptor(dsp_code.process, dsp_code.effect) : dsp_code.effect;`) {
3647
+ adapt(1,1) = _;
3648
+ adapt(2,2) = _,_;
3649
+ adapt(1,2) = _ <: _,_;
3650
+ adapt(2,1) = _,_ :> _;
3651
+ adaptor(F,G) = adapt(outputs(F),inputs(G));
3652
+ dsp_code = environment{
3653
+ ${dspCode}
3654
+ };
3655
+ process = adaptor(dsp_code.process, dsp_code.effect) : dsp_code.effect;`) {
3644
3656
  this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
3645
3657
  if (!this.voiceFactory)
3646
3658
  return null;