@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.
@@ -699,11 +699,13 @@ export declare class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
699
699
  protected fSampleSize: number;
700
700
  protected fPitchwheelLabel: {
701
701
  path: string;
702
+ chan: number;
702
703
  min: number;
703
704
  max: number;
704
705
  }[];
705
706
  protected fCtrlLabel: {
706
707
  path: string;
708
+ chan: number;
707
709
  min: number;
708
710
  max: number;
709
711
  }[][];
@@ -2090,11 +2090,24 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2090
2090
  if (midi) {
2091
2091
  const strMidi = midi.trim();
2092
2092
  if (strMidi === "pitchwheel") {
2093
- this.fPitchwheelLabel.push({ path: item.address, min: item.min, max: item.max });
2094
- } else {
2095
- const matched = strMidi.match(/^ctrl\s(\d+)/);
2093
+ const matched = strMidi.match(/^pitchwheel\s(\d+)/);
2096
2094
  if (matched) {
2097
- this.fCtrlLabel[parseInt(matched[1])].push({ path: item.address, min: item.min, max: item.max });
2095
+ this.fPitchwheelLabel.push({ path: item.address, chan: parseInt(matched[1]), min: item.min, max: item.max });
2096
+ } else {
2097
+ this.fPitchwheelLabel.push({ path: item.address, chan: 0, min: item.min, max: item.max });
2098
+ }
2099
+ } else {
2100
+ const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
2101
+ const matched1 = strMidi.match(/^ctrl\s(\d+)/);
2102
+ if (matched2) {
2103
+ console.log("matched2", matched2);
2104
+ console.log("matched2[1]", matched2[1]);
2105
+ console.log("matched2[2]", matched2[2]);
2106
+ this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
2107
+ } else if (matched1) {
2108
+ console.log("matched1", matched1);
2109
+ console.log("matched1[1]", matched1[1]);
2110
+ this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
2098
2111
  }
2099
2112
  }
2100
2113
  }
@@ -2362,10 +2375,13 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2362
2375
  this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
2363
2376
  if (this.fCtrlLabel[ctrl].length) {
2364
2377
  this.fCtrlLabel[ctrl].forEach((ctrl2) => {
2365
- const { path } = ctrl2;
2366
- this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2367
- if (this.fOutputHandler)
2368
- this.fOutputHandler(path, this.getParamValue(path));
2378
+ const { path, chan } = ctrl2;
2379
+ console.log("ctrlChange", path, chan, channel);
2380
+ if (chan === 0 || channel === chan - 1) {
2381
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2382
+ if (this.fOutputHandler)
2383
+ this.fOutputHandler(path, this.getParamValue(path));
2384
+ }
2369
2385
  });
2370
2386
  }
2371
2387
  }
@@ -2373,9 +2389,12 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2373
2389
  if (this.fPlotHandler)
2374
2390
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
2375
2391
  this.fPitchwheelLabel.forEach((pw) => {
2376
- this.setParamValue(pw.path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
2377
- if (this.fOutputHandler)
2378
- this.fOutputHandler(pw.path, this.getParamValue(pw.path));
2392
+ const { path, chan } = pw;
2393
+ if (chan === 0 || channel === chan - 1) {
2394
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
2395
+ if (this.fOutputHandler)
2396
+ this.fOutputHandler(path, this.getParamValue(path));
2397
+ }
2379
2398
  });
2380
2399
  }
2381
2400
  setParamValue(path, value) {