@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
  }[][];
@@ -8137,11 +8137,24 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8137
8137
  if (midi) {
8138
8138
  const strMidi = midi.trim();
8139
8139
  if (strMidi === "pitchwheel") {
8140
- this.fPitchwheelLabel.push({ path: item.address, min: item.min, max: item.max });
8141
- } else {
8142
- const matched = strMidi.match(/^ctrl\s(\d+)/);
8140
+ const matched = strMidi.match(/^pitchwheel\s(\d+)/);
8143
8141
  if (matched) {
8144
- this.fCtrlLabel[parseInt(matched[1])].push({ path: item.address, min: item.min, max: item.max });
8142
+ this.fPitchwheelLabel.push({ path: item.address, chan: parseInt(matched[1]), min: item.min, max: item.max });
8143
+ } else {
8144
+ this.fPitchwheelLabel.push({ path: item.address, chan: 0, min: item.min, max: item.max });
8145
+ }
8146
+ } else {
8147
+ const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
8148
+ const matched1 = strMidi.match(/^ctrl\s(\d+)/);
8149
+ if (matched2) {
8150
+ console.log("matched2", matched2);
8151
+ console.log("matched2[1]", matched2[1]);
8152
+ console.log("matched2[2]", matched2[2]);
8153
+ this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
8154
+ } else if (matched1) {
8155
+ console.log("matched1", matched1);
8156
+ console.log("matched1[1]", matched1[1]);
8157
+ this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
8145
8158
  }
8146
8159
  }
8147
8160
  }
@@ -8409,10 +8422,13 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8409
8422
  this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
8410
8423
  if (this.fCtrlLabel[ctrl].length) {
8411
8424
  this.fCtrlLabel[ctrl].forEach((ctrl2) => {
8412
- const { path } = ctrl2;
8413
- this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
8414
- if (this.fOutputHandler)
8415
- this.fOutputHandler(path, this.getParamValue(path));
8425
+ const { path, chan } = ctrl2;
8426
+ console.log("ctrlChange", path, chan, channel);
8427
+ if (chan === 0 || channel === chan - 1) {
8428
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
8429
+ if (this.fOutputHandler)
8430
+ this.fOutputHandler(path, this.getParamValue(path));
8431
+ }
8416
8432
  });
8417
8433
  }
8418
8434
  }
@@ -8420,9 +8436,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
8420
8436
  if (this.fPlotHandler)
8421
8437
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
8422
8438
  this.fPitchwheelLabel.forEach((pw) => {
8423
- this.setParamValue(pw.path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
8424
- if (this.fOutputHandler)
8425
- this.fOutputHandler(pw.path, this.getParamValue(pw.path));
8439
+ const { path, chan } = pw;
8440
+ if (chan === 0 || channel === chan - 1) {
8441
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
8442
+ if (this.fOutputHandler)
8443
+ this.fOutputHandler(path, this.getParamValue(path));
8444
+ }
8426
8445
  });
8427
8446
  }
8428
8447
  setParamValue(path, value) {