@grame/faustwasm 0.8.0 → 0.8.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grame/faustwasm",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "homepage": "https://github.com/grame-cncm/faustwasm#readme",
40
40
  "devDependencies": {
41
41
  "@aws-crypto/sha256-js": "^5.2.0",
42
- "@shren/faust-ui": "^1.1.13",
42
+ "@shren/faust-ui": "^1.1.16",
43
43
  "@types/node": "^20.12.7",
44
44
  "@types/webmidi": "^2.0.10",
45
45
  "@webaudiomodules/api": "^2.0.0-alpha.6",
@@ -95,21 +95,8 @@ export class FaustAudioWorkletNode<Poly extends boolean = false> extends (global
95
95
  async startSensors() {
96
96
  if (this.hasAccInput) {
97
97
  if (window.DeviceMotionEvent) {
98
- if (typeof (window.DeviceMotionEvent as any).requestPermission === "function") { // for iOS 13+
99
- try {
100
- const response = await (window.DeviceMotionEvent as any).requestPermission();
101
- if (response === "granted") {
102
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
103
- } else if (response === "denied") {
104
- alert('You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.');
105
- throw new Error("Unable to access the accelerometer.");
106
- }
107
- } catch (error) {
108
- console.error(error);
109
- }
110
- } else {
111
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
112
- }
98
+ // iOS 13+ requires a user gesture to enable DeviceMotionEvent, to be done in the main thread
99
+ window.addEventListener("devicemotion", this.handleDeviceMotion, true);
113
100
  } else {
114
101
  // Browser doesn't support DeviceMotionEvent
115
102
  console.log("Cannot set the accelerometer handler.");
@@ -117,21 +104,8 @@ export class FaustAudioWorkletNode<Poly extends boolean = false> extends (global
117
104
  }
118
105
  if (this.hasGyrInput) {
119
106
  if (window.DeviceMotionEvent) {
120
- if (typeof (window.DeviceOrientationEvent as any).requestPermission === "function") { // for iOS 13+
121
- try {
122
- const response = await (window.DeviceOrientationEvent as any).requestPermission();
123
- if (response === "granted") {
124
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
125
- } else if (response === "denied") {
126
- alert('You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.');
127
- throw new Error("Unable to access the gyroscope.");
128
- }
129
- } catch (error) {
130
- console.error(error);
131
- }
132
- } else {
133
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
134
- }
107
+ // iOS 13+ requires a user gesture to enable DeviceMotionEvent, to be done in the main thread
108
+ window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
135
109
  } else {
136
110
  // Browser doesn't support DeviceMotionEvent
137
111
  console.log("Cannot set the gyroscope handler.");
@@ -54,21 +54,8 @@ export class FaustScriptProcessorNode<Poly extends boolean = false> extends (glo
54
54
  async startSensors() {
55
55
  if (this.hasAccInput) {
56
56
  if (window.DeviceMotionEvent) {
57
- if (typeof (window.DeviceMotionEvent as any).requestPermission === "function") { // for iOS 13+
58
- try {
59
- const response = await (window.DeviceMotionEvent as any).requestPermission();
60
- if (response === "granted") {
61
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
62
- } else if (response === "denied") {
63
- alert('You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.');
64
- throw new Error("Unable to access the accelerometer.");
65
- }
66
- } catch (error) {
67
- console.error(error);
68
- }
69
- } else {
70
- window.addEventListener("devicemotion", this.handleDeviceMotion, true);
71
- }
57
+ // iOS 13+ requires a user gesture to enable DeviceMotionEvent, to be done in the main thread
58
+ window.addEventListener("devicemotion", this.handleDeviceMotion, true);
72
59
  } else {
73
60
  // Browser doesn't support DeviceMotionEvent
74
61
  console.log("Cannot set the accelerometer handler.");
@@ -76,21 +63,8 @@ export class FaustScriptProcessorNode<Poly extends boolean = false> extends (glo
76
63
  }
77
64
  if (this.hasGyrInput) {
78
65
  if (window.DeviceMotionEvent) {
79
- if (typeof (window.DeviceOrientationEvent as any).requestPermission === "function") { // for iOS 13+
80
- try {
81
- const response = await (window.DeviceOrientationEvent as any).requestPermission();
82
- if (response === "granted") {
83
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
84
- } else if (response === "denied") {
85
- alert('You have denied access to motion and orientation data. To enable it, go to Settings > Safari > Motion & Orientation Access.');
86
- throw new Error("Unable to access the gyroscope.");
87
- }
88
- } catch (error) {
89
- console.error(error);
90
- }
91
- } else {
92
- window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
93
- }
66
+ // iOS 13+ requires a user gesture to enable DeviceMotionEvent, to be done in the main thread
67
+ window.addEventListener("deviceorientation", this.handleDeviceOrientation, true);
94
68
  } else {
95
69
  // Browser doesn't support DeviceMotionEvent
96
70
  console.log("Cannot set the gyroscope handler.");
@@ -946,10 +946,10 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
946
946
  if (!metaIn) return { metaObject };
947
947
  metaIn.forEach((m) => Object.assign(metaObject, m));
948
948
  if (metaObject.style) {
949
- const enumsRegex = /\{(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?);)+(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))\}/;
949
+ const enumsRegex = /\{(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+);)+(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+))\}/;
950
950
  const matched = metaObject.style.match(enumsRegex);
951
951
  if (matched) {
952
- const itemsRegex = /(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))/g;
952
+ const itemsRegex = /(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+))/g;
953
953
  const enums = {};
954
954
  let item;
955
955
  while (item = itemsRegex.exec(matched[0])) {