@grame/faustwasm 0.5.5 → 0.6.0

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.
@@ -706,11 +706,13 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
706
706
  protected fSampleSize: number;
707
707
  protected fPitchwheelLabel: {
708
708
  path: string;
709
+ chan: number;
709
710
  min: number;
710
711
  max: number;
711
712
  }[];
712
713
  protected fCtrlLabel: {
713
714
  path: string;
715
+ chan: number;
714
716
  min: number;
715
717
  max: number;
716
718
  }[][];
@@ -8092,11 +8092,24 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8092
8092
  if (midi) {
8093
8093
  const strMidi = midi.trim();
8094
8094
  if (strMidi === "pitchwheel") {
8095
- this.fPitchwheelLabel.push({ path: item.address, min: item.min, max: item.max });
8096
- } else {
8097
- const matched = strMidi.match(/^ctrl\s(\d+)/);
8095
+ const matched = strMidi.match(/^pitchwheel\s(\d+)/);
8098
8096
  if (matched) {
8099
- this.fCtrlLabel[parseInt(matched[1])].push({ path: item.address, min: item.min, max: item.max });
8097
+ this.fPitchwheelLabel.push({ path: item.address, chan: parseInt(matched[1]), min: item.min, max: item.max });
8098
+ } else {
8099
+ this.fPitchwheelLabel.push({ path: item.address, chan: 0, min: item.min, max: item.max });
8100
+ }
8101
+ } else {
8102
+ const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
8103
+ const matched1 = strMidi.match(/^ctrl\s(\d+)/);
8104
+ if (matched2) {
8105
+ console.log("matched2", matched2);
8106
+ console.log("matched2[1]", matched2[1]);
8107
+ console.log("matched2[2]", matched2[2]);
8108
+ this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
8109
+ } else if (matched1) {
8110
+ console.log("matched1", matched1);
8111
+ console.log("matched1[1]", matched1[1]);
8112
+ this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
8100
8113
  }
8101
8114
  }
8102
8115
  }
@@ -8364,10 +8377,13 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8364
8377
  this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
8365
8378
  if (this.fCtrlLabel[ctrl].length) {
8366
8379
  this.fCtrlLabel[ctrl].forEach((ctrl2) => {
8367
- const { path } = ctrl2;
8368
- this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
8369
- if (this.fOutputHandler)
8370
- this.fOutputHandler(path, this.getParamValue(path));
8380
+ const { path, chan } = ctrl2;
8381
+ console.log("ctrlChange", path, chan, channel);
8382
+ if (chan === 0 || channel === chan - 1) {
8383
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
8384
+ if (this.fOutputHandler)
8385
+ this.fOutputHandler(path, this.getParamValue(path));
8386
+ }
8371
8387
  });
8372
8388
  }
8373
8389
  }
@@ -8375,9 +8391,12 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
8375
8391
  if (this.fPlotHandler)
8376
8392
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
8377
8393
  this.fPitchwheelLabel.forEach((pw) => {
8378
- this.setParamValue(pw.path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
8379
- if (this.fOutputHandler)
8380
- this.fOutputHandler(pw.path, this.getParamValue(pw.path));
8394
+ const { path, chan } = pw;
8395
+ if (chan === 0 || channel === chan - 1) {
8396
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
8397
+ if (this.fOutputHandler)
8398
+ this.fOutputHandler(path, this.getParamValue(path));
8399
+ }
8381
8400
  });
8382
8401
  }
8383
8402
  setParamValue(path, value) {