@grame/faustwasm 0.4.4 → 0.4.6
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/COPYING.txt +520 -0
- package/README.md +3 -0
- package/assets/standalone/faust-ui/index.css +8 -0
- package/assets/standalone/faust-ui/index.css.map +1 -1
- package/assets/standalone/faust-ui/index.js +56 -30
- package/assets/standalone/faust-ui/index.js.map +1 -1
- package/assets/standalone/faustwasm/index.d.ts +18 -10
- package/assets/standalone/faustwasm/index.js +69 -24
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/dist/cjs/index.d.ts +18 -10
- package/dist/cjs/index.js +69 -24
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +18 -10
- package/dist/cjs-bundle/index.js +72 -27
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +18 -10
- package/dist/esm/index.js +69 -24
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +18 -10
- package/dist/esm-bundle/index.js +72 -27
- package/dist/esm-bundle/index.js.map +2 -2
- package/libfaust-wasm/libfaust-wasm.data +0 -0
- package/libfaust-wasm/libfaust-wasm.js +1 -1
- package/libfaust-wasm/libfaust-wasm.wasm +0 -0
- package/node +0 -0
- package/package.json +4 -2
- package/src/FaustAudioWorkletNode.ts +13 -24
- package/src/FaustAudioWorkletProcessor.ts +28 -1
- package/src/FaustDspGenerator.ts +18 -9
- package/src/FaustFFTAudioWorkletProcessor.ts +27 -0
- package/src/instantiateFaustModule.js +82 -0
- package/test/faustlive-wasm/faust-ui/index.css +8 -0
- package/test/faustlive-wasm/faust-ui/index.css.map +1 -1
- package/test/faustlive-wasm/faust-ui/index.js +56 -30
- package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
- package/test/faustlive-wasm/faustwasm/index.d.ts +18 -10
- package/test/faustlive-wasm/faustwasm/index.js +69 -24
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -440,7 +440,7 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
440
440
|
const fromX = prevX - rect.left;
|
|
441
441
|
const fromY = prevY - rect.top;
|
|
442
442
|
const prevValue = this.state.value;
|
|
443
|
-
this.
|
|
443
|
+
this.handleMouseOrTouchDown({ pointerId: -1, x: fromX, y: fromY, originalEvent: e });
|
|
444
444
|
const handleTouchMove = (e2) => {
|
|
445
445
|
e2.preventDefault();
|
|
446
446
|
const clientX = e2.changedTouches[0].clientX;
|
|
@@ -451,13 +451,13 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
451
451
|
prevY = clientY;
|
|
452
452
|
const x = clientX - rect.left;
|
|
453
453
|
const y = clientY - rect.top;
|
|
454
|
-
this.
|
|
454
|
+
this.handleMouseOrTouchMove({ pointerId: -1, prevValue, x, y, fromX, fromY, movementX, movementY, originalEvent: e2 });
|
|
455
455
|
};
|
|
456
456
|
const handleTouchEnd = (e2) => {
|
|
457
457
|
e2.preventDefault();
|
|
458
458
|
const x = e2.changedTouches[0].clientX - rect.left;
|
|
459
459
|
const y = e2.changedTouches[0].clientY - rect.top;
|
|
460
|
-
this.
|
|
460
|
+
this.handleMouseOrTouchUp({ pointerId: -1, x, y, originalEvent: e2 });
|
|
461
461
|
document.removeEventListener("touchmove", handleTouchMove);
|
|
462
462
|
document.removeEventListener("touchend", handleTouchEnd);
|
|
463
463
|
};
|
|
@@ -475,18 +475,18 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
475
475
|
const fromX = e.clientX - rect.left;
|
|
476
476
|
const fromY = e.clientY - rect.top;
|
|
477
477
|
const prevValue = this.state.value;
|
|
478
|
-
this.
|
|
478
|
+
this.handleMouseOrTouchDown({ pointerId: -1, x: fromX, y: fromY, originalEvent: e });
|
|
479
479
|
const handleMouseMove = (e2) => {
|
|
480
480
|
e2.preventDefault();
|
|
481
481
|
const x = e2.clientX - rect.left;
|
|
482
482
|
const y = e2.clientY - rect.top;
|
|
483
|
-
this.
|
|
483
|
+
this.handleMouseOrTouchMove({ pointerId: -1, prevValue, x, y, fromX, fromY, movementX: e2.movementX, movementY: e2.movementY, originalEvent: e2 });
|
|
484
484
|
};
|
|
485
485
|
const handleMouseUp = (e2) => {
|
|
486
486
|
e2.preventDefault();
|
|
487
487
|
const x = e2.clientX - rect.left;
|
|
488
488
|
const y = e2.clientY - rect.top;
|
|
489
|
-
this.
|
|
489
|
+
this.handleMouseOrTouchUp({ pointerId: -1, x, y, originalEvent: e2 });
|
|
490
490
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
491
491
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
492
492
|
};
|
|
@@ -500,10 +500,38 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
500
500
|
this.handleContextMenu = (e) => {
|
|
501
501
|
};
|
|
502
502
|
this.handlePointerDown = (e) => {
|
|
503
|
+
e.preventDefault();
|
|
504
|
+
e.currentTarget.focus();
|
|
505
|
+
const { pointerId } = e;
|
|
506
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
507
|
+
const fromX = e.clientX - rect.left;
|
|
508
|
+
const fromY = e.clientY - rect.top;
|
|
509
|
+
const prevValue = this.state.value;
|
|
510
|
+
this.handleMouseOrTouchDown({ pointerId, x: fromX, y: fromY, originalEvent: e });
|
|
511
|
+
const handlePointerMove = (e2) => {
|
|
512
|
+
if (e2.pointerId !== pointerId) return;
|
|
513
|
+
e2.preventDefault();
|
|
514
|
+
const x = e2.clientX - rect.left;
|
|
515
|
+
const y = e2.clientY - rect.top;
|
|
516
|
+
this.handleMouseOrTouchMove({ pointerId, prevValue, x, y, fromX, fromY, movementX: e2.movementX, movementY: e2.movementY, originalEvent: e2 });
|
|
517
|
+
};
|
|
518
|
+
const handlePointerUp = (e2) => {
|
|
519
|
+
if (e2.pointerId !== pointerId) return;
|
|
520
|
+
e2.preventDefault();
|
|
521
|
+
const x = e2.clientX - rect.left;
|
|
522
|
+
const y = e2.clientY - rect.top;
|
|
523
|
+
this.handleMouseOrTouchUp({ pointerId, x, y, originalEvent: e2 });
|
|
524
|
+
document.removeEventListener("pointermove", handlePointerMove);
|
|
525
|
+
document.removeEventListener("pointerup", handlePointerUp);
|
|
526
|
+
};
|
|
527
|
+
document.addEventListener("pointermove", handlePointerMove);
|
|
528
|
+
document.addEventListener("pointerup", handlePointerUp);
|
|
529
|
+
};
|
|
530
|
+
this.handleMouseOrTouchDown = (e) => {
|
|
503
531
|
};
|
|
504
|
-
this.
|
|
532
|
+
this.handleMouseOrTouchMove = (e) => {
|
|
505
533
|
};
|
|
506
|
-
this.
|
|
534
|
+
this.handleMouseOrTouchUp = (e) => {
|
|
507
535
|
};
|
|
508
536
|
this.handleFocusIn = (e) => this.setState({ focus: true });
|
|
509
537
|
this.handleFocusOut = (e) => this.setState({ focus: false });
|
|
@@ -729,10 +757,13 @@ class Button extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
729
757
|
this.btn.style.fontFamily = `${fontname}, sans-serif`;
|
|
730
758
|
this.btn.style.fontStyle = fontface;
|
|
731
759
|
};
|
|
732
|
-
this.
|
|
760
|
+
this.handleContextMenu = (e) => {
|
|
761
|
+
e.preventDefault();
|
|
762
|
+
};
|
|
763
|
+
this.handleMouseOrTouchDown = () => {
|
|
733
764
|
this.setValue(1);
|
|
734
765
|
};
|
|
735
|
-
this.
|
|
766
|
+
this.handleMouseOrTouchUp = () => {
|
|
736
767
|
this.setValue(0);
|
|
737
768
|
};
|
|
738
769
|
}
|
|
@@ -767,8 +798,8 @@ class Button extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
767
798
|
}
|
|
768
799
|
componentDidMount() {
|
|
769
800
|
super.componentDidMount();
|
|
770
|
-
this.btn.addEventListener("
|
|
771
|
-
this.btn.addEventListener("
|
|
801
|
+
this.btn.addEventListener("pointerdown", this.handlePointerDown);
|
|
802
|
+
this.btn.addEventListener("contextmenu", this.handleContextMenu);
|
|
772
803
|
this.on("style", () => this.schedule(this.setStyle));
|
|
773
804
|
const labelChange = () => this.span.innerText = this.state.label;
|
|
774
805
|
this.on("label", () => this.schedule(labelChange));
|
|
@@ -798,10 +829,10 @@ class Checkbox extends _Button__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
798
829
|
constructor() {
|
|
799
830
|
super(...arguments);
|
|
800
831
|
this.className = "checkbox";
|
|
801
|
-
this.
|
|
832
|
+
this.handleMouseOrTouchDown = () => {
|
|
802
833
|
this.setValue(1 - this.state.value);
|
|
803
834
|
};
|
|
804
|
-
this.
|
|
835
|
+
this.handleMouseOrTouchUp = () => {
|
|
805
836
|
};
|
|
806
837
|
}
|
|
807
838
|
}
|
|
@@ -1315,7 +1346,7 @@ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1315
1346
|
this.handleChange = (e) => {
|
|
1316
1347
|
const value = parseFloat(e.currentTarget.value);
|
|
1317
1348
|
if (isFinite(value)) {
|
|
1318
|
-
const changed = this.setValue(+
|
|
1349
|
+
const changed = this.setValue(+value);
|
|
1319
1350
|
if (changed) return;
|
|
1320
1351
|
}
|
|
1321
1352
|
this.input.value = this.inputNumber.value + (this.state.unit || "");
|
|
@@ -1369,7 +1400,7 @@ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1369
1400
|
ctx.lineTo(valuePosX, valuePosY);
|
|
1370
1401
|
ctx.stroke();
|
|
1371
1402
|
};
|
|
1372
|
-
this.
|
|
1403
|
+
this.handleMouseOrTouchMove = (e) => {
|
|
1373
1404
|
const newValue = this.getValueFromDelta(e);
|
|
1374
1405
|
if (newValue !== this.state.value) this.setValue(newValue);
|
|
1375
1406
|
};
|
|
@@ -1413,8 +1444,7 @@ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1413
1444
|
componentDidMount() {
|
|
1414
1445
|
super.componentDidMount();
|
|
1415
1446
|
this.input.addEventListener("change", this.handleChange);
|
|
1416
|
-
this.canvas.addEventListener("
|
|
1417
|
-
this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
|
|
1447
|
+
this.canvas.addEventListener("pointerdown", this.handlePointerDown);
|
|
1418
1448
|
this.on("style", () => {
|
|
1419
1449
|
this.schedule(this.setStyle);
|
|
1420
1450
|
this.schedule(this.paint);
|
|
@@ -1590,8 +1620,7 @@ class Led extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1590
1620
|
}
|
|
1591
1621
|
componentDidMount() {
|
|
1592
1622
|
super.componentDidMount();
|
|
1593
|
-
this.canvas.addEventListener("
|
|
1594
|
-
this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
|
|
1623
|
+
this.canvas.addEventListener("pointerdown", this.handlePointerDown);
|
|
1595
1624
|
this.on("style", () => this.schedule(this.setStyle));
|
|
1596
1625
|
this.on("label", () => this.schedule(this.paintLabel));
|
|
1597
1626
|
this.on("value", () => this.schedule(this.paint));
|
|
@@ -2067,9 +2096,9 @@ class Soundfile extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2067
2096
|
this.btn.style.fontFamily = `${fontname}, sans-serif`;
|
|
2068
2097
|
this.btn.style.fontStyle = fontface;
|
|
2069
2098
|
};
|
|
2070
|
-
this.
|
|
2099
|
+
this.handleMouseOrTouchDown = () => {
|
|
2071
2100
|
};
|
|
2072
|
-
this.
|
|
2101
|
+
this.handleMouseOrTouchUp = () => {
|
|
2073
2102
|
};
|
|
2074
2103
|
}
|
|
2075
2104
|
static get defaultProps() {
|
|
@@ -2103,8 +2132,7 @@ class Soundfile extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2103
2132
|
}
|
|
2104
2133
|
componentDidMount() {
|
|
2105
2134
|
super.componentDidMount();
|
|
2106
|
-
this.btn.addEventListener("
|
|
2107
|
-
this.btn.addEventListener("touchstart", this.handleTouchStart);
|
|
2135
|
+
this.btn.addEventListener("pointerdown", this.handlePointerDown);
|
|
2108
2136
|
this.on("style", () => this.schedule(this.setStyle));
|
|
2109
2137
|
const labelChange = () => this.span.innerText = this.state.label;
|
|
2110
2138
|
this.on("label", () => this.schedule(labelChange));
|
|
@@ -2273,8 +2301,7 @@ class VBargraph extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2273
2301
|
}
|
|
2274
2302
|
componentDidMount() {
|
|
2275
2303
|
super.componentDidMount();
|
|
2276
|
-
this.canvas.addEventListener("
|
|
2277
|
-
this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
|
|
2304
|
+
this.canvas.addEventListener("pointerdown", this.handlePointerDown);
|
|
2278
2305
|
this.on("style", () => {
|
|
2279
2306
|
this.schedule(this.setStyle);
|
|
2280
2307
|
this.schedule(this.paint);
|
|
@@ -2388,13 +2415,13 @@ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2388
2415
|
ctx.fillStyle = slidercolor;
|
|
2389
2416
|
(0,_utils__WEBPACK_IMPORTED_MODULE_1__.fillRoundedRect)(ctx, left - drawWidth, top + drawHeight * (1 - distance) - drawWidth, drawWidth * 3, drawWidth * 2, borderRadius);
|
|
2390
2417
|
};
|
|
2391
|
-
this.
|
|
2418
|
+
this.handleMouseOrTouchDown = (e) => {
|
|
2392
2419
|
const { value } = this.state;
|
|
2393
2420
|
if (e.x < this.interactionRect[0] || e.x > this.interactionRect[0] + this.interactionRect[2] || e.y < this.interactionRect[1] || e.y > this.interactionRect[1] + this.interactionRect[3]) return;
|
|
2394
2421
|
const newValue = this.getValueFromPos(e);
|
|
2395
2422
|
if (newValue !== value) this.setValue(this.getValueFromPos(e));
|
|
2396
2423
|
};
|
|
2397
|
-
this.
|
|
2424
|
+
this.handleMouseOrTouchMove = (e) => {
|
|
2398
2425
|
const newValue = this.getValueFromPos(e);
|
|
2399
2426
|
if (newValue !== this.state.value) this.setValue(newValue);
|
|
2400
2427
|
};
|
|
@@ -2442,8 +2469,7 @@ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2442
2469
|
componentDidMount() {
|
|
2443
2470
|
super.componentDidMount();
|
|
2444
2471
|
this.input.addEventListener("change", this.handleChange);
|
|
2445
|
-
this.canvas.addEventListener("
|
|
2446
|
-
this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
|
|
2472
|
+
this.canvas.addEventListener("pointerdown", this.handlePointerDown);
|
|
2447
2473
|
this.on("style", () => {
|
|
2448
2474
|
this.schedule(this.setStyle);
|
|
2449
2475
|
this.schedule(this.paint);
|