@ilusiv/fyug-js 2026.11.6 → 2026.11.8
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 +75 -0
- package/dist/FuguePlayer.d.ts +1 -0
- package/dist/FuguePlayer.d.ts.map +1 -1
- package/dist/FuguePlayer.js +25 -1
- package/dist/FuguePlayer.js.map +1 -1
- package/dist/edit-refusal.d.ts +25 -0
- package/dist/edit-refusal.d.ts.map +1 -0
- package/dist/edit-refusal.js +34 -0
- package/dist/edit-refusal.js.map +1 -0
- package/dist/fugue-audio-worklet.js +1 -1
- 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 +13 -0
- package/dist/generated/fugue.js +21 -1
- package/dist/generated/fugue_bg.wasm +0 -0
- package/dist/generated/fugue_bg.wasm.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,45 @@ 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
|
+
## Editing While It Plays
|
|
69
|
+
|
|
70
|
+
`applyEdits` changes the loaded piece's graph without restarting what
|
|
71
|
+
survives. It takes a JSON array of the daemon's `apply_edits` operations
|
|
72
|
+
(`add_module`, `remove_module`, `connect`, `disconnect`), applied in order as
|
|
73
|
+
one change:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
await player.applyEdits(
|
|
77
|
+
JSON.stringify([
|
|
78
|
+
{
|
|
79
|
+
op: "add_module",
|
|
80
|
+
id: "pad",
|
|
81
|
+
module_type: "oscillator",
|
|
82
|
+
config: { frequency: 330 },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
op: "connect",
|
|
86
|
+
from: "pad",
|
|
87
|
+
from_port: "audio",
|
|
88
|
+
to: "mix",
|
|
89
|
+
to_port: "audio.1",
|
|
90
|
+
},
|
|
91
|
+
]),
|
|
92
|
+
);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
A batch applies whole or not at all. When any edit cannot apply, it rejects
|
|
96
|
+
with an `EditRefusal`: an `Error` whose message names the first edit to blame
|
|
97
|
+
(`edit 1 (connect) refused: ...; nothing was applied`), with `code` and, for
|
|
98
|
+
that edit, `edit.index`, `edit.op`, `edit.reason` and `edit.message`. A batch
|
|
99
|
+
refused as a whole has no `edit`, and its `code` says why: `invalid_request`
|
|
100
|
+
for an empty batch, one past the engine's limit, malformed JSON or a
|
|
101
|
+
document-only operation (`set_control`, `move_modules`, `name_modules`), which
|
|
102
|
+
a host that keeps the document writes itself, setting controls with
|
|
103
|
+
`setControl`. Added modules are built where the engine renders, on the
|
|
104
|
+
AudioWorklet's render thread between renders, so a batch adding heavy modules
|
|
105
|
+
can delay the next render: keep batches small while it plays.
|
|
106
|
+
|
|
68
107
|
## Previewing Notes
|
|
69
108
|
|
|
70
109
|
`previewNotes(json, request)` lists the notes a document will play over a
|
|
@@ -157,6 +196,42 @@ Each is licensed for redistribution (the 808 kit is CC0-1.0). Samples given to
|
|
|
157
196
|
same WebAssembly instance (an AudioWorklet's engine has an instance of its
|
|
158
197
|
own). WAV is decoded; FLAC is not, in the browser engine.
|
|
159
198
|
|
|
199
|
+
## Reading What Plays
|
|
200
|
+
|
|
201
|
+
A page that drives the worklet's message protocol itself (posting
|
|
202
|
+
`{ type: "request", id, method, args }` and reading `{ type: "response", id,
|
|
203
|
+
result | error }`) can ask it for what a meter and a playhead show with the
|
|
204
|
+
`views` request. `args` is `[clock]`, the id of the clock whose beats the
|
|
205
|
+
playhead follows, or `[]`. The answer covers everything rendered since the
|
|
206
|
+
last `views` request, which starts the next reading over:
|
|
207
|
+
|
|
208
|
+
- `levels`: the engine's `takeLevels()` JSON, with each channel's peak and
|
|
209
|
+
RMS before the output clamp, the count of samples over full scale, the count
|
|
210
|
+
of non-finite samples, and `frames`.
|
|
211
|
+
- `squares`: `[left, right]`, the sums of squares of the samples the worklet
|
|
212
|
+
sent the device, after the clamp, over `frames` frames: the level that is
|
|
213
|
+
heard. RMS is `Math.sqrt(squares[i] / frames)`. `levels.frames` and `frames`
|
|
214
|
+
count the same frames; a load or reset starts both over.
|
|
215
|
+
- `beats`: the clock's `elapsed` control (a JSON number as a string), or
|
|
216
|
+
`null` when no clock was named or the piece has none by that id.
|
|
217
|
+
- `time`: the worklet's `currentTime`, where the rendered audio, and `beats`,
|
|
218
|
+
end. A page maps it to what is heard with `AudioContext.getOutputTimestamp()`.
|
|
219
|
+
|
|
220
|
+
Nothing counts while the piece is stopped. The request adds two multiply-adds
|
|
221
|
+
per frame to `process()`, into numbers the worklet already holds, and nothing
|
|
222
|
+
else there. Like every request, the answer is built on the render thread
|
|
223
|
+
between renders; it allocates the `levels` and `beats` strings (in the wasm
|
|
224
|
+
memory and as JS strings), the answer object and its two-element `squares`
|
|
225
|
+
array, besides the response message every request posts. A clock the piece
|
|
226
|
+
lacks is looked up once, not on each request, until the next load or edit.
|
|
227
|
+
Ask at most once per animation frame and not while an answer is still on its
|
|
228
|
+
way.
|
|
229
|
+
|
|
230
|
+
Before a piece is loaded the request fails like the others do. A worklet older
|
|
231
|
+
than this request answers it with the error
|
|
232
|
+
`Unknown Fugue player method: views`: a page that gets that error can stop
|
|
233
|
+
asking, show no views and play on.
|
|
234
|
+
|
|
160
235
|
## Single-File Player
|
|
161
236
|
|
|
162
237
|
Each engine release also carries `fyug-player.html`, one self-contained page for
|
package/dist/FuguePlayer.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare class FuguePlayer implements FuguePlayerInstance {
|
|
|
27
27
|
listControls(moduleId?: string): Promise<RuntimeControlGroup[]>;
|
|
28
28
|
getControl(moduleId: string, key: string): Promise<unknown>;
|
|
29
29
|
setControl(moduleId: string, key: string, value: ControlValue): Promise<void>;
|
|
30
|
+
applyEdits(edits: string): Promise<void>;
|
|
30
31
|
provideSample(sample: PackageSample): Promise<void>;
|
|
31
32
|
previewNotes(json: string, request: NotePreviewRequest): Promise<NotePreview>;
|
|
32
33
|
dispose(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FuguePlayer.d.ts","sourceRoot":"","sources":["../src/FuguePlayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FuguePlayer.d.ts","sourceRoot":"","sources":["../src/FuguePlayer.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EAEnB,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACd,MAAM,YAAY,CAAC;AA+BpB,qBAAa,WAAY,YAAW,mBAAmB;IACrD,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAmB;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAY;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAC1C,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAA+B;IAC5C,OAAO,CAAC,YAAY,CAAC,CAAgB;IACrC,OAAO,CAAC,YAAY,CAAC,CAAa;IAClC,OAAO,CAAC,WAAW,CAAC,CAAyB;IAE7C,OAAO;WA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
import { NotePreviewer } from "./note-preview.js";
|
|
3
4
|
import { addWorkletModule, loadWasmBytes, loadWasmHere, parseJson, } from "./runtime-assets.js";
|
|
@@ -115,6 +116,14 @@ export class FuguePlayer {
|
|
|
115
116
|
async setControl(moduleId, key, value) {
|
|
116
117
|
await this.request("setControl", [moduleId, key, value]);
|
|
117
118
|
}
|
|
119
|
+
async applyEdits(edits) {
|
|
120
|
+
try {
|
|
121
|
+
await this.request("applyEdits", [edits]);
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
throw editRefusal(error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
118
127
|
async provideSample(sample) {
|
|
119
128
|
// The worklet's engine is a WebAssembly instance of its own; the
|
|
120
129
|
// previewer's gets the sample when it next lists notes.
|
|
@@ -135,6 +144,13 @@ export class FuguePlayer {
|
|
|
135
144
|
return;
|
|
136
145
|
}
|
|
137
146
|
this.stop();
|
|
147
|
+
// Nothing waiting on the worklet is ever answered once its port closes.
|
|
148
|
+
this.disposed = true;
|
|
149
|
+
const disposed = new Error("FuguePlayer has been disposed");
|
|
150
|
+
for (const pending of this.requests.values()) {
|
|
151
|
+
pending.reject(disposed);
|
|
152
|
+
}
|
|
153
|
+
this.requests.clear();
|
|
138
154
|
this.previewer.dispose();
|
|
139
155
|
this.node.port.close();
|
|
140
156
|
if (this.connected) {
|
|
@@ -144,7 +160,6 @@ export class FuguePlayer {
|
|
|
144
160
|
if (!this.options.audioContext) {
|
|
145
161
|
await this.context.close();
|
|
146
162
|
}
|
|
147
|
-
this.disposed = true;
|
|
148
163
|
}
|
|
149
164
|
request(method, args = []) {
|
|
150
165
|
this.assertActive();
|
|
@@ -275,6 +290,15 @@ class MainThreadFuguePlayer {
|
|
|
275
290
|
return;
|
|
276
291
|
}
|
|
277
292
|
}
|
|
293
|
+
async applyEdits(edits) {
|
|
294
|
+
this.assertActive();
|
|
295
|
+
try {
|
|
296
|
+
this.engine.applyEdits(edits);
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
throw editRefusal(error);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
278
302
|
async provideSample(sample) {
|
|
279
303
|
this.assertActive();
|
|
280
304
|
try {
|
package/dist/FuguePlayer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FuguePlayer.js","sourceRoot":"","sources":["../src/FuguePlayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,GACV,MAAM,qBAAqB,CAAC;AAkC7B,SAAS,kBAAkB,CAAC,OAA2B;IACrD,OAAO,CACL,OAAO,CAAC,YAAY;QACpB,IAAI,YAAY,CACd,OAAO,CAAC,UAAU,KAAK,SAAS;YAC9B,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CACvC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,WAAW;IACb,QAAQ,GAAwB,eAAe,CAAC;IACxC,OAAO,CAAe;IACtB,IAAI,CAAmB;IACvB,WAAW,CAAY;IACvB,OAAO,CAAqB;IAC5B,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC7C,SAAS,CAAgB;IAClC,aAAa,GAAG,CAAC,CAAC;IAClB,SAAS,GAAG,KAAK,CAAC;IAClB,QAAQ,GAAG,KAAK,CAAC;IACjB,KAAK,GAAqB,SAAS,CAAC;IACpC,YAAY,CAAiB;IAC7B,YAAY,CAAc;IAC1B,WAAW,CAA0B;IAE7C,YACE,OAAqB,EACrB,IAAsB,EACtB,OAA2B;QAE3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,OAAO,CA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AM,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Why one edit of a refused batch cannot apply. */
|
|
2
|
+
export type RefusedEdit = {
|
|
3
|
+
/** The edit's place in the batch, from 0. */
|
|
4
|
+
index: number;
|
|
5
|
+
/** Its operation, such as `connect`. */
|
|
6
|
+
op: string;
|
|
7
|
+
/** Why, such as `unknown_port`. */
|
|
8
|
+
reason: string;
|
|
9
|
+
/** The engine's words for this edit, when it gives them. */
|
|
10
|
+
message?: string;
|
|
11
|
+
};
|
|
12
|
+
/** The `Error` `applyEdits` rejects with. Nothing in the batch applied. */
|
|
13
|
+
export type EditRefusal = Error & {
|
|
14
|
+
/** The error's code, such as `invalid_edit`. */
|
|
15
|
+
code?: string;
|
|
16
|
+
/** The edit to blame, when one is. */
|
|
17
|
+
edit?: RefusedEdit;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Reads the engine's refusal of an edit batch, which it throws as the
|
|
21
|
+
* error's JSON text (`code`, `message` and maybe `edit`), into an
|
|
22
|
+
* `EditRefusal`. Text that is not that JSON becomes the message.
|
|
23
|
+
*/
|
|
24
|
+
export declare function editRefusal(thrown: unknown): EditRefusal;
|
|
25
|
+
//# sourceMappingURL=edit-refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-refusal.d.ts","sourceRoot":"","sources":["../src/edit-refusal.ts"],"names":[],"mappings":"AAGA,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG;IACxB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG;IAChC,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,CA4BxD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// A refused edit batch, as the engine words it: the daemon's error, so a
|
|
2
|
+
// host can act on the cause without parsing the message.
|
|
3
|
+
/**
|
|
4
|
+
* Reads the engine's refusal of an edit batch, which it throws as the
|
|
5
|
+
* error's JSON text (`code`, `message` and maybe `edit`), into an
|
|
6
|
+
* `EditRefusal`. Text that is not that JSON becomes the message.
|
|
7
|
+
*/
|
|
8
|
+
export function editRefusal(thrown) {
|
|
9
|
+
const text = thrown instanceof Error ? thrown.message : String(thrown);
|
|
10
|
+
let parsed;
|
|
11
|
+
try {
|
|
12
|
+
parsed = JSON.parse(text);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return new Error(text);
|
|
16
|
+
}
|
|
17
|
+
if (!parsed || typeof parsed !== "object" || !("message" in parsed)) {
|
|
18
|
+
return new Error(text);
|
|
19
|
+
}
|
|
20
|
+
const { code, message, edit } = parsed;
|
|
21
|
+
const refusal = new Error(String(message));
|
|
22
|
+
if (typeof code === "string")
|
|
23
|
+
refusal.code = code;
|
|
24
|
+
if (edit &&
|
|
25
|
+
typeof edit.index === "number" &&
|
|
26
|
+
typeof edit.op === "string" &&
|
|
27
|
+
typeof edit.reason === "string") {
|
|
28
|
+
refusal.edit = { index: edit.index, op: edit.op, reason: edit.reason };
|
|
29
|
+
if (typeof edit.message === "string")
|
|
30
|
+
refusal.edit.message = edit.message;
|
|
31
|
+
}
|
|
32
|
+
return refusal;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=edit-refusal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-refusal.js","sourceRoot":"","sources":["../src/edit-refusal.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AO,CAAC;IAC5E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var L=Object.defineProperty;var P=(i,t,e)=>t in i?L(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var x=(i,t,e)=>P(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 _=(s&31)<<6|(e[++r]??0)&63;n+=String.fromCharCode(_)}else if((s&240)===224&&r+2<e.length){let _=(s&15)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;n+=String.fromCharCode(_)}else if((s&248)===240&&r+3<e.length){let _=(s&7)<<18|((e[++r]??0)&63)<<12|((e[++r]??0)&63)<<6|(e[++r]??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 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 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();o.__wbg_fugueengine_free(t,0)}addModule(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=c;var a=B(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),_=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,w=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),m=c,h=o.fugueengine_connect(this.__wbg_ptr,s,_,l,a,g,u,w,m);if(h[1])throw d(h[0])}disconnect(t,e,n,r){let s=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c,l=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,w=f(r,o.__wbindgen_malloc,o.__wbindgen_realloc),m=c,h=o.fugueengine_disconnect(this.__wbg_ptr,s,_,l,a,g,u,w,m);if(h[1])throw d(h[0])}finishAudioFileSink(t){let e,n;try{let _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=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,b(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=I(r[0],r[1]).slice();return o.__wbindgen_free(r[0],r[1]*1,1),s}getCodeModuleConfig(t){let e,n;try{let _=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),l=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,b(r,s)}finally{o.__wbindgen_free(e,n,1)}}getControl(t,e){let n,r;try{let l=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),a=c,g=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,w=o.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,r=_,b(s,_)}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,b(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,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}listControls(t){let e,n;try{var r=B(t)?0:f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c;let a=o.fugueengine_listControls(this.__wbg_ptr,r,s);var _=a[0],l=a[1];if(a[3])throw _=0,l=0,d(a[2]);return e=_,n=l,b(_,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,b(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,E.register(this,this.__wbg_ptr,this),this}previewNotes(t,e){let n=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),r=c,s=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=c;return o.fugueengine_previewNotes(this.__wbg_ptr,n,r,s,_)}provideSample(t,e,n,r){let s,_;try{let g=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),u=c,w=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),m=c,h=f(n,o.__wbindgen_malloc,o.__wbindgen_realloc),U=c,D=Y(r,o.__wbindgen_malloc),V=c,T=o.fugueengine_provideSample(this.__wbg_ptr,g,u,w,m,h,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{o.__wbindgen_free(s,_,1)}}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=W(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),_=c,l=o.fugueengine_setCodeModuleError(this.__wbg_ptr,n,r,s,_);if(l[1])throw d(l[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),_=c,l=o.fugueengine_setCodeModuleStatus(this.__wbg_ptr,n,r,s,_);if(l[1])throw d(l[0])}setControlBool(t,e,n){let r=f(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=c,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=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,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=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,_=f(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=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,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}takeLevels(){let t,e;try{let s=o.fugueengine_takeLevels(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,b(n,r)}finally{o.__wbindgen_free(t,e,1)}}};Symbol.dispose&&(y.prototype[Symbol.dispose]=y.prototype.free);function j(){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 k(function(t,e,n){return t.call(e,n)},arguments)},__wbg_getRandomValues_436a51d0629d84e1:function(){return k(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},r=(_,l)=>{let a=n.a;n.a=0;try{return z(a,n.b,_,l)}finally{n.a=a}};return new Promise(r)}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(W(e,n))},__wbindgen_generic_0000000000000001:function(t,e){return X(t,e,q)},__wbindgen_generic_0000000000000002:function(t,e){return b(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)}}}}function q(i,t){o.wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74(i,t)}function z(i,t,e,n){o.wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(i,t,e,n)}var E=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>o.__wbg_fugueengine_free(i,1));function N(i){let t=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(t,i),t}var F=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>o.__wbindgen_destroy_closure(i.a,i.b));function W(i,t){return i=i>>>0,$().subarray(i/4,i/4+t)}function I(i,t){return i=i>>>0,p().subarray(i/1,i/1+t)}var v=null;function $(){return(v===null||v.byteLength===0)&&(v=new Float32Array(o.memory.buffer)),v}function b(i,t){return H(i>>>0,t)}var C=null;function p(){return(C===null||C.byteLength===0)&&(C=new Uint8Array(o.memory.buffer)),C}function k(i,t){try{return i.apply(this,t)}catch(e){let n=N(e);o.__wbindgen_exn_store(n)}}function B(i){return i==null}function X(i,t,e){let n={a:i,b:t,cnt:1},r=(...s)=>{n.cnt++;let _=n.a;n.a=0;try{return e(_,n.b,...s)}finally{n.a=_,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,F.unregister(n))},F.register(r,n,n),r}function Y(i,t){let e=t(i.length*1,1)>>>0;return p().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 p().subarray(a,a+l.length).set(l),c=l.length,a}let n=i.length,r=t(n,1)>>>0,s=p(),_=0;for(;_<n;_++){let l=i.charCodeAt(_);if(l>127)break;s[r+_]=l}if(_!==n){_!==0&&(i=i.slice(_)),r=e(r,n,n=_+i.length*3,1)>>>0;let l=p().subarray(r+_,r+n),a=A.encodeInto(i,l);_+=a.written,r=e(r,n,_,1)>>>0}return c=_,r}function d(i){let t=o.__wbindgen_externrefs.get(i);return o.__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(p().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,o;function Q(i,t){return K=i,o=i.exports,J=t,v=null,C=null,o.__wbindgen_start(),o}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(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 O(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",ee.url));let t=j();(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,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],_=r?.[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);})();
|
|
1
|
+
"use strict";(()=>{var D=Object.defineProperty;var L=(i,t,e)=>t in i?D(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var y=(i,t,e)=>L(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 o=t.charCodeAt(n+1);o>=56320&&o<=57343&&(r=65536+(r-55296<<10)+(o-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 o=e[r]??0;if(o<128)n+=String.fromCharCode(o);else if((o&224)===192&&r+1<e.length){let _=(o&31)<<6|(e[++r]??0)&63;n+=String.fromCharCode(_)}else if((o&240)===224&&r+2<e.length){let _=(o&15)<<12|((e[++r]??0)&63)<<6|(e[++r]??0)&63;n+=String.fromCharCode(_)}else if((o&248)===240&&r+3<e.length){let _=(o&7)<<18|((e[++r]??0)&63)<<12|((e[++r]??0)&63)<<6|(e[++r]??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 r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);for(let o=0;o<r.length;o+=1)r[o]=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={},v=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,F.unregister(this),t}free(){let t=this.__destroy_into_raw();s.__wbg_fugueengine_free(t,0)}addModule(t,e,n){let r=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),o=c,_=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),l=c;var a=B(n)?0:f(n,s.__wbindgen_malloc,s.__wbindgen_realloc),d=c;let g=s.fugueengine_addModule(this.__wbg_ptr,r,o,_,l,a,d);if(g[1])throw u(g[0])}applyEdits(t){let e=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),n=c,r=s.fugueengine_applyEdits(this.__wbg_ptr,e,n);if(r[1])throw u(r[0])}connect(t,e,n,r){let o=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=c,l=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=c,d=f(n,s.__wbindgen_malloc,s.__wbindgen_realloc),g=c,b=f(r,s.__wbindgen_malloc,s.__wbindgen_realloc),p=c,h=s.fugueengine_connect(this.__wbg_ptr,o,_,l,a,d,g,b,p);if(h[1])throw u(h[0])}disconnect(t,e,n,r){let o=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),_=c,l=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),a=c,d=f(n,s.__wbindgen_malloc,s.__wbindgen_realloc),g=c,b=f(r,s.__wbindgen_malloc,s.__wbindgen_realloc),p=c,h=s.fugueengine_disconnect(this.__wbg_ptr,o,_,l,a,d,g,b,p);if(h[1])throw u(h[0])}finishAudioFileSink(t){let e,n;try{let _=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),l=c,a=s.fugueengine_finishAudioFileSink(this.__wbg_ptr,_,l);var r=a[0],o=a[1];if(a[3])throw r=0,o=0,u(a[2]);return e=r,n=o,w(r,o)}finally{s.__wbindgen_free(e,n,1)}}getAudioFileSinkWav(t){let e=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),n=c,r=s.fugueengine_getAudioFileSinkWav(this.__wbg_ptr,e,n);if(r[3])throw u(r[2]);var o=I(r[0],r[1]).slice();return s.__wbindgen_free(r[0],r[1]*1,1),o}getCodeModuleConfig(t){let e,n;try{let _=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),l=c,a=s.fugueengine_getCodeModuleConfig(this.__wbg_ptr,_,l);var r=a[0],o=a[1];if(a[3])throw r=0,o=0,u(a[2]);return e=r,n=o,w(r,o)}finally{s.__wbindgen_free(e,n,1)}}getControl(t,e){let n,r;try{let l=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),a=c,d=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),g=c,b=s.fugueengine_getControl(this.__wbg_ptr,l,a,d,g);var o=b[0],_=b[1];if(b[3])throw o=0,_=0,u(b[2]);return n=o,r=_,w(o,_)}finally{s.__wbindgen_free(n,r,1)}}listCodeModules(){let t,e;try{let o=s.fugueengine_listCodeModules(this.__wbg_ptr);var n=o[0],r=o[1];if(o[3])throw n=0,r=0,u(o[2]);return t=n,e=r,w(n,r)}finally{s.__wbindgen_free(t,e,1)}}listConnections(){let t,e;try{let o=s.fugueengine_listConnections(this.__wbg_ptr);var n=o[0],r=o[1];if(o[3])throw n=0,r=0,u(o[2]);return t=n,e=r,w(n,r)}finally{s.__wbindgen_free(t,e,1)}}listControls(t){let e,n;try{var r=B(t)?0:f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),o=c;let a=s.fugueengine_listControls(this.__wbg_ptr,r,o);var _=a[0],l=a[1];if(a[3])throw _=0,l=0,u(a[2]);return e=_,n=l,w(_,l)}finally{s.__wbindgen_free(e,n,1)}}listModules(){let t,e;try{let o=s.fugueengine_listModules(this.__wbg_ptr);var n=o[0],r=o[1];if(o[3])throw n=0,r=0,u(o[2]);return t=n,e=r,w(n,r)}finally{s.__wbindgen_free(t,e,1)}}loadInvention(t){let e=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),n=c,r=s.fugueengine_loadInvention(this.__wbg_ptr,e,n);if(r[1])throw u(r[0])}constructor(t){let e=s.fugueengine_new(t);return this.__wbg_ptr=e,F.register(this,this.__wbg_ptr,this),this}previewNotes(t,e){let n=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),r=c,o=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),_=c;return s.fugueengine_previewNotes(this.__wbg_ptr,n,r,o,_)}provideSample(t,e,n,r){let o,_;try{let d=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),g=c,b=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),p=c,h=f(n,s.__wbindgen_malloc,s.__wbindgen_realloc),x=c,U=Y(r,s.__wbindgen_malloc),V=c,M=s.fugueengine_provideSample(this.__wbg_ptr,d,g,b,p,h,x,U,V);var l=M[0],a=M[1];if(M[3])throw l=0,a=0,u(M[2]);return o=l,_=a,w(l,a)}finally{s.__wbindgen_free(o,_,1)}}removeModule(t){let e=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),n=c,r=s.fugueengine_removeModule(this.__wbg_ptr,e,n);if(r[1])throw u(r[0])}renderInterleavedInto(t){let e=s.fugueengine_renderInterleavedInto(this.__wbg_ptr,t);if(e[2])throw u(e[1]);return e[0]>>>0}renderInterleaved(t){let e=s.fugueengine_renderInterleaved(this.__wbg_ptr,t);if(e[3])throw u(e[2]);var n=W(e[0],e[1]).slice();return s.__wbindgen_free(e[0],e[1]*4,4),n}reset(){let t=s.fugueengine_reset(this.__wbg_ptr);if(t[1])throw u(t[0])}sampleRate(){return s.fugueengine_sampleRate(this.__wbg_ptr)>>>0}setCodeModuleError(t,e){let n=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),r=c,o=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),_=c,l=s.fugueengine_setCodeModuleError(this.__wbg_ptr,n,r,o,_);if(l[1])throw u(l[0])}setCodeModuleStatus(t,e){let n=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),r=c,o=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),_=c,l=s.fugueengine_setCodeModuleStatus(this.__wbg_ptr,n,r,o,_);if(l[1])throw u(l[0])}setControlBool(t,e,n){let r=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),o=c,_=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),l=c,a=s.fugueengine_setControlBool(this.__wbg_ptr,r,o,_,l,n);if(a[1])throw u(a[0])}setControlNumber(t,e,n){let r=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),o=c,_=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),l=c,a=s.fugueengine_setControlNumber(this.__wbg_ptr,r,o,_,l,n);if(a[1])throw u(a[0])}setControlString(t,e,n){let r=f(t,s.__wbindgen_malloc,s.__wbindgen_realloc),o=c,_=f(e,s.__wbindgen_malloc,s.__wbindgen_realloc),l=c,a=f(n,s.__wbindgen_malloc,s.__wbindgen_realloc),d=c,g=s.fugueengine_setControlString(this.__wbg_ptr,r,o,_,l,a,d);if(g[1])throw u(g[0])}status(){let t,e;try{let o=s.fugueengine_status(this.__wbg_ptr);var n=o[0],r=o[1];if(o[3])throw n=0,r=0,u(o[2]);return t=n,e=r,w(n,r)}finally{s.__wbindgen_free(t,e,1)}}takeLevels(){let t,e;try{let o=s.fugueengine_takeLevels(this.__wbg_ptr);var n=o[0],r=o[1];if(o[3])throw n=0,r=0,u(o[2]);return t=n,e=r,w(n,r)}finally{s.__wbindgen_free(t,e,1)}}};Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function P(){return{__proto__:null,"./fugue_bg.js":{__proto__:null,__wbg___wbindgen_throw_41e9ee4f547fc59a:function(t,e){throw new Error(w(t,e))},__wbg__wbg_cb_unref_dcc1a90847f04c41:function(t){t._wbg_cb_unref()},__wbg_call_187d372bd5fdd4aa:function(){return q(function(t,e,n){return t.call(e,n)},arguments)},__wbg_getRandomValues_436a51d0629d84e1:function(){return q(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},r=(_,l)=>{let a=n.a;n.a=0;try{return z(a,n.b,_,l)}finally{n.a=a}};return new Promise(r)}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(W(e,n))},__wbindgen_generic_0000000000000001:function(t,e){return X(t,e,j)},__wbindgen_generic_0000000000000002:function(t,e){return w(t,e)},__wbindgen_init_externref_table:function(){let t=s.__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 j(i,t){s.wasm_bindgen__convert__closures_____invoke__hd2d6d321acd2ef74(i,t)}function z(i,t,e,n){s.wasm_bindgen__convert__closures_____invoke__h1b9b7a832ddda534(i,t,e,n)}var F=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>s.__wbg_fugueengine_free(i,1));function N(i){let t=s.__externref_table_alloc();return s.__wbindgen_externrefs.set(t,i),t}var k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(i=>s.__wbindgen_destroy_closure(i.a,i.b));function W(i,t){return i=i>>>0,$().subarray(i/4,i/4+t)}function I(i,t){return i=i>>>0,m().subarray(i/1,i/1+t)}var C=null;function $(){return(C===null||C.byteLength===0)&&(C=new Float32Array(s.memory.buffer)),C}function w(i,t){return H(i>>>0,t)}var A=null;function m(){return(A===null||A.byteLength===0)&&(A=new Uint8Array(s.memory.buffer)),A}function q(i,t){try{return i.apply(this,t)}catch(e){let n=N(e);s.__wbindgen_exn_store(n)}}function B(i){return i==null}function X(i,t,e){let n={a:i,b:t,cnt:1},r=(...o)=>{n.cnt++;let _=n.a;n.a=0;try{return e(_,n.b,...o)}finally{n.a=_,r._wbg_cb_unref()}};return r._wbg_cb_unref=()=>{--n.cnt===0&&(s.__wbindgen_destroy_closure(n.a,n.b),n.a=0,k.unregister(n))},k.register(r,n,n),r}function Y(i,t){let e=t(i.length*1,1)>>>0;return m().set(i,e/1),c=i.length,e}function f(i,t,e){if(e===void 0){let l=T.encode(i),a=t(l.length,1)>>>0;return m().subarray(a,a+l.length).set(l),c=l.length,a}let n=i.length,r=t(n,1)>>>0,o=m(),_=0;for(;_<n;_++){let l=i.charCodeAt(_);if(l>127)break;o[r+_]=l}if(_!==n){_!==0&&(i=i.slice(_)),r=e(r,n,n=_+i.length*3,1)>>>0;let l=m().subarray(r+_,r+n),a=T.encodeInto(i,l);_+=a.written,r=e(r,n,_,1)>>>0}return c=_,r}function u(i){let t=s.__wbindgen_externrefs.get(i);return s.__externref_table_dealloc(i),t}var R=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});R.decode();var G=2146435072,E=0;function H(i,t){return E+=t,E>=G&&(R=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),R.decode(),E=t),R.decode(m().subarray(i,i+t))}var T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(i,t){let e=T.encode(i);return t.set(e),{read:i.length,written:e.length}});var c=0,J,K,s;function Q(i,t){return K=i,s=i.exports,J=t,C=null,A=null,s.__wbindgen_start(),s}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(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 O(i){if(s!==void 0)return s;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=P();(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 S=class extends AudioWorkletProcessor{constructor(e){super();y(this,"engine",null);y(this,"ready",!1);y(this,"playing",!1);y(this,"renderBuffer",new Float32Array(0));y(this,"squares",new Float64Array(2));y(this,"squaredFrames",0);y(this,"missingClock",null);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 v(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]),this.restartReading(),null;case"reset":return this.engine.reset(),this.restartReading(),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"applyEdits":return this.missingClock=null,this.engine.applyEdits(n[0]);case"listControls":return this.engine.listControls(n[0]);case"getControl":return this.engine.getControl(n[0],n[1]);case"views":return this.views(n[0]);case"setControl":return this.setControl(n[0],n[1],n[2]),null;default:throw new Error(`Unknown Fugue player method: ${e}`)}}views(e){let n=this.engine,r=n.takeLevels(),o=null;if(typeof e=="string"&&e!==this.missingClock)try{o=n.getControl(e,"elapsed")}catch{this.missingClock=e}let _={levels:r,beats:o,squares:[this.squares[0],this.squares[1]],frames:this.squaredFrames,time:currentTime};return this.squares[0]=0,this.squares[1]=0,this.squaredFrames=0,_}restartReading(){this.squares[0]=0,this.squares[1]=0,this.squaredFrames=0,this.missingClock=null}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],o=r?.[0],_=r?.[1];if(!o||!_)return!0;if(!this.playing||!this.ready||!this.engine)return o.fill(0),_.fill(0),!0;let l=o.length,a=l*2;this.renderBuffer.length!==a&&(this.renderBuffer=new Float32Array(a));try{this.engine.renderInterleavedInto(this.renderBuffer);let d=0,g=0;for(let b=0,p=0;b<l;b+=1,p+=2){let h=this.renderBuffer[p]??0,x=this.renderBuffer[p+1]??0;o[b]=h,_[b]=x,d+=h*h,g+=x*x}this.squares[0]+=d,this.squares[1]+=g,this.squaredFrames+=l}catch(d){this.playing=!1,o.fill(0),_.fill(0);try{this.engine.takeLevels()}catch{}this.restartReading(),this.postError(d)}return!0}postError(e){this.port.postMessage({type:"error",error:e instanceof Error?e.message:String(e)})}};registerProcessor("fugue-audio-worklet",S);})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedded-assets.d.ts","sourceRoot":"","sources":["../../src/generated/embedded-assets.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"embedded-assets.d.ts","sourceRoot":"","sources":["../../src/generated/embedded-assets.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,EAAE,MAA4rf,CAAC;AAEjuf,eAAO,MAAM,kBAAkB,EAAE,MAAm8qhI,CAAC"}
|