@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.
- package/assets/standalone/faustwasm/index.d.ts +2 -0
- package/assets/standalone/faustwasm/index.js +24 -11
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +24 -11
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +2 -0
- package/dist/cjs-bundle/index.js +26 -13
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +24 -11
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +2 -0
- package/dist/esm-bundle/index.js +26 -13
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/package.json +1 -1
- package/src/FaustWebAudioDsp.ts +31 -13
- package/test/faustlive-wasm/faustwasm/index.d.ts +2 -0
- package/test/faustlive-wasm/faustwasm/index.js +24 -11
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/midi.dsp +2 -2
- package/foo.cpp +0 -3312
|
Binary file
|
package/package.json
CHANGED
package/src/FaustWebAudioDsp.ts
CHANGED
|
@@ -591,8 +591,8 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
591
591
|
protected fSampleSize: number;
|
|
592
592
|
|
|
593
593
|
// MIDI handling
|
|
594
|
-
protected fPitchwheelLabel: { path: string; min: number; max: number }[] = [];
|
|
595
|
-
protected fCtrlLabel: { path: string; min: number; max: number }[][] = new Array(128).fill(null).map(() => []);
|
|
594
|
+
protected fPitchwheelLabel: { path: string; chan: number; min: number; max: number }[] = [];
|
|
595
|
+
protected fCtrlLabel: { path: string; chan: number; min: number; max: number }[][] = new Array(128).fill(null).map(() => []);
|
|
596
596
|
protected fPathTable: { [address: string]: number } = {};
|
|
597
597
|
protected fUICallback: UIHandler = (item: FaustUIItem) => {
|
|
598
598
|
if (item.type === "hbargraph" || item.type === "vbargraph") {
|
|
@@ -611,14 +611,27 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
611
611
|
if (midi) {
|
|
612
612
|
const strMidi = midi.trim();
|
|
613
613
|
if (strMidi === "pitchwheel") {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
const matched = strMidi.match(/^ctrl\s(\d+)/);
|
|
614
|
+
const matched = strMidi.match(/^pitchwheel\s(\d+)/);
|
|
615
|
+
// "pitchwheel chan"
|
|
617
616
|
if (matched) {
|
|
618
|
-
this.
|
|
617
|
+
this.fPitchwheelLabel.push({ path: item.address, chan: parseInt(matched[1]), min: item.min as number, max: item.max as number });
|
|
618
|
+
// "pitchwheel"
|
|
619
|
+
} else {
|
|
620
|
+
this.fPitchwheelLabel.push({ path: item.address, chan: 0, min: item.min as number, max: item.max as number });
|
|
621
|
+
}
|
|
622
|
+
} else {
|
|
623
|
+
// "ctrl num chan"
|
|
624
|
+
const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
|
|
625
|
+
// "ctrl num"
|
|
626
|
+
const matched1 = strMidi.match(/^ctrl\s(\d+)/);
|
|
627
|
+
if (matched2) {
|
|
628
|
+
this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min as number, max: item.max as number });
|
|
629
|
+
} else if (matched1) {
|
|
630
|
+
this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min as number, max: item.max as number });
|
|
619
631
|
}
|
|
620
632
|
}
|
|
621
633
|
}
|
|
634
|
+
|
|
622
635
|
// Parse 'acc' metadata
|
|
623
636
|
if (acc) {
|
|
624
637
|
const numAcc: number[] = acc.trim().split(" ").map(Number);
|
|
@@ -939,10 +952,12 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
939
952
|
if (this.fPlotHandler) this.fCachedEvents.push({ type: "ctrlChange", data: [channel, ctrl, value] });
|
|
940
953
|
if (this.fCtrlLabel[ctrl].length) {
|
|
941
954
|
this.fCtrlLabel[ctrl].forEach((ctrl) => {
|
|
942
|
-
const { path } = ctrl;
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
955
|
+
const { path, chan } = ctrl;
|
|
956
|
+
if (chan === 0 || channel === chan - 1) {
|
|
957
|
+
this.setParamValue(path, FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl.min, ctrl.max));
|
|
958
|
+
// Typically used to reflect parameter change on GUI
|
|
959
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
960
|
+
}
|
|
946
961
|
});
|
|
947
962
|
}
|
|
948
963
|
}
|
|
@@ -950,9 +965,12 @@ export class FaustBaseWebAudioDsp implements IFaustBaseWebAudioDsp {
|
|
|
950
965
|
pitchWheel(channel: number, wheel: number) {
|
|
951
966
|
if (this.fPlotHandler) this.fCachedEvents.push({ type: "pitchWheel", data: [channel, wheel] });
|
|
952
967
|
this.fPitchwheelLabel.forEach((pw) => {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
968
|
+
const { path, chan } = pw;
|
|
969
|
+
if (chan === 0 || channel === chan - 1) {
|
|
970
|
+
this.setParamValue(path, FaustBaseWebAudioDsp.remap(wheel, 0, 16383, pw.min, pw.max));
|
|
971
|
+
// Typically used to reflect parameter change on GUI
|
|
972
|
+
if (this.fOutputHandler) this.fOutputHandler(path, this.getParamValue(path));
|
|
973
|
+
}
|
|
956
974
|
});
|
|
957
975
|
}
|
|
958
976
|
|
|
@@ -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
|
-
|
|
2094
|
-
} else {
|
|
2095
|
-
const matched = strMidi.match(/^ctrl\s(\d+)/);
|
|
2093
|
+
const matched = strMidi.match(/^pitchwheel\s(\d+)/);
|
|
2096
2094
|
if (matched) {
|
|
2097
|
-
this.
|
|
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
|
-
|
|
2367
|
-
|
|
2368
|
-
this.fOutputHandler
|
|
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
|
-
|
|
2377
|
-
if (
|
|
2378
|
-
this.
|
|
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) {
|