@grame/faustwasm 0.7.10 → 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/README.md +2 -2
- package/assets/standalone/create-node.js +31 -1
- package/assets/standalone/faust-ui/index.js +2 -2
- package/assets/standalone/faust-ui/index.js.map +1 -1
- package/assets/standalone/faustwasm/index.d.ts +76 -9
- package/assets/standalone/faustwasm/index.js +272 -107
- package/assets/standalone/faustwasm/index.js.map +4 -4
- package/assets/standalone/index-pwa.js +132 -98
- package/assets/standalone/index-template.js +44 -23
- package/assets/standalone/index.js +95 -80
- package/assets/standalone/service-worker.js +47 -8
- package/dist/cjs/index.d.ts +76 -9
- package/dist/cjs/index.js +272 -107
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs-bundle/index.d.ts +76 -9
- package/dist/cjs-bundle/index.js +272 -107
- package/dist/cjs-bundle/index.js.map +4 -4
- package/dist/esm/index.d.ts +76 -9
- package/dist/esm/index.js +272 -107
- package/dist/esm/index.js.map +4 -4
- package/dist/esm-bundle/index.d.ts +76 -9
- package/dist/esm-bundle/index.js +272 -107
- package/dist/esm-bundle/index.js.map +4 -4
- package/package.json +2 -2
- package/src/FaustAudioWorkletCommunicator.ts +143 -0
- package/src/FaustAudioWorkletNode.ts +27 -42
- package/src/FaustAudioWorkletProcessor.ts +34 -15
- package/src/FaustDspGenerator.ts +20 -2
- package/src/FaustFFTAudioWorkletProcessor.ts +31 -2
- package/src/FaustOfflineProcessor.ts +6 -0
- package/src/FaustScriptProcessorNode.ts +8 -31
- package/src/FaustWebAudioDsp.ts +38 -10
- package/test/faustlive-wasm/faust-ui/index.js +2 -2
- package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
- package/test/faustlive-wasm/faustwasm/index.d.ts +76 -9
- package/test/faustlive-wasm/faustwasm/index.js +272 -107
- package/test/faustlive-wasm/faustwasm/index.js.map +4 -4
- package/assets/standalone/coi-serviceworker.js +0 -146
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The library offers functionality for compiling Faust DSP code into WebAssembly,
|
|
|
6
6
|
|
|
7
7
|
Synthesizer and effect mono nodes, as well as [polyphonic](https://faustdoc.grame.fr/manual/midi/#midi-polyphony-support) poly nodes can be created. MIDI support is activated as soon as [MIDI metadata](https://faustdoc.grame.fr/manual/midi/#configuring-midi-in-faust) are used in the DSP code for mono nodes, and always in polyphonic mode.
|
|
8
8
|
|
|
9
|
-
[Sensors](https://faustdoc.grame.fr/manual/syntax/#sensors-control-metadatas) (accelerometer and gyroscope) are supported, as well as the
|
|
9
|
+
[Sensors](https://faustdoc.grame.fr/manual/syntax/#sensors-control-metadatas) (accelerometer and gyroscope) metadata are supported, as well as the [Progressive Web Application](https://en.wikipedia.org/wiki/Progressive_web_app) model.
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
@@ -309,7 +309,7 @@ This level takes a Faust Wasm instance to build an audio node. [AudioWorklet](ht
|
|
|
309
309
|
|
|
310
310
|
**Warning**: AudioWorklet is a recent technology and may not be supported by all the browsers. Check the [compatibility](https://developer.mozilla.org/fr/docs/Web/API/AudioWorklet) chart.
|
|
311
311
|
|
|
312
|
-
The audio node API documentation
|
|
312
|
+
The base audio node API documentation is documented in the [IFaustBaseWebAudioDsp](https://github.com/search?q=repo%3Agrame-cncm%2Ffaustwasm%20IFaustBaseWebAudioDsp&type=code) interface. The [IFaustPolyWebAudioDsp](https://github.com/search?q=repo%3Agrame-cncm%2Ffaustwasm%20IFaustPolyWebAudioDsp&type=code) interface documents the polyphonic extension.
|
|
313
313
|
|
|
314
314
|
Note that ScriptProcessor is marked as [deprecated](https://developer.mozilla.org/en-US/docs/Web/API/ScriptProcessorNode) but it's the only audio architecture available in older Safari versions. Both monophonic (generators, effects...) or polyphonic (instruments) nodes can be created. It is described in `FaustScriptProcessorNode.ts` file.
|
|
315
315
|
|
|
@@ -135,6 +135,36 @@ async function createFaustUI(divFaustUI, faustNode) {
|
|
|
135
135
|
faustUI.resize();
|
|
136
136
|
};
|
|
137
137
|
|
|
138
|
+
async function requestPermissions() {
|
|
139
|
+
|
|
140
|
+
// Explicitly request permission on iOS before calling startSensors()
|
|
141
|
+
if (typeof window.DeviceMotionEvent !== "undefined" && typeof window.DeviceMotionEvent.requestPermission === "function") {
|
|
142
|
+
try {
|
|
143
|
+
const permissionState = await window.DeviceMotionEvent.requestPermission();
|
|
144
|
+
if (permissionState !== "granted") {
|
|
145
|
+
console.warn("Motion sensor permission denied.");
|
|
146
|
+
} else {
|
|
147
|
+
console.log("Motion sensor permission granted.");
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error("Error requesting motion sensor permission:", error);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (typeof window.DeviceOrientationEvent !== "undefined" && typeof window.DeviceOrientationEvent.requestPermission === "function") {
|
|
155
|
+
try {
|
|
156
|
+
const permissionState = await window.DeviceOrientationEvent.requestPermission();
|
|
157
|
+
if (permissionState !== "granted") {
|
|
158
|
+
console.warn("Orientation sensor permission denied.");
|
|
159
|
+
} else {
|
|
160
|
+
console.log("Orientation sensor permission granted.");
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error("Error requesting orientation sensor permission:", error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
138
168
|
// Export the functions
|
|
139
|
-
export { createFaustNode, createFaustUI, connectToAudioInput };
|
|
169
|
+
export { createFaustNode, createFaustUI, connectToAudioInput, requestPermissions };
|
|
140
170
|
|
|
@@ -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]
|
|
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]
|
|
952
|
+
const itemsRegex = /(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+))/g;
|
|
953
953
|
const enums = {};
|
|
954
954
|
let item;
|
|
955
955
|
while (item = itemsRegex.exec(matched[0])) {
|