@grame/faustwasm 0.3.2 → 0.4.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.
- package/README.md +10 -4
- package/assets/standalone/faustwasm/index.d.ts +6 -0
- package/assets/standalone/faustwasm/index.js +12 -4
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/assets/standalone/icon.png +0 -0
- package/assets/standalone/index-poly.js +11 -0
- package/assets/standalone/index.html +4 -2
- package/assets/standalone/index.js +11 -0
- package/assets/standalone/manifest.json +18 -0
- package/assets/standalone/service-worker.js +48 -0
- package/dist/cjs/index.d.ts +6 -0
- package/dist/cjs/index.js +12 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +6 -0
- package/dist/cjs-bundle/index.js +12 -4
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.js +12 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +6 -0
- package/dist/esm-bundle/index.js +12 -4
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustAudioWorkletNode.ts +0 -3
- package/src/SoundfileReader.ts +16 -2
- package/src/copyWebStandaloneAssets.js +11 -1
- package/test/faustlive-wasm/faustwasm/index.d.ts +6 -0
- package/test/faustlive-wasm/faustwasm/index.js +12 -4
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/osc2.dsp +1 -1
- package/0001-Invert-x-y-z-accelerometer-on-Android.patch +0 -194
- package/build +0 -17
|
Binary file
|
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
* @typedef {import("./faustwasm").FaustUIItem} FaustUIItem
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Registers the service worker.
|
|
12
|
+
*/
|
|
13
|
+
if ('serviceWorker' in navigator) {
|
|
14
|
+
window.addEventListener('load', () => {
|
|
15
|
+
navigator.serviceWorker.register('./service-worker.js')
|
|
16
|
+
.then(reg => console.log('Service Worker registered', reg))
|
|
17
|
+
.catch(err => console.log('Service Worker registration failed', err));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
/** @type {HTMLSpanElement} */
|
|
11
22
|
const $spanAudioInput = document.getElementById("audio-input");
|
|
12
23
|
/** @type {HTMLSpanElement} */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
|
|
4
|
+
<link rel="manifest" href="/FAUST_DSP/manifest.json">
|
|
5
|
+
|
|
4
6
|
<head>
|
|
5
7
|
<meta charset="UTF-8">
|
|
6
8
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
flex-direction: column;
|
|
60
62
|
}
|
|
61
63
|
</style>
|
|
62
|
-
<link rel="stylesheet" href="
|
|
64
|
+
<link rel="stylesheet" href="/FAUST_DSP/faust-ui/index.css">
|
|
63
65
|
</head>
|
|
64
66
|
|
|
65
67
|
<body>
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
<div id="div-faust-ui">
|
|
79
81
|
</div>
|
|
80
82
|
</main>
|
|
81
|
-
<script src="
|
|
83
|
+
<script src="/FAUST_DSP/FAUST_DSP.js"></script>
|
|
82
84
|
</body>
|
|
83
85
|
|
|
84
86
|
</html>
|
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
* @typedef {import("./faustwasm").FaustUIItem} FaustUIItem
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Registers the service worker.
|
|
12
|
+
*/
|
|
13
|
+
if ('serviceWorker' in navigator) {
|
|
14
|
+
window.addEventListener('load', () => {
|
|
15
|
+
navigator.serviceWorker.register('./service-worker.js')
|
|
16
|
+
.then(reg => console.log('Service Worker registered', reg))
|
|
17
|
+
.catch(err => console.log('Service Worker registration failed', err));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
/** @type {HTMLSpanElement} */
|
|
11
22
|
const $spanAudioInput = document.getElementById("audio-input");
|
|
12
23
|
/** @type {HTMLSpanElement} */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Faust FAUST_DSP",
|
|
3
|
+
"short_name": "FAUST_DSP",
|
|
4
|
+
"start_url": "/FAUST_DSP/index.html",
|
|
5
|
+
"description": "Progressive Web App for FAUST_DSP",
|
|
6
|
+
"display": "standalone",
|
|
7
|
+
"background_color": "#ffffff",
|
|
8
|
+
"theme_color": "#000000",
|
|
9
|
+
"scope": "/FAUST_DSP/",
|
|
10
|
+
"orientation": "portrait",
|
|
11
|
+
"icons": [
|
|
12
|
+
{
|
|
13
|
+
"src": "icon.png",
|
|
14
|
+
"sizes": "390x390",
|
|
15
|
+
"type": "image/png"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
const CACHE_NAME = 'FAUST_DSP-static'; // Cache name without versioning
|
|
3
|
+
|
|
4
|
+
self.addEventListener('install', event => {
|
|
5
|
+
event.waitUntil(
|
|
6
|
+
caches.open(CACHE_NAME).then(cache => {
|
|
7
|
+
console.log("Service worker installed");
|
|
8
|
+
return cache.addAll([
|
|
9
|
+
'/FAUST_DSP/',
|
|
10
|
+
'/FAUST_DSP/faust-ui/index.js',
|
|
11
|
+
'/FAUST_DSP/faust-ui/index.css',
|
|
12
|
+
'/FAUST_DSP/faustwasm/index.js',
|
|
13
|
+
'/FAUST_DSP/FAUST_DSP.js',
|
|
14
|
+
'/FAUST_DSP/FAUST_DSP.wasm',
|
|
15
|
+
'/FAUST_DSP/FAUST_DSP.json',
|
|
16
|
+
]).catch(error => {
|
|
17
|
+
// Catch and log any errors during the caching process
|
|
18
|
+
console.error('Failed to cache resources during install:', error);
|
|
19
|
+
});
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
self.addEventListener("activate", event => {
|
|
25
|
+
console.log("Service worker activated");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
self.addEventListener('fetch', event => {
|
|
29
|
+
event.respondWith((async () => {
|
|
30
|
+
const cache = await caches.open(CACHE_NAME);
|
|
31
|
+
const cachedResponse = await cache.match(event.request);
|
|
32
|
+
if (cachedResponse) {
|
|
33
|
+
return cachedResponse;
|
|
34
|
+
} else {
|
|
35
|
+
try {
|
|
36
|
+
const fetchResponse = await fetch(event.request);
|
|
37
|
+
// Ensure the response is valid before caching it
|
|
38
|
+
if (event.request.method === 'GET' && fetchResponse && fetchResponse.status === 200 && fetchResponse.type === 'basic') {
|
|
39
|
+
cache.put(event.request, fetchResponse.clone());
|
|
40
|
+
}
|
|
41
|
+
return fetchResponse;
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// Network access failure
|
|
44
|
+
console.log('Network access error', e);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
})());
|
|
48
|
+
});
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1211,6 +1211,12 @@ export declare class WavDecoder {
|
|
|
1211
1211
|
/** Read metadata and fetch soundfiles */
|
|
1212
1212
|
export declare class SoundfileReader {
|
|
1213
1213
|
static get fallbackPaths(): string[];
|
|
1214
|
+
/**
|
|
1215
|
+
* Extract the parent URL from an URL.
|
|
1216
|
+
* @param url : the URL
|
|
1217
|
+
* @returns : the parent URL
|
|
1218
|
+
*/
|
|
1219
|
+
private static getParentUrl;
|
|
1214
1220
|
/**
|
|
1215
1221
|
* Convert an audio buffer to audio data.
|
|
1216
1222
|
*
|
package/dist/cjs/index.js
CHANGED
|
@@ -3526,8 +3526,17 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
3526
3526
|
|
|
3527
3527
|
// src/SoundfileReader.ts
|
|
3528
3528
|
var SoundfileReader = class {
|
|
3529
|
+
// Set the fallback paths
|
|
3529
3530
|
static get fallbackPaths() {
|
|
3530
|
-
return [location.href, location.origin];
|
|
3531
|
+
return [location.href, this.getParentUrl(location.href), location.origin];
|
|
3532
|
+
}
|
|
3533
|
+
/**
|
|
3534
|
+
* Extract the parent URL from an URL.
|
|
3535
|
+
* @param url : the URL
|
|
3536
|
+
* @returns : the parent URL
|
|
3537
|
+
*/
|
|
3538
|
+
static getParentUrl(url) {
|
|
3539
|
+
return url.substring(0, url.lastIndexOf("/") + 1);
|
|
3531
3540
|
}
|
|
3532
3541
|
/**
|
|
3533
3542
|
* Convert an audio buffer to audio data.
|
|
@@ -3568,7 +3577,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
3568
3577
|
static async checkFileExists(url) {
|
|
3569
3578
|
try {
|
|
3570
3579
|
console.log(`"checkFileExists" url: ${url}`);
|
|
3571
|
-
const response = await fetch(url
|
|
3580
|
+
const response = await fetch(url);
|
|
3581
|
+
console.log(`"checkFileExists" response.ok: ${response.ok}`);
|
|
3572
3582
|
return response.ok;
|
|
3573
3583
|
} catch (error) {
|
|
3574
3584
|
console.error("Fetch error:", error);
|
|
@@ -3689,8 +3699,6 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
|
|
|
3689
3699
|
async listenSensors() {
|
|
3690
3700
|
if (this.hasAccInput) {
|
|
3691
3701
|
const isAndroid = /Android/i.test(navigator.userAgent);
|
|
3692
|
-
console.log(navigator.userAgent);
|
|
3693
|
-
console.log(isAndroid);
|
|
3694
3702
|
let handleDeviceMotion = null;
|
|
3695
3703
|
if (isAndroid) {
|
|
3696
3704
|
handleDeviceMotion = ({ accelerationIncludingGravity }) => {
|