@grame/faustwasm 0.5.5 → 0.6.1

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,19 @@ 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
+ this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
2104
+ } else if (matched1) {
2105
+ this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
2098
2106
  }
2099
2107
  }
2100
2108
  }
@@ -2362,10 +2370,12 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2362
2370
  this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
2363
2371
  if (this.fCtrlLabel[ctrl].length) {
2364
2372
  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));
2373
+ const { path, chan } = ctrl2;
2374
+ if (chan === 0 || channel === chan - 1) {
2375
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2376
+ if (this.fOutputHandler)
2377
+ this.fOutputHandler(path, this.getParamValue(path));
2378
+ }
2369
2379
  });
2370
2380
  }
2371
2381
  }
@@ -2373,9 +2383,12 @@ var FaustBaseWebAudioDsp = class _FaustBaseWebAudioDsp {
2373
2383
  if (this.fPlotHandler)
2374
2384
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
2375
2385
  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));
2386
+ const { path, chan } = pw;
2387
+ if (chan === 0 || channel === chan - 1) {
2388
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
2389
+ if (this.fOutputHandler)
2390
+ this.fOutputHandler(path, this.getParamValue(path));
2391
+ }
2379
2392
  });
2380
2393
  }
2381
2394
  setParamValue(path, value) {