@ilusiv/fyug-js 2026.11.3 → 2026.11.5
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 +95 -1
- package/dist/FuguePlayer.d.ts +5 -1
- package/dist/FuguePlayer.d.ts.map +1 -1
- package/dist/FuguePlayer.js +46 -51
- package/dist/FuguePlayer.js.map +1 -1
- package/dist/fugue-audio-worklet.js +1 -1
- package/dist/generated/embedded-assets.d.ts +2 -2
- package/dist/generated/embedded-assets.d.ts.map +1 -1
- package/dist/generated/embedded-assets.js +2 -2
- package/dist/generated/embedded-assets.js.map +1 -1
- package/dist/generated/fugue.d.ts +29 -0
- package/dist/generated/fugue.js +149 -0
- package/dist/generated/fugue_bg.wasm +0 -0
- package/dist/generated/fugue_bg.wasm.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/note-preview.d.ts +33 -0
- package/dist/note-preview.d.ts.map +1 -0
- package/dist/note-preview.js +92 -0
- package/dist/note-preview.js.map +1 -0
- package/dist/runtime-assets.d.ts +14 -0
- package/dist/runtime-assets.d.ts.map +1 -0
- package/dist/runtime-assets.js +70 -0
- package/dist/runtime-assets.js.map +1 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/README.md +22 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/fugue.pkg.json +12 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/clap.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/cowbell.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/hat-closed.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/hat-open.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/kick.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/loop.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples/snare.wav +0 -0
- package/dist/samples/fugue.demo.808-kit/0.1.0/samples.json +52 -0
- package/dist/samples/index.json +47 -0
- package/dist/types.d.ts +98 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -65,6 +65,98 @@ wasm's match `fyug-player-worklet.js` and `fyug-player.wasm` in the engine relea
|
|
|
65
65
|
`SHA256SUMS.txt`. npm never changes a published version, so the bytes at a
|
|
66
66
|
version's URL never change.
|
|
67
67
|
|
|
68
|
+
## Previewing Notes
|
|
69
|
+
|
|
70
|
+
`previewNotes(json, request)` lists the notes a document will play over a
|
|
71
|
+
range of bars, without playing it, and resolves to the engine's answer:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
const answer = await player.previewNotes(invention, { start_bar: 0, bars: 8 });
|
|
75
|
+
for (const note of answer.notes) {
|
|
76
|
+
console.log(note.module_id, note.pitch, note.start_beats);
|
|
77
|
+
}
|
|
78
|
+
if (answer.truncated) {
|
|
79
|
+
const next = await player.previewNotes(invention, {
|
|
80
|
+
start_bar: 0,
|
|
81
|
+
bars: 8,
|
|
82
|
+
cursor: answer.cursor!,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`json` is a complete invention document, as `loadInvention` takes it; it need
|
|
88
|
+
not be the loaded piece. The request takes `bars` (1 to 64), and optionally
|
|
89
|
+
`start_bar`, `module_id`, `seed` and `cursor`. An answer holds at most 256
|
|
90
|
+
notes and 48 KiB, says whether chance is involved (`chance`), and names the
|
|
91
|
+
`code` and `agent` modules it did not run (`not_run`). A request that needs
|
|
92
|
+
more than 300 seconds of audio, counted from the start of the piece to one bar
|
|
93
|
+
past the range, or a document the engine cannot load, is refused: the promise
|
|
94
|
+
rejects with an `Error` whose message is the engine's. The fields, limits and
|
|
95
|
+
note order are those of core's `docs/preview-notes.md`.
|
|
96
|
+
|
|
97
|
+
The preview runs on an engine of its own on the page's main thread, made on
|
|
98
|
+
the first call, never on the engine that plays: the loaded piece's position,
|
|
99
|
+
controls and output stay as they were, and it can be asked before `play()`.
|
|
100
|
+
It works in slices of about 8 ms that yield to the page between them.
|
|
101
|
+
|
|
102
|
+
`player.renderer` says where the player renders audio: `"audio-worklet"`, on
|
|
103
|
+
the audio thread, or `"main-thread"`, in a ScriptProcessorNode
|
|
104
|
+
(`preferMainThread`, or a browser without AudioWorklet). With the worklet a
|
|
105
|
+
preview cannot reach the audio. On the main thread its slices take turns with
|
|
106
|
+
the audio callbacks. In our measurements in desktop Chromium no callback ran
|
|
107
|
+
late during a 64-bar preview at any `bufferSize` from 256 to 2048, but a
|
|
108
|
+
slower device may drop out, so a caller that must not risk that can wait until
|
|
109
|
+
the player is stopped. On the worklet path the main-thread engine's wasm
|
|
110
|
+
memory stays with the page after `dispose()`. The page's main thread holds one
|
|
111
|
+
wasm module for every player on it, loaded from the first player's `wasmUrl`
|
|
112
|
+
(or the embedded bytes).
|
|
113
|
+
|
|
114
|
+
Pages that load the engine files themselves can call
|
|
115
|
+
`FugueEngine.previewNotes(json, requestJson)` from `dist/generated/fugue.js`
|
|
116
|
+
on an engine they made on the main thread or in a Worker; it resolves to the
|
|
117
|
+
answer as a JSON string and rejects with a string. Never call it in an
|
|
118
|
+
AudioWorklet, which has no `setTimeout`.
|
|
119
|
+
|
|
120
|
+
## Package Samples
|
|
121
|
+
|
|
122
|
+
The engine has no package cache, so a piece that plays a sample by package
|
|
123
|
+
ref (`fugue.demo.808-kit@^0.1:samples/kick.wav`) needs the sample handed to
|
|
124
|
+
it first. `provideSample` takes one file of a package by id, version and path,
|
|
125
|
+
decodes it at once and rejects, naming the sample, if it is not audio. A ref
|
|
126
|
+
then plays the highest provided version meeting its requirement; a ref with
|
|
127
|
+
none fails `loadInvention`, naming it. Provide a piece's samples before
|
|
128
|
+
loading it, and only the files it plays: each stays in memory, raw and
|
|
129
|
+
decoded, for the engine's lifetime. Decoding runs where the engine renders (a
|
|
130
|
+
worklet player's render thread), so provide them before the piece starts, not
|
|
131
|
+
while one plays.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
const index = await (await fetch(new URL("samples/index.json", base))).json();
|
|
135
|
+
const kit = index.packages.find((pack) => pack.id === "fugue.demo.808-kit");
|
|
136
|
+
const played = ["samples/kick.wav", "samples/snare.wav"];
|
|
137
|
+
for (const sample of kit.samples.filter((s) => played.includes(s.path))) {
|
|
138
|
+
const url = new URL(`samples/${kit.id}/${kit.version}/${sample.path}`, base);
|
|
139
|
+
const bytes = new Uint8Array(await (await fetch(url)).arrayBuffer());
|
|
140
|
+
await player.provideSample({
|
|
141
|
+
package: kit.id,
|
|
142
|
+
version: kit.version,
|
|
143
|
+
path: sample.path,
|
|
144
|
+
bytes,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
await player.loadInvention(invention);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The package carries the sample packs `samples.txt` lists, whole, under
|
|
151
|
+
`dist/samples/<id>/<version>/`, with `dist/samples/index.json` listing each
|
|
152
|
+
audio file's size and SHA-256, so a page that loads the engine from a CDN
|
|
153
|
+
fetches them from the same place (`base` above is the package's `dist/`).
|
|
154
|
+
Each is licensed for redistribution (the 808 kit is CC0-1.0). Samples given to
|
|
155
|
+
`provideSample` reach `previewNotes` too. On `dist/generated/fugue.js`, call
|
|
156
|
+
`FugueEngine.provideSample(package, version, path, bytes)` on an engine in the
|
|
157
|
+
same WebAssembly instance (an AudioWorklet's engine has an instance of its
|
|
158
|
+
own). WAV is decoded; FLAC is not, in the browser engine.
|
|
159
|
+
|
|
68
160
|
## Single-File Player
|
|
69
161
|
|
|
70
162
|
Each engine release also carries `fyug-player.html`, one self-contained page for
|
|
@@ -112,7 +204,9 @@ published by its own workflow, never from an ordinary push:
|
|
|
112
204
|
refuses a version npm already has, type-checks, tests and builds the
|
|
113
205
|
package from the pinned core, publishes the player and engine files on the
|
|
114
206
|
release `fyug-js-v<version>` of `Ilusiv-media/fyug`, then publishes the
|
|
115
|
-
package with npm trusted publishing (OIDC)
|
|
207
|
+
package with npm trusted publishing (OIDC), and ends once that publish
|
|
208
|
+
succeeds; if it fails, re-run the failed job after a minute. No npm token
|
|
209
|
+
exists anywhere.
|
|
116
210
|
|
|
117
211
|
See "Browser engine" in `docs/releasing.md`.
|
|
118
212
|
|
package/dist/FuguePlayer.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { ControlValue, FuguePlayerInstance, FuguePlayerOptions, RuntimeConnection, RuntimeControlGroup, RuntimeModule, RuntimeStatus } from "./types.js";
|
|
1
|
+
import type { ControlValue, FuguePlayerInstance, FuguePlayerOptions, FuguePlayerRenderer, NotePreview, NotePreviewRequest, PackageSample, RuntimeConnection, RuntimeControlGroup, RuntimeModule, RuntimeStatus } from "./types.js";
|
|
2
2
|
export declare class FuguePlayer implements FuguePlayerInstance {
|
|
3
|
+
readonly renderer: FuguePlayerRenderer;
|
|
3
4
|
private readonly context;
|
|
4
5
|
private readonly node;
|
|
5
6
|
private readonly destination;
|
|
6
7
|
private readonly options;
|
|
7
8
|
private readonly requests;
|
|
9
|
+
private readonly previewer;
|
|
8
10
|
private nextRequestId;
|
|
9
11
|
private connected;
|
|
10
12
|
private disposed;
|
|
@@ -25,6 +27,8 @@ export declare class FuguePlayer implements FuguePlayerInstance {
|
|
|
25
27
|
listControls(moduleId?: string): Promise<RuntimeControlGroup[]>;
|
|
26
28
|
getControl(moduleId: string, key: string): Promise<unknown>;
|
|
27
29
|
setControl(moduleId: string, key: string, value: ControlValue): Promise<void>;
|
|
30
|
+
provideSample(sample: PackageSample): Promise<void>;
|
|
31
|
+
previewNotes(json: string, request: NotePreviewRequest): Promise<NotePreview>;
|
|
28
32
|
dispose(): Promise<void>;
|
|
29
33
|
private request;
|
|
30
34
|
private handleMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FuguePlayer.d.ts","sourceRoot":"","sources":["../src/FuguePlayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FuguePlayer.d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O,CAAC,iBAAiB,EAAE,CAAC;IAI/C,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAO/D,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO3D,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,GAClB,OAAO,CAAC,IAAI,CAAC;IAIV,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAYnD,YAAY,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC;IAKjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB9B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,aAAa;IAmCrB,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,YAAY;CAKrB"}
|
package/dist/FuguePlayer.js
CHANGED
|
@@ -1,65 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
if (typeof value !== "string") {
|
|
5
|
-
throw new Error(`${method} returned a non-string JSON payload`);
|
|
6
|
-
}
|
|
7
|
-
try {
|
|
8
|
-
return JSON.parse(value);
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
throw new Error(`${method} returned invalid JSON: ${String(error)}`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import { FugueEngine } from "./generated/fugue.js";
|
|
2
|
+
import { NotePreviewer } from "./note-preview.js";
|
|
3
|
+
import { addWorkletModule, loadWasmBytes, loadWasmHere, parseJson, } from "./runtime-assets.js";
|
|
14
4
|
function createAudioContext(options) {
|
|
15
5
|
return (options.audioContext ??
|
|
16
6
|
new AudioContext(options.sampleRate === undefined
|
|
17
7
|
? undefined
|
|
18
8
|
: { sampleRate: options.sampleRate }));
|
|
19
9
|
}
|
|
20
|
-
async function loadWasmBytes(options) {
|
|
21
|
-
if (options.wasmUrl) {
|
|
22
|
-
return fetchWasmBytes(options.wasmUrl);
|
|
23
|
-
}
|
|
24
|
-
return decodeBase64Bytes(embeddedWasmBase64);
|
|
25
|
-
}
|
|
26
|
-
async function fetchWasmBytes(wasmUrl) {
|
|
27
|
-
const response = await fetch(wasmUrl);
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
throw new Error(`Unable to load Fugue wasm from ${wasmUrl.toString()}`);
|
|
30
|
-
}
|
|
31
|
-
return response.arrayBuffer();
|
|
32
|
-
}
|
|
33
|
-
function decodeBase64Bytes(base64) {
|
|
34
|
-
const binary = globalThis.atob(base64);
|
|
35
|
-
const bytes = new Uint8Array(binary.length);
|
|
36
|
-
for (let index = 0; index < binary.length; index += 1) {
|
|
37
|
-
bytes[index] = binary.charCodeAt(index);
|
|
38
|
-
}
|
|
39
|
-
return bytes.buffer;
|
|
40
|
-
}
|
|
41
|
-
async function addWorkletModule(context, options) {
|
|
42
|
-
if (options.workletUrl) {
|
|
43
|
-
await context.audioWorklet.addModule(options.workletUrl);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const blob = new Blob([embeddedWorkletSource], {
|
|
47
|
-
type: "application/javascript",
|
|
48
|
-
});
|
|
49
|
-
const workletUrl = URL.createObjectURL(blob);
|
|
50
|
-
try {
|
|
51
|
-
await context.audioWorklet.addModule(workletUrl);
|
|
52
|
-
}
|
|
53
|
-
finally {
|
|
54
|
-
URL.revokeObjectURL(workletUrl);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
10
|
export class FuguePlayer {
|
|
11
|
+
renderer = "audio-worklet";
|
|
58
12
|
context;
|
|
59
13
|
node;
|
|
60
14
|
destination;
|
|
61
15
|
options;
|
|
62
16
|
requests = new Map();
|
|
17
|
+
previewer;
|
|
63
18
|
nextRequestId = 1;
|
|
64
19
|
connected = false;
|
|
65
20
|
disposed = false;
|
|
@@ -72,6 +27,10 @@ export class FuguePlayer {
|
|
|
72
27
|
this.node = node;
|
|
73
28
|
this.destination = options.destination ?? context.destination;
|
|
74
29
|
this.options = options;
|
|
30
|
+
// The worklet's engine has no timers to work in slices with, and must
|
|
31
|
+
// not be held up: notes are listed on the main thread, on wasm loaded
|
|
32
|
+
// there on the first call.
|
|
33
|
+
this.previewer = new NotePreviewer(() => loadWasmHere(options), context.sampleRate);
|
|
75
34
|
this.node.port.onmessage = (event) => {
|
|
76
35
|
this.handleMessage(event.data);
|
|
77
36
|
};
|
|
@@ -156,11 +115,27 @@ export class FuguePlayer {
|
|
|
156
115
|
async setControl(moduleId, key, value) {
|
|
157
116
|
await this.request("setControl", [moduleId, key, value]);
|
|
158
117
|
}
|
|
118
|
+
async provideSample(sample) {
|
|
119
|
+
// The worklet's engine is a WebAssembly instance of its own; the
|
|
120
|
+
// previewer's gets the sample when it next lists notes.
|
|
121
|
+
await this.request("provideSample", [
|
|
122
|
+
sample.package,
|
|
123
|
+
sample.version,
|
|
124
|
+
sample.path,
|
|
125
|
+
sample.bytes,
|
|
126
|
+
]);
|
|
127
|
+
this.previewer.provide(sample);
|
|
128
|
+
}
|
|
129
|
+
async previewNotes(json, request) {
|
|
130
|
+
this.assertActive();
|
|
131
|
+
return this.previewer.preview(json, request);
|
|
132
|
+
}
|
|
159
133
|
async dispose() {
|
|
160
134
|
if (this.disposed) {
|
|
161
135
|
return;
|
|
162
136
|
}
|
|
163
137
|
this.stop();
|
|
138
|
+
this.previewer.dispose();
|
|
164
139
|
this.node.port.close();
|
|
165
140
|
if (this.connected) {
|
|
166
141
|
this.node.disconnect();
|
|
@@ -221,8 +196,12 @@ export class FuguePlayer {
|
|
|
221
196
|
}
|
|
222
197
|
}
|
|
223
198
|
class MainThreadFuguePlayer {
|
|
199
|
+
renderer = "main-thread";
|
|
224
200
|
context;
|
|
225
201
|
engine;
|
|
202
|
+
// Its own engine, beside the one that plays: wasm is already loaded here.
|
|
203
|
+
// Its slices share this thread with the audio callbacks.
|
|
204
|
+
previewer;
|
|
226
205
|
node;
|
|
227
206
|
destination;
|
|
228
207
|
options;
|
|
@@ -236,12 +215,13 @@ class MainThreadFuguePlayer {
|
|
|
236
215
|
this.node = node;
|
|
237
216
|
this.destination = options.destination ?? context.destination;
|
|
238
217
|
this.options = options;
|
|
218
|
+
this.previewer = new NotePreviewer(() => loadWasmHere(options), context.sampleRate);
|
|
239
219
|
this.node.onaudioprocess = (event) => {
|
|
240
220
|
this.process(event);
|
|
241
221
|
};
|
|
242
222
|
}
|
|
243
223
|
static async create(context, options = {}) {
|
|
244
|
-
await
|
|
224
|
+
await loadWasmHere(options);
|
|
245
225
|
const engine = new FugueEngine(context.sampleRate);
|
|
246
226
|
const node = context.createScriptProcessor(options.bufferSize ?? 1024, 0, 2);
|
|
247
227
|
return new MainThreadFuguePlayer(context, engine, node, options);
|
|
@@ -295,11 +275,26 @@ class MainThreadFuguePlayer {
|
|
|
295
275
|
return;
|
|
296
276
|
}
|
|
297
277
|
}
|
|
278
|
+
async provideSample(sample) {
|
|
279
|
+
this.assertActive();
|
|
280
|
+
try {
|
|
281
|
+
this.engine.provideSample(sample.package, sample.version, sample.path, sample.bytes);
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
throw toError(error);
|
|
285
|
+
}
|
|
286
|
+
this.previewer.provide(sample);
|
|
287
|
+
}
|
|
288
|
+
async previewNotes(json, request) {
|
|
289
|
+
this.assertActive();
|
|
290
|
+
return this.previewer.preview(json, request);
|
|
291
|
+
}
|
|
298
292
|
async dispose() {
|
|
299
293
|
if (this.disposed) {
|
|
300
294
|
return;
|
|
301
295
|
}
|
|
302
296
|
this.stop();
|
|
297
|
+
this.previewer.dispose();
|
|
303
298
|
this.node.onaudioprocess = null;
|
|
304
299
|
if (this.connected) {
|
|
305
300
|
this.node.disconnect();
|
package/dist/FuguePlayer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FugueP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AAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACb,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAEO,YAAY;QAClB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;CACF;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var W=Object.defineProperty;var O=(i,t,e)=>t in i?W(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var y=(i,t,e)=>O(i,typeof t!="symbol"?t+"":t,e);typeof globalThis.TextEncoder>"u"&&(globalThis.TextEncoder=class{encode(t=""){let e=[];for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<t.length){let s=t.charCodeAt(n+1);s>=56320&&s<=57343&&(r=65536+(r-55296<<10)+(s-56320),n+=1)}r<=127?e.push(r):r<=2047?e.push(192|r>>6,128|r&63):r<=65535?e.push(224|r>>12,128|r>>6&63,128|r&63):e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return new Uint8Array(e)}encodeInto(t,e){let n=this.encode(t),r=Math.min(n.length,e.length);return e.set(n.subarray(0,r)),{read:t.length,written:r}}});typeof globalThis.TextDecoder>"u"&&(globalThis.TextDecoder=class{decode(t=new Uint8Array){let e=t instanceof Uint8Array?t:new Uint8Array(t),n="";for(let r=0;r<e.length;r+=1){let s=e[r]??0;if(s<128)n+=String.fromCharCode(s);else if((s&224)===192&&r+1<e.length){let l=(s&31)<<6|(e[++r]??0)&63;n+=String.fromCharCode(l)}else if((s&240)===224&&r+2<e.length){let l=(s&15)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;n+=String.fromCharCode(l)}else if((s&248)===240&&r+3<e.length){let l=(s&7)<<18|((e[++r]??0)&63)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;l-=65536,n+=String.fromCharCode(55296+(l>>10),56320+(l&1023))}else n+="\uFFFD"}return n}});if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function"){let i=(Date.now()&4294967295^(typeof currentTime=="number"?currentTime*4294967295:0)>>>0)>>>0,t=()=>(i^=i<<13,i^=i>>>17,i^=i<<5,i&255),e={getRandomValues(n){if(!n||!ArrayBuffer.isView(n))throw new TypeError("Expected an integer typed array");let r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);for(let s=0;s<r.length;s+=1)r[s]=t();return n}};typeof globalThis.crypto>"u"?Object.defineProperty(globalThis,"crypto",{configurable:!0,value:e}):Object.defineProperty(globalThis.crypto,"getRandomValues",{configurable:!0,value:e.getRandomValues})}var $={},h=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,R.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_fugueengine_free(t,0)}addModule(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c;var a=S(n)?0:f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c;let u=o.fugueengine_addModule(this.__wbg_ptr,r,s,l,_,a,g);if(u[1])throw d(u[0])}connect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,b=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),M=c,p=o.fugueengine_connect(this.__wbg_ptr,s,l,_,a,g,u,b,M);if(p[1])throw d(p[0])}disconnect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,b=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),M=c,p=o.fugueengine_disconnect(this.__wbg_ptr,s,l,_,a,g,u,b,M);if(p[1])throw d(p[0])}finishAudioFileSink(t){let e,n;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_finishAudioFileSink(this.__wbg_ptr,l,_);var r=a[0],s=a[1];if(a[3])throw r=0,s=0,d(a[2]);return e=r,n=s,w(r,s)}finally{o.__wbindgen_free(e,n,1)}}getAudioFileSinkWav(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_getAudioFileSinkWav(this.__wbg_ptr,e,n);if(r[3])throw d(r[2]);var s=B(r[0],r[1]).slice();return o.__wbindgen_free(r[0],r[1]*1,1),s}getCodeModuleConfig(t){let e,n;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_getCodeModuleConfig(this.__wbg_ptr,l,_);var r=a[0],s=a[1];if(a[3])throw r=0,s=0,d(a[2]);return e=r,n=s,w(r,s)}finally{o.__wbindgen_free(e,n,1)}}getControl(t,e){let n,r;try{let _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,b=o.fugueengine_getControl(this.__wbg_ptr,_,a,g,u);var s=b[0],l=b[1];if(b[3])throw s=0,l=0,d(b[2]);return n=s,r=l,w(s,l)}finally{o.__wbindgen_free(n,r,1)}}listCodeModules(){let t,e;try{let s=o.fugueengine_listCodeModules(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}listConnections(){let t,e;try{let s=o.fugueengine_listConnections(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}listControls(t){let e,n;try{var r=S(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c;let a=o.fugueengine_listControls(this.__wbg_ptr,r,s);var l=a[0],_=a[1];if(a[3])throw l=0,_=0,d(a[2]);return e=l,n=_,w(l,_)}finally{o.__wbindgen_free(e,n,1)}}listModules(){let t,e;try{let s=o.fugueengine_listModules(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}loadInvention(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_loadInvention(this.__wbg_ptr,e,n);if(r[1])throw d(r[0])}constructor(t){let e=o.fugueengine_new(t);return this.__wbg_ptr=e,R.register(this,this.__wbg_ptr,this),this}removeModule(t){let e=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=c,r=o.fugueengine_removeModule(this.__wbg_ptr,e,n);if(r[1])throw d(r[0])}renderInterleavedInto(t){let e=o.fugueengine_renderInterleavedInto(this.__wbg_ptr,t);if(e[2])throw d(e[1]);return e[0]>>>0}renderInterleaved(t){let e=o.fugueengine_renderInterleaved(this.__wbg_ptr,t);if(e[3])throw d(e[2]);var n=F(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*4,4),n}reset(){let t=o.fugueengine_reset(this.__wbg_ptr);if(t[1])throw d(t[0])}sampleRate(){return o.fugueengine_sampleRate(this.__wbg_ptr)>>>0}setCodeModuleError(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=o.fugueengine_setCodeModuleError(this.__wbg_ptr,n,r,s,l);if(_[1])throw d(_[0])}setCodeModuleStatus(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c,_=o.fugueengine_setCodeModuleStatus(this.__wbg_ptr,n,r,s,l);if(_[1])throw d(_[0])}setControlBool(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_setControlBool(this.__wbg_ptr,r,s,l,_,n);if(a[1])throw d(a[0])}setControlNumber(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=o.fugueengine_setControlNumber(this.__wbg_ptr,r,s,l,_,n);if(a[1])throw d(a[0])}setControlString(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,a=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),g=c,u=o.fugueengine_setControlString(this.__wbg_ptr,r,s,l,_,a,g);if(u[1])throw d(u[0])}status(){let t,e;try{let s=o.fugueengine_status(this.__wbg_ptr);var n=s[0],r=s[1];if(s[3])throw n=0,r=0,d(s[2]);return t=n,e=r,w(n,r)}finally{o.__wbindgen_free(t,e,1)}}};Symbol.dispose&&(h.prototype[Symbol.dispose]=h.prototype.free);function k(){return{__proto__:null,"./fugue_bg.js":{__proto__:null,__wbg___wbindgen_throw_41e9ee4f547fc59a:function(t,e){throw new Error(w(t,e))},__wbg_getRandomValues_436a51d0629d84e1:function(){return D(function(t,e){globalThis.crypto.getRandomValues(B(t,e))},arguments)},__wbg_length_58572db4c38f3c3e:function(t){return t.length},__wbg_set_070bd465f1c195a4:function(t,e,n){t.set(F(e,n))},__wbindgen_generic_0000000000000001:function(t,e){return w(t,e)},__wbindgen_init_externref_table:function(){let t=o.__wbindgen_externrefs,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)}}}}var R=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>o.__wbg_fugueengine_free(i,1));function U(i){let t=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(t,i),t}function F(i,t){return i=i>>>0,V().subarray(i/4,i/4+t)}function B(i,t){return i=i>>>0,v().subarray(i/1,i/1+t)}var m=null;function V(){return(m===null||m.byteLength===0)&&(m=new Float32Array(o.memory.buffer)),m}function w(i,t){return j(i>>>0,t)}var x=null;function v(){return(x===null||x.byteLength===0)&&(x=new Uint8Array(o.memory.buffer)),x}function D(i,t){try{return i.apply(this,t)}catch(e){let n=U(e);o.__wbindgen_exn_store(n)}}function S(i){return i==null}function f(i,t,e){if(e===void 0){let _=C.encode(i),a=t(_.length,1)>>>0;return v().subarray(a,a+_.length).set(_),c=_.length,a}let n=i.length,r=t(n,1)>>>0,s=v(),l=0;for(;l<n;l++){let _=i.charCodeAt(l);if(_>127)break;s[r+l]=_}if(l!==n){l!==0&&(i=i.slice(l)),r=e(r,n,n=l+i.length*3,1)>>>0;let _=v().subarray(r+l,r+n),a=C.encodeInto(i,_);l+=a.written,r=e(r,n,l,1)>>>0}return c=l,r}function d(i){let t=o.__wbindgen_externrefs.get(i);return o.__externref_table_dealloc(i),t}var A=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});A.decode();var P=2146435072,T=0;function j(i,t){return T+=t,T>=P&&(A=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),A.decode(),T=t),A.decode(v().subarray(i,i+t))}var C=new TextEncoder;"encodeInto"in C||(C.encodeInto=function(i,t){let e=C.encode(i);return t.set(e),{read:i.length,written:e.length}});var c=0,q,L,o;function z(i,t){return L=i,o=i.exports,q=t,m=null,x=null,o.__wbindgen_start(),o}async function N(i,t){if(typeof Response=="function"&&i instanceof Response){if(!i.ok)throw new Error(`failed to fetch Wasm: ${i.status} ${i.statusText} fetching '${i.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(r){if(e(i.type)&&i.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await i.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(i,t);return n instanceof WebAssembly.Instance?{instance:n,module:i}:n}function e(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}async function I(i){if(o!==void 0)return o;i!==void 0&&(Object.getPrototypeOf(i)===Object.prototype?{module_or_path:i}=i:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),i===void 0&&(i=new URL("fugue_bg.wasm",$.url));let t=k();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));let{instance:e,module:n}=await N(await i,t);return z(e,n)}var E=class extends AudioWorkletProcessor{constructor(e){super();y(this,"engine",null);y(this,"ready",!1);y(this,"playing",!1);y(this,"renderBuffer",new Float32Array(0));this.port.onmessage=n=>{this.handleMessage(n.data)},this.initialize(e?.processorOptions??{})}async initialize(e){try{await I({module_or_path:e.wasmBytes}),this.engine=new h(e.sampleRate??sampleRate),this.ready=!0,this.port.postMessage({type:"ready"})}catch(n){this.postError(n)}}handleMessage(e){if(!(!e||typeof e!="object")){if(e.type==="play"){this.playing=!0,this.port.postMessage({type:"state",state:"playing"});return}if(e.type==="stop"){this.playing=!1,this.port.postMessage({type:"state",state:"stopped"});return}if(e.type==="request")try{let n=this.handleRequest(e.method,e.args??[]);this.port.postMessage({type:"response",id:e.id,result:n})}catch(n){this.port.postMessage({type:"response",id:e.id,error:n instanceof Error?n.message:String(n)})}}}handleRequest(e,n){if(!this.ready||!this.engine)throw new Error("Fugue engine is not ready");switch(e){case"loadInvention":return this.engine.loadInvention(n[0]),null;case"reset":return this.engine.reset(),null;case"status":return this.engine.status();case"listModules":return this.engine.listModules();case"listConnections":return this.engine.listConnections();case"listControls":return this.engine.listControls(n[0]);case"getControl":return this.engine.getControl(n[0],n[1]);case"setControl":return this.setControl(n[0],n[1],n[2]),null;default:throw new Error(`Unknown Fugue player method: ${e}`)}}setControl(e,n,r){switch(typeof r){case"number":this.engine?.setControlNumber(e,n,r);return;case"boolean":this.engine?.setControlBool(e,n,r);return;case"string":this.engine?.setControlString(e,n,r);return}}process(e,n){let r=n[0],s=r?.[0],l=r?.[1];if(!s||!l)return!0;if(!this.playing||!this.ready||!this.engine)return s.fill(0),l.fill(0),!0;let _=s.length,a=_*2;this.renderBuffer.length!==a&&(this.renderBuffer=new Float32Array(a));try{this.engine.renderInterleavedInto(this.renderBuffer);for(let g=0,u=0;g<_;g+=1,u+=2)s[g]=this.renderBuffer[u]??0,l[g]=this.renderBuffer[u+1]??0}catch(g){this.playing=!1,s.fill(0),l.fill(0),this.postError(g)}return!0}postError(e){this.port.postMessage({type:"error",error:e instanceof Error?e.message:String(e)})}};registerProcessor("fugue-audio-worklet",E);})();
|
|
1
|
+
"use strict";(()=>{var P=Object.defineProperty;var j=(i,t,e)=>t in i?P(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var x=(i,t,e)=>j(i,typeof t!="symbol"?t+"":t,e);typeof globalThis.TextEncoder>"u"&&(globalThis.TextEncoder=class{encode(t=""){let e=[];for(let n=0;n<t.length;n+=1){let o=t.charCodeAt(n);if(o>=55296&&o<=56319&&n+1<t.length){let s=t.charCodeAt(n+1);s>=56320&&s<=57343&&(o=65536+(o-55296<<10)+(s-56320),n+=1)}o<=127?e.push(o):o<=2047?e.push(192|o>>6,128|o&63):o<=65535?e.push(224|o>>12,128|o>>6&63,128|o&63):e.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|o&63)}return new Uint8Array(e)}encodeInto(t,e){let n=this.encode(t),o=Math.min(n.length,e.length);return e.set(n.subarray(0,o)),{read:t.length,written:o}}});typeof globalThis.TextDecoder>"u"&&(globalThis.TextDecoder=class{decode(t=new Uint8Array){let e=t instanceof Uint8Array?t:new Uint8Array(t),n="";for(let o=0;o<e.length;o+=1){let s=e[o]??0;if(s<128)n+=String.fromCharCode(s);else if((s&224)===192&&o+1<e.length){let _=(s&31)<<6|(e[++o]??0)&63;n+=String.fromCharCode(_)}else if((s&240)===224&&o+2<e.length){let _=(s&15)<<12|((e[++o]??0)&63)<<6|(e[++o]??0)&63;n+=String.fromCharCode(_)}else if((s&248)===240&&o+3<e.length){let _=(s&7)<<18|((e[++o]??0)&63)<<12|((e[++o]??0)&63)<<6|(e[++o]??0)&63;_-=65536,n+=String.fromCharCode(55296+(_>>10),56320+(_&1023))}else n+="\uFFFD"}return n}});if(typeof globalThis.crypto>"u"||typeof globalThis.crypto.getRandomValues!="function"){let i=(Date.now()&4294967295^(typeof currentTime=="number"?currentTime*4294967295:0)>>>0)>>>0,t=()=>(i^=i<<13,i^=i>>>17,i^=i<<5,i&255),e={getRandomValues(n){if(!n||!ArrayBuffer.isView(n))throw new TypeError("Expected an integer typed array");let o=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);for(let s=0;s<o.length;s+=1)o[s]=t();return n}};typeof globalThis.crypto>"u"?Object.defineProperty(globalThis,"crypto",{configurable:!0,value:e}):Object.defineProperty(globalThis.crypto,"getRandomValues",{configurable:!0,value:e.getRandomValues})}var ee={},y=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,E.unregister(this),t}free(){let t=this.__destroy_into_raw();r.__wbg_fugueengine_free(t,0)}addModule(t,e,n){let o=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),s=c,_=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),l=c;var a=W(n)?0:f(n,r.__wbindgen_malloc,r.__wbindgen_realloc),g=c;let u=r.fugueengine_addModule(this.__wbg_ptr,o,s,_,l,a,g);if(u[1])throw d(u[0])}connect(t,e,n,o){let s=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),_=c,l=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),a=c,g=f(n,r.__wbindgen_malloc,r.__wbindgen_realloc),u=c,w=f(o,r.__wbindgen_malloc,r.__wbindgen_realloc),m=c,p=r.fugueengine_connect(this.__wbg_ptr,s,_,l,a,g,u,w,m);if(p[1])throw d(p[0])}disconnect(t,e,n,o){let s=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),_=c,l=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),a=c,g=f(n,r.__wbindgen_malloc,r.__wbindgen_realloc),u=c,w=f(o,r.__wbindgen_malloc,r.__wbindgen_realloc),m=c,p=r.fugueengine_disconnect(this.__wbg_ptr,s,_,l,a,g,u,w,m);if(p[1])throw d(p[0])}finishAudioFileSink(t){let e,n;try{let _=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),l=c,a=r.fugueengine_finishAudioFileSink(this.__wbg_ptr,_,l);var o=a[0],s=a[1];if(a[3])throw o=0,s=0,d(a[2]);return e=o,n=s,b(o,s)}finally{r.__wbindgen_free(e,n,1)}}getAudioFileSinkWav(t){let e=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),n=c,o=r.fugueengine_getAudioFileSinkWav(this.__wbg_ptr,e,n);if(o[3])throw d(o[2]);var s=I(o[0],o[1]).slice();return r.__wbindgen_free(o[0],o[1]*1,1),s}getCodeModuleConfig(t){let e,n;try{let _=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),l=c,a=r.fugueengine_getCodeModuleConfig(this.__wbg_ptr,_,l);var o=a[0],s=a[1];if(a[3])throw o=0,s=0,d(a[2]);return e=o,n=s,b(o,s)}finally{r.__wbindgen_free(e,n,1)}}getControl(t,e){let n,o;try{let l=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),a=c,g=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),u=c,w=r.fugueengine_getControl(this.__wbg_ptr,l,a,g,u);var s=w[0],_=w[1];if(w[3])throw s=0,_=0,d(w[2]);return n=s,o=_,b(s,_)}finally{r.__wbindgen_free(n,o,1)}}listCodeModules(){let t,e;try{let s=r.fugueengine_listCodeModules(this.__wbg_ptr);var n=s[0],o=s[1];if(s[3])throw n=0,o=0,d(s[2]);return t=n,e=o,b(n,o)}finally{r.__wbindgen_free(t,e,1)}}listConnections(){let t,e;try{let s=r.fugueengine_listConnections(this.__wbg_ptr);var n=s[0],o=s[1];if(s[3])throw n=0,o=0,d(s[2]);return t=n,e=o,b(n,o)}finally{r.__wbindgen_free(t,e,1)}}listControls(t){let e,n;try{var o=W(t)?0:f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),s=c;let a=r.fugueengine_listControls(this.__wbg_ptr,o,s);var _=a[0],l=a[1];if(a[3])throw _=0,l=0,d(a[2]);return e=_,n=l,b(_,l)}finally{r.__wbindgen_free(e,n,1)}}listModules(){let t,e;try{let s=r.fugueengine_listModules(this.__wbg_ptr);var n=s[0],o=s[1];if(s[3])throw n=0,o=0,d(s[2]);return t=n,e=o,b(n,o)}finally{r.__wbindgen_free(t,e,1)}}loadInvention(t){let e=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),n=c,o=r.fugueengine_loadInvention(this.__wbg_ptr,e,n);if(o[1])throw d(o[0])}constructor(t){let e=r.fugueengine_new(t);return this.__wbg_ptr=e,E.register(this,this.__wbg_ptr,this),this}previewNotes(t,e){let n=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),o=c,s=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),_=c;return r.fugueengine_previewNotes(this.__wbg_ptr,n,o,s,_)}provideSample(t,e,n,o){let s,_;try{let g=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),u=c,w=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),m=c,p=f(n,r.__wbindgen_malloc,r.__wbindgen_realloc),U=c,D=Y(o,r.__wbindgen_malloc),V=c,T=r.fugueengine_provideSample(this.__wbg_ptr,g,u,w,m,p,U,D,V);var l=T[0],a=T[1];if(T[3])throw l=0,a=0,d(T[2]);return s=l,_=a,b(l,a)}finally{r.__wbindgen_free(s,_,1)}}removeModule(t){let e=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),n=c,o=r.fugueengine_removeModule(this.__wbg_ptr,e,n);if(o[1])throw d(o[0])}renderInterleavedInto(t){let e=r.fugueengine_renderInterleavedInto(this.__wbg_ptr,t);if(e[2])throw d(e[1]);return e[0]>>>0}renderInterleaved(t){let e=r.fugueengine_renderInterleaved(this.__wbg_ptr,t);if(e[3])throw d(e[2]);var n=k(e[0],e[1]).slice();return r.__wbindgen_free(e[0],e[1]*4,4),n}reset(){let t=r.fugueengine_reset(this.__wbg_ptr);if(t[1])throw d(t[0])}sampleRate(){return r.fugueengine_sampleRate(this.__wbg_ptr)>>>0}setCodeModuleError(t,e){let n=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),o=c,s=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),_=c,l=r.fugueengine_setCodeModuleError(this.__wbg_ptr,n,o,s,_);if(l[1])throw d(l[0])}setCodeModuleStatus(t,e){let n=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),o=c,s=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),_=c,l=r.fugueengine_setCodeModuleStatus(this.__wbg_ptr,n,o,s,_);if(l[1])throw d(l[0])}setControlBool(t,e,n){let o=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),s=c,_=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),l=c,a=r.fugueengine_setControlBool(this.__wbg_ptr,o,s,_,l,n);if(a[1])throw d(a[0])}setControlNumber(t,e,n){let o=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),s=c,_=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),l=c,a=r.fugueengine_setControlNumber(this.__wbg_ptr,o,s,_,l,n);if(a[1])throw d(a[0])}setControlString(t,e,n){let o=f(t,r.__wbindgen_malloc,r.__wbindgen_realloc),s=c,_=f(e,r.__wbindgen_malloc,r.__wbindgen_realloc),l=c,a=f(n,r.__wbindgen_malloc,r.__wbindgen_realloc),g=c,u=r.fugueengine_setControlString(this.__wbg_ptr,o,s,_,l,a,g);if(u[1])throw d(u[0])}status(){let t,e;try{let s=r.fugueengine_status(this.__wbg_ptr);var n=s[0],o=s[1];if(s[3])throw n=0,o=0,d(s[2]);return t=n,e=o,b(n,o)}finally{r.__wbindgen_free(t,e,1)}}};Symbol.dispose&&(y.prototype[Symbol.dispose]=y.prototype.free);function q(){return{__proto__:null,"./fugue_bg.js":{__proto__:null,__wbg___wbindgen_throw_41e9ee4f547fc59a:function(t,e){throw new Error(b(t,e))},__wbg__wbg_cb_unref_dcc1a90847f04c41:function(t){t._wbg_cb_unref()},__wbg_call_187d372bd5fdd4aa:function(){return B(function(t,e,n){return t.call(e,n)},arguments)},__wbg_getRandomValues_436a51d0629d84e1:function(){return B(function(t,e){globalThis.crypto.getRandomValues(I(t,e))},arguments)},__wbg_length_58572db4c38f3c3e:function(t){return t.length},__wbg_new_5502aad30c185fc8:function(t,e){try{var n={a:t,b:e},o=(_,l)=>{let a=n.a;n.a=0;try{return L(a,n.b,_,l)}finally{n.a=a}};return new Promise(o)}finally{n.a=0}},__wbg_now_aa4ccb83129e9e55:function(){return Date.now()},__wbg_setTimeout_4bf75e1eaccfc9e2:function(t,e){return setTimeout(t,e)},__wbg_set_070bd465f1c195a4:function(t,e,n){t.set(k(e,n))},__wbindgen_generic_0000000000000001:function(t,e){return X(t,e,z)},__wbindgen_generic_0000000000000002:function(t,e){return b(t,e)},__wbindgen_init_externref_table:function(){let t=r.__wbindgen_externrefs,e=t.grow(4);t.set(0,void 0),t.set(e+0,void 0),t.set(e+1,null),t.set(e+2,!0),t.set(e+3,!1)}}}}function z(i,t){r.wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74(i,t)}function L(i,t,e,n){r.wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(i,t,e,n)}var E=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>r.__wbg_fugueengine_free(i,1));function N(i){let t=r.__externref_table_alloc();return r.__wbindgen_externrefs.set(t,i),t}var F=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>r.__wbindgen_destroy_closure(i.a,i.b));function k(i,t){return i=i>>>0,$().subarray(i/4,i/4+t)}function I(i,t){return i=i>>>0,h().subarray(i/1,i/1+t)}var v=null;function $(){return(v===null||v.byteLength===0)&&(v=new Float32Array(r.memory.buffer)),v}function b(i,t){return H(i>>>0,t)}var C=null;function h(){return(C===null||C.byteLength===0)&&(C=new Uint8Array(r.memory.buffer)),C}function B(i,t){try{return i.apply(this,t)}catch(e){let n=N(e);r.__wbindgen_exn_store(n)}}function W(i){return i==null}function X(i,t,e){let n={a:i,b:t,cnt:1},o=(...s)=>{n.cnt++;let _=n.a;n.a=0;try{return e(_,n.b,...s)}finally{n.a=_,o._wbg_cb_unref()}};return o._wbg_cb_unref=()=>{--n.cnt===0&&(r.__wbindgen_destroy_closure(n.a,n.b),n.a=0,F.unregister(n))},F.register(o,n,n),o}function Y(i,t){let e=t(i.length*1,1)>>>0;return h().set(i,e/1),c=i.length,e}function f(i,t,e){if(e===void 0){let l=A.encode(i),a=t(l.length,1)>>>0;return h().subarray(a,a+l.length).set(l),c=l.length,a}let n=i.length,o=t(n,1)>>>0,s=h(),_=0;for(;_<n;_++){let l=i.charCodeAt(_);if(l>127)break;s[o+_]=l}if(_!==n){_!==0&&(i=i.slice(_)),o=e(o,n,n=_+i.length*3,1)>>>0;let l=h().subarray(o+_,o+n),a=A.encodeInto(i,l);_+=a.written,o=e(o,n,_,1)>>>0}return c=_,o}function d(i){let t=r.__wbindgen_externrefs.get(i);return r.__externref_table_dealloc(i),t}var M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});M.decode();var G=2146435072,S=0;function H(i,t){return S+=t,S>=G&&(M=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),M.decode(),S=t),M.decode(h().subarray(i,i+t))}var A=new TextEncoder;"encodeInto"in A||(A.encodeInto=function(i,t){let e=A.encode(i);return t.set(e),{read:i.length,written:e.length}});var c=0,J,K,r;function Q(i,t){return K=i,r=i.exports,J=t,v=null,C=null,r.__wbindgen_start(),r}async function Z(i,t){if(typeof Response=="function"&&i instanceof Response){if(!i.ok)throw new Error(`failed to fetch Wasm: ${i.status} ${i.statusText} fetching '${i.url}'`);if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(i,t)}catch(o){if(e(i.type)&&i.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let n=await i.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(i,t);return n instanceof WebAssembly.Instance?{instance:n,module:i}:n}function e(n){switch(n){case"basic":case"cors":case"default":return!0}return!1}}async function O(i){if(r!==void 0)return r;i!==void 0&&(Object.getPrototypeOf(i)===Object.prototype?{module_or_path:i}=i:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),i===void 0&&(i=new URL("fugue_bg.wasm",ee.url));let t=q();(typeof i=="string"||typeof Request=="function"&&i instanceof Request||typeof URL=="function"&&i instanceof URL)&&(i=fetch(i));let{instance:e,module:n}=await Z(await i,t);return Q(e,n)}var R=class extends AudioWorkletProcessor{constructor(e){super();x(this,"engine",null);x(this,"ready",!1);x(this,"playing",!1);x(this,"renderBuffer",new Float32Array(0));this.port.onmessage=n=>{this.handleMessage(n.data)},this.initialize(e?.processorOptions??{})}async initialize(e){try{await O({module_or_path:e.wasmBytes}),this.engine=new y(e.sampleRate??sampleRate),this.ready=!0,this.port.postMessage({type:"ready"})}catch(n){this.postError(n)}}handleMessage(e){if(!(!e||typeof e!="object")){if(e.type==="play"){this.playing=!0,this.port.postMessage({type:"state",state:"playing"});return}if(e.type==="stop"){this.playing=!1,this.port.postMessage({type:"state",state:"stopped"});return}if(e.type==="request")try{let n=this.handleRequest(e.method,e.args??[]);this.port.postMessage({type:"response",id:e.id,result:n})}catch(n){this.port.postMessage({type:"response",id:e.id,error:n instanceof Error?n.message:String(n)})}}}handleRequest(e,n){if(!this.ready||!this.engine)throw new Error("Fugue engine is not ready");switch(e){case"loadInvention":return this.engine.loadInvention(n[0]),null;case"reset":return this.engine.reset(),null;case"provideSample":return this.engine.provideSample(n[0],n[1],n[2],n[3]),null;case"status":return this.engine.status();case"listModules":return this.engine.listModules();case"listConnections":return this.engine.listConnections();case"listControls":return this.engine.listControls(n[0]);case"getControl":return this.engine.getControl(n[0],n[1]);case"setControl":return this.setControl(n[0],n[1],n[2]),null;default:throw new Error(`Unknown Fugue player method: ${e}`)}}setControl(e,n,o){switch(typeof o){case"number":this.engine?.setControlNumber(e,n,o);return;case"boolean":this.engine?.setControlBool(e,n,o);return;case"string":this.engine?.setControlString(e,n,o);return}}process(e,n){let o=n[0],s=o?.[0],_=o?.[1];if(!s||!_)return!0;if(!this.playing||!this.ready||!this.engine)return s.fill(0),_.fill(0),!0;let l=s.length,a=l*2;this.renderBuffer.length!==a&&(this.renderBuffer=new Float32Array(a));try{this.engine.renderInterleavedInto(this.renderBuffer);for(let g=0,u=0;g<l;g+=1,u+=2)s[g]=this.renderBuffer[u]??0,_[g]=this.renderBuffer[u+1]??0}catch(g){this.playing=!1,s.fill(0),_.fill(0),this.postError(g)}return!0}postError(e){this.port.postMessage({type:"error",error:e instanceof Error?e.message:String(e)})}};registerProcessor("fugue-audio-worklet",R);})();
|