@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
  }[][];
package/dist/cjs/index.js CHANGED
@@ -2120,11 +2120,19 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2120
2120
  if (midi) {
2121
2121
  const strMidi = midi.trim();
2122
2122
  if (strMidi === "pitchwheel") {
2123
- this.fPitchwheelLabel.push({ path: item.address, min: item.min, max: item.max });
2124
- } else {
2125
- const matched = strMidi.match(/^ctrl\s(\d+)/);
2123
+ const matched = strMidi.match(/^pitchwheel\s(\d+)/);
2126
2124
  if (matched) {
2127
- this.fCtrlLabel[parseInt(matched[1])].push({ path: item.address, min: item.min, max: item.max });
2125
+ this.fPitchwheelLabel.push({ path: item.address, chan: parseInt(matched[1]), min: item.min, max: item.max });
2126
+ } else {
2127
+ this.fPitchwheelLabel.push({ path: item.address, chan: 0, min: item.min, max: item.max });
2128
+ }
2129
+ } else {
2130
+ const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
2131
+ const matched1 = strMidi.match(/^ctrl\s(\d+)/);
2132
+ if (matched2) {
2133
+ this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
2134
+ } else if (matched1) {
2135
+ this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
2128
2136
  }
2129
2137
  }
2130
2138
  }
@@ -2392,10 +2400,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2392
2400
  this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
2393
2401
  if (this.fCtrlLabel[ctrl].length) {
2394
2402
  this.fCtrlLabel[ctrl].forEach((ctrl2) => {
2395
- const { path } = ctrl2;
2396
- this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2397
- if (this.fOutputHandler)
2398
- this.fOutputHandler(path, this.getParamValue(path));
2403
+ const { path, chan } = ctrl2;
2404
+ if (chan === 0 || channel === chan - 1) {
2405
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2406
+ if (this.fOutputHandler)
2407
+ this.fOutputHandler(path, this.getParamValue(path));
2408
+ }
2399
2409
  });
2400
2410
  }
2401
2411
  }
@@ -2403,9 +2413,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2403
2413
  if (this.fPlotHandler)
2404
2414
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
2405
2415
  this.fPitchwheelLabel.forEach((pw) => {
2406
- this.setParamValue(pw.path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
2407
- if (this.fOutputHandler)
2408
- this.fOutputHandler(pw.path, this.getParamValue(pw.path));
2416
+ const { path, chan } = pw;
2417
+ if (chan === 0 || channel === chan - 1) {
2418
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
2419
+ if (this.fOutputHandler)
2420
+ this.fOutputHandler(path, this.getParamValue(path));
2421
+ }
2409
2422
  });
2410
2423
  }
2411
2424
  setParamValue(path, value) {