@opendaw/studio-core-wasm 0.0.2 → 0.0.4
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/dist/WasmEngine.js +1 -1
- package/dist/engine-modules.d.ts.map +1 -1
- package/dist/engine-modules.js +21 -7
- package/dist/sync/serialize-update-tasks.d.ts +2 -2
- package/dist/sync/serialize-update-tasks.d.ts.map +1 -1
- package/dist/sync/serialize-update-tasks.js +8 -8
- package/dist/wasm/engine.wasm +0 -0
- package/dist/wasm/plugins/device_apparat.wasm +0 -0
- package/dist/wasm/plugins/device_compressor.wasm +0 -0
- package/dist/wasm/plugins/device_crusher.wasm +0 -0
- package/dist/wasm/plugins/device_dattorro_reverb.wasm +0 -0
- package/dist/wasm/plugins/device_delay.wasm +0 -0
- package/dist/wasm/plugins/device_fold.wasm +0 -0
- package/dist/wasm/plugins/device_gate.wasm +0 -0
- package/dist/wasm/plugins/device_maximizer.wasm +0 -0
- package/dist/wasm/plugins/device_neural_amp.wasm +0 -0
- package/dist/wasm/plugins/device_playfield_sample.wasm +0 -0
- package/dist/wasm/plugins/device_revamp.wasm +0 -0
- package/dist/wasm/plugins/device_reverb.wasm +0 -0
- package/dist/wasm/plugins/device_stereo_tool.wasm +0 -0
- package/dist/wasm/plugins/device_tidal.wasm +0 -0
- package/dist/wasm/plugins/device_vaporisateur.wasm +0 -0
- package/dist/wasm/plugins/device_velocity.wasm +0 -0
- package/dist/wasm/plugins/device_vocoder.wasm +0 -0
- package/dist/wasm/plugins/device_waveshaper.wasm +0 -0
- package/dist/wasm-offline-worker.js +42 -11
- package/dist/wasm-offline-worker.js.map +4 -4
- package/dist/wasm-processor.js +42 -11
- package/dist/wasm-processor.js.map +4 -4
- package/package.json +11 -11
package/dist/WasmEngine.js
CHANGED
|
@@ -133,7 +133,7 @@ export var WasmEngine;
|
|
|
133
133
|
};
|
|
134
134
|
const target = {
|
|
135
135
|
sendUpdates: (tasks) => {
|
|
136
|
-
sender.applyUpdates(serializeUpdateTasks(tasks
|
|
136
|
+
sender.applyUpdates(serializeUpdateTasks(tasks));
|
|
137
137
|
verifyChecksum();
|
|
138
138
|
},
|
|
139
139
|
checksum: (value) => sender.checksum(value)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-modules.d.ts","sourceRoot":"","sources":["../src/engine-modules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine-modules.d.ts","sourceRoot":"","sources":["../src/engine-modules.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAG7E,mBAAmB,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAE3E,eAAe,EAAE,MAAM,CAAC;IAGxB,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,EAAE,WAAW,CAAC,MAAM,CAAA;IAChC,aAAa,EAAE,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAChD,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,CAAA;CAC3C,CAAA;AAWD,eAAO,MAAM,kBAAkB,QAAO,WAAW,CAAC,MASjD,CAAA;AAMD,eAAO,MAAM,OAAO,EAAE,aAAa,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA0BnE,CAAA;AAKD,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,aAAa,CAWnD,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAU,OAAM,MAAW,KAAG,OAAO,CAAC,aAAa,CAOhF,CAAA"}
|
package/dist/engine-modules.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
// the device PLUGINS (PIC side modules the engine loads at host-assigned bases). All are handed to the
|
|
3
|
-
// "engine" AudioWorkletProcessor via processorOptions; the worklet links the devices into the engine.
|
|
1
|
+
import { Option } from "@opendaw/lib-std";
|
|
4
2
|
// The engine's single linear memory: SHARED, so the main thread can see the WASM heap (e.g. to write
|
|
5
|
-
// decoded sample data straight into it at an engine-allocated offset).
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
3
|
+
// decoded sample data straight into it at an engine-allocated offset). A SHARED memory cannot be reallocated
|
|
4
|
+
// on grow (its base must stay fixed for every thread), so the runtime RESERVES the entire `maximum` as VIRTUAL
|
|
5
|
+
// address space at creation — physical pages still commit lazily on grow, but that reservation itself can fail
|
|
6
|
+
// on a memory-constrained device (a low-end Chromebook reported `RangeError: could not allocate memory`, #1030).
|
|
7
|
+
// So request the wasm32 ceiling (65536 pages = 4 GiB) and fall back to smaller maxima until one is accepted; the
|
|
8
|
+
// talc allocator grows on demand up to whatever ceiling succeeded. The engine.wasm memory import declares
|
|
9
|
+
// max=65536, and a smaller provided max still satisfies it (verified: it instantiates down to 8192).
|
|
10
|
+
// Needs cross-origin isolation (COOP/COEP, set in vite.config). Passed into the worklet via processorOptions.
|
|
11
|
+
export const createEngineMemory = () => {
|
|
12
|
+
const initial = 256;
|
|
13
|
+
for (const maximum of [65536, 32768, 16384, 8192]) {
|
|
14
|
+
console.debug(`Try ${maximum} bytes for engine memory...`);
|
|
15
|
+
const memory = Option.tryCatch(() => new WebAssembly.Memory({ initial, maximum, shared: true }));
|
|
16
|
+
if (memory.nonEmpty()) {
|
|
17
|
+
return memory.unwrap();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Smallest workable ceiling; if even this throws, the device genuinely cannot host the engine.
|
|
21
|
+
return new WebAssembly.Memory({ initial, maximum: 4096, shared: true });
|
|
22
|
+
};
|
|
9
23
|
// The device PIC side modules to load: each wasm plus the device-BOX TYPE it realizes. This is the device
|
|
10
24
|
// table the engine uses to instantiate a device box: when the box graph presents e.g. an ArpeggioDeviceBox,
|
|
11
25
|
// the engine looks up its type here to find its plugin under /wasm/plugins/. Load order is irrelevant now (the engine reads
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpdateTask } from "@opendaw/lib-box";
|
|
2
2
|
import { BoxIO } from "@opendaw/studio-boxes";
|
|
3
|
-
export declare const serializeUpdateTasks: (tasks: ReadonlyArray<UpdateTask<BoxIO.TypeMap
|
|
3
|
+
export declare const serializeUpdateTasks: (tasks: ReadonlyArray<UpdateTask<BoxIO.TypeMap>>) => ArrayBuffer;
|
|
4
4
|
//# sourceMappingURL=serialize-update-tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-update-tasks.d.ts","sourceRoot":"","sources":["../../src/sync/serialize-update-tasks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialize-update-tasks.d.ts","sourceRoot":"","sources":["../../src/sync/serialize-update-tasks.ts"],"names":[],"mappings":"AAOA,OAAO,EAA2B,UAAU,EAAqB,MAAM,kBAAkB,CAAA;AACzF,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAA;AAE3C,eAAO,MAAM,oBAAoB,GAAI,OAAO,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAG,WA4BtF,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Serialize SyncSource's forward-only UpdateTask[] into the byte stream the Rust engine's
|
|
2
|
-
// decode_forward consumes.
|
|
3
|
-
//
|
|
2
|
+
// decode_forward consumes. Each update-primitive task carries the field's codec (primitiveType) captured
|
|
3
|
+
// at emission time, so the stream is self-contained: a later task in the same batch may have deleted the
|
|
4
|
+
// box (e.g. undo trims a region, then unstages it — #287), and re-resolving the field against the live
|
|
5
|
+
// graph here would throw "no field at". Everything is written on the main thread's ordered channel.
|
|
4
6
|
import { ByteArrayOutput, isDefined, UUID } from "@opendaw/lib-std";
|
|
5
|
-
import { Address } from "@opendaw/lib-box";
|
|
6
|
-
export const serializeUpdateTasks = (tasks
|
|
7
|
+
import { Address, ValueSerialization } from "@opendaw/lib-box";
|
|
8
|
+
export const serializeUpdateTasks = (tasks) => {
|
|
7
9
|
const output = ByteArrayOutput.create();
|
|
8
10
|
output.writeInt(tasks.length);
|
|
9
11
|
tasks.forEach(task => {
|
|
@@ -15,10 +17,8 @@ export const serializeUpdateTasks = (tasks, source) => {
|
|
|
15
17
|
output.writeBytes(new Int8Array(task.buffer));
|
|
16
18
|
}
|
|
17
19
|
else if (task.type === "update-primitive") {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const field = source.findVertex(address).unwrap(() => `no field at ${address}`);
|
|
21
|
-
const serialization = field.serialization();
|
|
20
|
+
Address.reconstruct(task.address).write(output);
|
|
21
|
+
const serialization = ValueSerialization[task.primitiveType];
|
|
22
22
|
output.writeString(serialization.type);
|
|
23
23
|
serialization.encode(output, task.value);
|
|
24
24
|
}
|
package/dist/wasm/engine.wasm
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|