onda-engine 0.1.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/LICENSE +106 -0
- package/LICENSE-APACHE +202 -0
- package/README.md +84 -0
- package/dist/chunk-NCNYMPIQ.js +12763 -0
- package/dist/chunk-NCNYMPIQ.js.map +1 -0
- package/dist/cinema.d.ts +580 -0
- package/dist/cinema.js +1687 -0
- package/dist/cinema.js.map +1 -0
- package/dist/components-manifest.d.ts +2 -0
- package/dist/components-manifest.js +3 -0
- package/dist/components-manifest.js.map +1 -0
- package/dist/components.d.ts +3480 -0
- package/dist/components.js +11486 -0
- package/dist/components.js.map +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest-7N3yu9tB.d.ts +131 -0
- package/dist/player.d.ts +177 -0
- package/dist/player.js +1749 -0
- package/dist/player.js.map +1 -0
- package/dist/react.d.ts +2141 -0
- package/dist/react.js +2052 -0
- package/dist/react.js.map +1 -0
- package/dist/render.d.ts +42 -0
- package/dist/render.js +113 -0
- package/dist/render.js.map +1 -0
- package/dist/wasm/pkg/onda_wasm.js +598 -0
- package/dist/wasm/pkg/onda_wasm_bg.wasm +0 -0
- package/dist/wasm-audio/pkg/onda_wasm_audio.js +417 -0
- package/dist/wasm-audio/pkg/onda_wasm_audio_bg.wasm +0 -0
- package/dist/wasm-vello/index.js +32 -0
- package/dist/wasm-vello/pkg/onda_wasm_vello.js +1325 -0
- package/dist/wasm-vello/pkg/onda_wasm_vello_bg.wasm +0 -0
- package/package.json +112 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/* @ts-self-types="./onda_wasm_audio.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A decoded audio clip you can sample a per-frame spectrum from.
|
|
5
|
+
*/
|
|
6
|
+
export class AudioAnalyzer {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
AudioAnalyzerFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_audioanalyzer_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* BEAT / onset / tempo analysis over `frame_count` frames at `fps`, for syncing
|
|
19
|
+
* motion to the music. Deterministic — identical to the native export.
|
|
20
|
+
* @param {number} fps
|
|
21
|
+
* @param {number} frame_count
|
|
22
|
+
* @returns {Beats}
|
|
23
|
+
*/
|
|
24
|
+
beats(fps, frame_count) {
|
|
25
|
+
const ret = wasm.audioanalyzer_beats(this.__wbg_ptr, fps, frame_count);
|
|
26
|
+
return Beats.__wrap(ret);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Clip duration in seconds.
|
|
30
|
+
* @returns {number}
|
|
31
|
+
*/
|
|
32
|
+
duration_secs() {
|
|
33
|
+
const ret = wasm.audioanalyzer_duration_secs(this.__wbg_ptr);
|
|
34
|
+
return ret;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Decode audio `bytes` (a fetched file / `Uint8Array`). `ext_hint` is the
|
|
38
|
+
* file extension (`"mp3"`, `"wav"`, …) to aid format detection — `""` is fine
|
|
39
|
+
* (content probing still runs). Throws if the bytes aren't decodable audio.
|
|
40
|
+
* @param {Uint8Array} bytes
|
|
41
|
+
* @param {string} ext_hint
|
|
42
|
+
*/
|
|
43
|
+
constructor(bytes, ext_hint) {
|
|
44
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
45
|
+
const len0 = WASM_VECTOR_LEN;
|
|
46
|
+
const ptr1 = passStringToWasm0(ext_hint, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
47
|
+
const len1 = WASM_VECTOR_LEN;
|
|
48
|
+
const ret = wasm.audioanalyzer_new(ptr0, len0, ptr1, len1);
|
|
49
|
+
if (ret[2]) {
|
|
50
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
51
|
+
}
|
|
52
|
+
this.__wbg_ptr = ret[0];
|
|
53
|
+
AudioAnalyzerFinalization.register(this, this.__wbg_ptr, this);
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Decoded sample rate (Hz).
|
|
58
|
+
* @returns {number}
|
|
59
|
+
*/
|
|
60
|
+
sample_rate() {
|
|
61
|
+
const ret = wasm.audioanalyzer_sample_rate(this.__wbg_ptr);
|
|
62
|
+
return ret >>> 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Per-frame spectrum: a flat, frame-major `Float32Array` of length
|
|
66
|
+
* `frame_count * bands`, each value `0..1` (low→high). `fps` maps a frame
|
|
67
|
+
* index to its time. Deterministic — identical to the native export.
|
|
68
|
+
* @param {number} fps
|
|
69
|
+
* @param {number} frame_count
|
|
70
|
+
* @param {number} bands
|
|
71
|
+
* @returns {Float32Array}
|
|
72
|
+
*/
|
|
73
|
+
spectrogram(fps, frame_count, bands) {
|
|
74
|
+
const ret = wasm.audioanalyzer_spectrogram(this.__wbg_ptr, fps, frame_count, bands);
|
|
75
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
76
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
77
|
+
return v1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Symbol.dispose) AudioAnalyzer.prototype[Symbol.dispose] = AudioAnalyzer.prototype.free;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Beat / onset / tempo analysis of a clip, all in VIDEO-FRAME units. Returned by
|
|
84
|
+
* [`AudioAnalyzer::beats`]; read `tempo` + the typed arrays from JS.
|
|
85
|
+
*/
|
|
86
|
+
export class Beats {
|
|
87
|
+
static __wrap(ptr) {
|
|
88
|
+
const obj = Object.create(Beats.prototype);
|
|
89
|
+
obj.__wbg_ptr = ptr;
|
|
90
|
+
BeatsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
91
|
+
return obj;
|
|
92
|
+
}
|
|
93
|
+
__destroy_into_raw() {
|
|
94
|
+
const ptr = this.__wbg_ptr;
|
|
95
|
+
this.__wbg_ptr = 0;
|
|
96
|
+
BeatsFinalization.unregister(this);
|
|
97
|
+
return ptr;
|
|
98
|
+
}
|
|
99
|
+
free() {
|
|
100
|
+
const ptr = this.__destroy_into_raw();
|
|
101
|
+
wasm.__wbg_beats_free(ptr, 0);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Frame indices on the beat grid (`Uint32Array`).
|
|
105
|
+
* @returns {Uint32Array}
|
|
106
|
+
*/
|
|
107
|
+
get beats() {
|
|
108
|
+
const ret = wasm.beats_beats(this.__wbg_ptr);
|
|
109
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
110
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
111
|
+
return v1;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Per-frame onset strength `0..1`, one value per frame (`Float32Array`).
|
|
115
|
+
* @returns {Float32Array}
|
|
116
|
+
*/
|
|
117
|
+
get onsetEnv() {
|
|
118
|
+
const ret = wasm.beats_onsetEnv(this.__wbg_ptr);
|
|
119
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
120
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
121
|
+
return v1;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Frame indices of picked onsets — any transient (`Uint32Array`).
|
|
125
|
+
* @returns {Uint32Array}
|
|
126
|
+
*/
|
|
127
|
+
get onsets() {
|
|
128
|
+
const ret = wasm.beats_onsets(this.__wbg_ptr);
|
|
129
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
130
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
131
|
+
return v1;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Estimated tempo in beats per minute (0 if undetectable).
|
|
135
|
+
* @returns {number}
|
|
136
|
+
*/
|
|
137
|
+
get tempo() {
|
|
138
|
+
const ret = wasm.beats_tempo(this.__wbg_ptr);
|
|
139
|
+
return ret;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (Symbol.dispose) Beats.prototype[Symbol.dispose] = Beats.prototype.free;
|
|
143
|
+
function __wbg_get_imports() {
|
|
144
|
+
const import0 = {
|
|
145
|
+
__proto__: null,
|
|
146
|
+
__wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
|
|
147
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
148
|
+
return ret;
|
|
149
|
+
},
|
|
150
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
151
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
152
|
+
},
|
|
153
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
154
|
+
let deferred0_0;
|
|
155
|
+
let deferred0_1;
|
|
156
|
+
try {
|
|
157
|
+
deferred0_0 = arg0;
|
|
158
|
+
deferred0_1 = arg1;
|
|
159
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
160
|
+
} finally {
|
|
161
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
165
|
+
const ret = new Error();
|
|
166
|
+
return ret;
|
|
167
|
+
},
|
|
168
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
169
|
+
const ret = arg1.stack;
|
|
170
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
171
|
+
const len1 = WASM_VECTOR_LEN;
|
|
172
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
173
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
174
|
+
},
|
|
175
|
+
__wbindgen_init_externref_table: function() {
|
|
176
|
+
const table = wasm.__wbindgen_externrefs;
|
|
177
|
+
const offset = table.grow(4);
|
|
178
|
+
table.set(0, undefined);
|
|
179
|
+
table.set(offset + 0, undefined);
|
|
180
|
+
table.set(offset + 1, null);
|
|
181
|
+
table.set(offset + 2, true);
|
|
182
|
+
table.set(offset + 3, false);
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
return {
|
|
186
|
+
__proto__: null,
|
|
187
|
+
"./onda_wasm_audio_bg.js": import0,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const AudioAnalyzerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
192
|
+
? { register: () => {}, unregister: () => {} }
|
|
193
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_audioanalyzer_free(ptr, 1));
|
|
194
|
+
const BeatsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
195
|
+
? { register: () => {}, unregister: () => {} }
|
|
196
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_beats_free(ptr, 1));
|
|
197
|
+
|
|
198
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
199
|
+
ptr = ptr >>> 0;
|
|
200
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
204
|
+
ptr = ptr >>> 0;
|
|
205
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
let cachedDataViewMemory0 = null;
|
|
209
|
+
function getDataViewMemory0() {
|
|
210
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
211
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
212
|
+
}
|
|
213
|
+
return cachedDataViewMemory0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
217
|
+
function getFloat32ArrayMemory0() {
|
|
218
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
219
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
220
|
+
}
|
|
221
|
+
return cachedFloat32ArrayMemory0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function getStringFromWasm0(ptr, len) {
|
|
225
|
+
return decodeText(ptr >>> 0, len);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let cachedUint32ArrayMemory0 = null;
|
|
229
|
+
function getUint32ArrayMemory0() {
|
|
230
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
231
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
232
|
+
}
|
|
233
|
+
return cachedUint32ArrayMemory0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
let cachedUint8ArrayMemory0 = null;
|
|
237
|
+
function getUint8ArrayMemory0() {
|
|
238
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
239
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
240
|
+
}
|
|
241
|
+
return cachedUint8ArrayMemory0;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
245
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
246
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
247
|
+
WASM_VECTOR_LEN = arg.length;
|
|
248
|
+
return ptr;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
252
|
+
if (realloc === undefined) {
|
|
253
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
254
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
255
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
256
|
+
WASM_VECTOR_LEN = buf.length;
|
|
257
|
+
return ptr;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
let len = arg.length;
|
|
261
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
262
|
+
|
|
263
|
+
const mem = getUint8ArrayMemory0();
|
|
264
|
+
|
|
265
|
+
let offset = 0;
|
|
266
|
+
|
|
267
|
+
for (; offset < len; offset++) {
|
|
268
|
+
const code = arg.charCodeAt(offset);
|
|
269
|
+
if (code > 0x7F) break;
|
|
270
|
+
mem[ptr + offset] = code;
|
|
271
|
+
}
|
|
272
|
+
if (offset !== len) {
|
|
273
|
+
if (offset !== 0) {
|
|
274
|
+
arg = arg.slice(offset);
|
|
275
|
+
}
|
|
276
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
277
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
278
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
279
|
+
|
|
280
|
+
offset += ret.written;
|
|
281
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
WASM_VECTOR_LEN = offset;
|
|
285
|
+
return ptr;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function takeFromExternrefTable0(idx) {
|
|
289
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
290
|
+
wasm.__externref_table_dealloc(idx);
|
|
291
|
+
return value;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
295
|
+
cachedTextDecoder.decode();
|
|
296
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
297
|
+
let numBytesDecoded = 0;
|
|
298
|
+
function decodeText(ptr, len) {
|
|
299
|
+
numBytesDecoded += len;
|
|
300
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
301
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
302
|
+
cachedTextDecoder.decode();
|
|
303
|
+
numBytesDecoded = len;
|
|
304
|
+
}
|
|
305
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const cachedTextEncoder = new TextEncoder();
|
|
309
|
+
|
|
310
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
311
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
312
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
313
|
+
view.set(buf);
|
|
314
|
+
return {
|
|
315
|
+
read: arg.length,
|
|
316
|
+
written: buf.length
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
let WASM_VECTOR_LEN = 0;
|
|
322
|
+
|
|
323
|
+
let wasmModule, wasmInstance, wasm;
|
|
324
|
+
function __wbg_finalize_init(instance, module) {
|
|
325
|
+
wasmInstance = instance;
|
|
326
|
+
wasm = instance.exports;
|
|
327
|
+
wasmModule = module;
|
|
328
|
+
cachedDataViewMemory0 = null;
|
|
329
|
+
cachedFloat32ArrayMemory0 = null;
|
|
330
|
+
cachedUint32ArrayMemory0 = null;
|
|
331
|
+
cachedUint8ArrayMemory0 = null;
|
|
332
|
+
wasm.__wbindgen_start();
|
|
333
|
+
return wasm;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
async function __wbg_load(module, imports) {
|
|
337
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
338
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
339
|
+
try {
|
|
340
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
341
|
+
} catch (e) {
|
|
342
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
343
|
+
|
|
344
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
345
|
+
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", e);
|
|
346
|
+
|
|
347
|
+
} else { throw e; }
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const bytes = await module.arrayBuffer();
|
|
352
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
353
|
+
} else {
|
|
354
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
355
|
+
|
|
356
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
357
|
+
return { instance, module };
|
|
358
|
+
} else {
|
|
359
|
+
return instance;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function expectedResponseType(type) {
|
|
364
|
+
switch (type) {
|
|
365
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
366
|
+
}
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function initSync(module) {
|
|
372
|
+
if (wasm !== undefined) return wasm;
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
if (module !== undefined) {
|
|
376
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
377
|
+
({module} = module)
|
|
378
|
+
} else {
|
|
379
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const imports = __wbg_get_imports();
|
|
384
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
385
|
+
module = new WebAssembly.Module(module);
|
|
386
|
+
}
|
|
387
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
388
|
+
return __wbg_finalize_init(instance, module);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async function __wbg_init(module_or_path) {
|
|
392
|
+
if (wasm !== undefined) return wasm;
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
if (module_or_path !== undefined) {
|
|
396
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
397
|
+
({module_or_path} = module_or_path)
|
|
398
|
+
} else {
|
|
399
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (module_or_path === undefined) {
|
|
404
|
+
module_or_path = new URL('onda_wasm_audio_bg.wasm', import.meta.url);
|
|
405
|
+
}
|
|
406
|
+
const imports = __wbg_get_imports();
|
|
407
|
+
|
|
408
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
409
|
+
module_or_path = fetch(module_or_path);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
413
|
+
|
|
414
|
+
return __wbg_finalize_init(instance, module);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @onda-engine/wasm-vello — the ONDA Vello (GPU) renderer for the browser.
|
|
2
|
+
//
|
|
3
|
+
// This wrapper applies a small WebGPU compatibility shim, then re-exports the
|
|
4
|
+
// wasm-bindgen bindings from ./pkg. Import this (the package entry), not ./pkg
|
|
5
|
+
// directly, so the shim is always in place before you call `VelloEngine.create`.
|
|
6
|
+
//
|
|
7
|
+
// The shim: wgpu 22 (pinned by Vello 0.3) still sends the limit
|
|
8
|
+
// `maxInterStageShaderComponents`, which current Chrome removed from the WebGPU
|
|
9
|
+
// spec and rejects in `requestDevice`. We strip it. (Remove this once Vello/wgpu
|
|
10
|
+
// is bumped past 22 — see packages/player/WEBGPU.md.)
|
|
11
|
+
if (
|
|
12
|
+
typeof globalThis !== 'undefined' &&
|
|
13
|
+
globalThis.GPUAdapter &&
|
|
14
|
+
!globalThis.__ondaWebgpuLimitShim
|
|
15
|
+
) {
|
|
16
|
+
globalThis.__ondaWebgpuLimitShim = true
|
|
17
|
+
const proto = globalThis.GPUAdapter.prototype
|
|
18
|
+
const original = proto.requestDevice
|
|
19
|
+
proto.requestDevice = function requestDevice(descriptor) {
|
|
20
|
+
if (
|
|
21
|
+
descriptor?.requiredLimits &&
|
|
22
|
+
'maxInterStageShaderComponents' in descriptor.requiredLimits
|
|
23
|
+
) {
|
|
24
|
+
const limits = { ...descriptor.requiredLimits }
|
|
25
|
+
limits.maxInterStageShaderComponents = undefined
|
|
26
|
+
return original.call(this, { ...descriptor, requiredLimits: limits })
|
|
27
|
+
}
|
|
28
|
+
return original.call(this, descriptor)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { default, initSync, VelloEngine, RenderedFrame } from './pkg/onda_wasm_vello.js'
|