Skip to content

wasm: introduce wasm backend#96

Merged
jcelerier merged 1 commit into
mainfrom
feature/wasm
Jun 9, 2026
Merged

wasm: introduce wasm backend#96
jcelerier merged 1 commit into
mainfrom
feature/wasm

Conversation

@jcelerier

Copy link
Copy Markdown
Member

Adds a WebAssembly / web backend (include/avnd/binding/wasm/) that compiles a single Avendish plug-in to a small, self-contained ES module — without dragging in libossia/score. The same plug-in source that targets pd/vst3/max now also targets the web.

Delivery modes

  • Browser standalone — a self-contained page (<c_name>.html) that sets up an AudioContext + AudioWorklet and an auto-generated UI.
  • Web Audio Module 2 (WAM2) — a standards-compliant WAM package (wam/<c_name>/) loadable by web DAWs.
  • Node / headless — the same web,worker,node ES module runs in Node/Deno/Bun for offline rendering.

What's bridged

  • Audio: manual AudioWorkletProcessor + planar-heap marshaling; float/double conversion, mono↔poly, multichannel / variable-channel negotiation.
  • Controls & value I/O: every Avendish parameter type (float/int/bool/enum/string/xy/xyz/rgba/range/multislider/list/map/variant/…) exposed via Embind with getParameterInfo/set/get (+ normalized); value inputs and outputs surfaced separately in the UI.
  • MIDI (Web MIDI in/out), messages (named RPC, JS→plugin), callbacks (plugin→JS, queued + drained), sample-accurate controls.
  • UI: a painterCanvasRenderingContext2D adapter for custom immediate-mode draw items, plus an auto-UI from the introspected layout.
  • GPU: not in this PR (texture/buffer consumers are planned; geometry intentionally out of scope).

Build

  • cmake/avendish.wasm.cmake adds avnd_make_wasm (wired into avnd_make_object/avnd_make_audioplug), plus wasm_gallery (build all + a generated landing page) and wasm_serve (COOP/COEP dev server) targets.
  • Keeps RTTI on (Embind requires it) while disabling exceptions; fmt is forced header-only under Emscripten.

Tests

Headless Node tests cover the ring buffer, heap audio marshaling, the DSP/node runner, control round-trips across all data types, MIDI/messages/callbacks/sample-accurate, the painter→canvas call sequence, the auto-UI DOM, and the WAM2 parameter mapping.

🤖 Generated with Claude Code

@jcelerier jcelerier enabled auto-merge June 8, 2026 06:22
@jcelerier jcelerier added this pull request to the merge queue Jun 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 8, 2026
@jcelerier jcelerier added this pull request to the merge queue Jun 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jun 9, 2026
@jcelerier jcelerier merged commit a3d7a8d into main Jun 9, 2026
7 checks passed
@jcelerier jcelerier deleted the feature/wasm branch June 9, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant