@grame/faustwasm 0.5.4 → 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
  }[][];
package/dist/cjs/index.js CHANGED
@@ -2120,11 +2120,24 @@ 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
+ console.log("matched2", matched2);
2134
+ console.log("matched2[1]", matched2[1]);
2135
+ console.log("matched2[2]", matched2[2]);
2136
+ this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
2137
+ } else if (matched1) {
2138
+ console.log("matched1", matched1);
2139
+ console.log("matched1[1]", matched1[1]);
2140
+ this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
2128
2141
  }
2129
2142
  }
2130
2143
  }
@@ -2392,10 +2405,13 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2392
2405
  this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
2393
2406
  if (this.fCtrlLabel[ctrl].length) {
2394
2407
  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));
2408
+ const { path, chan } = ctrl2;
2409
+ console.log("ctrlChange", path, chan, channel);
2410
+ if (chan === 0 || channel === chan - 1) {
2411
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2412
+ if (this.fOutputHandler)
2413
+ this.fOutputHandler(path, this.getParamValue(path));
2414
+ }
2399
2415
  });
2400
2416
  }
2401
2417
  }
@@ -2403,9 +2419,12 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2403
2419
  if (this.fPlotHandler)
2404
2420
  this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
2405
2421
  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));
2422
+ const { path, chan } = pw;
2423
+ if (chan === 0 || channel === chan - 1) {
2424
+ this.setParamValue(path, _FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
2425
+ if (this.fOutputHandler)
2426
+ this.fOutputHandler(path, this.getParamValue(path));
2427
+ }
2409
2428
  });
2410
2429
  }
2411
2430
  setParamValue(path, value) {