Skip to content

Load project WebAssembly plugins in Csound - #503

Draft
hlolli wants to merge 1 commit into
developfrom
agent/wasm-plugin-support
Draft

Load project WebAssembly plugins in Csound#503
hlolli wants to merge 1 commit into
developfrom
agent/wasm-plugin-support

Conversation

@hlolli

@hlolli hlolli commented Jul 31, 2026

Copy link
Copy Markdown
Member

Changes

  • Add a clear .wasm icon to the file tree.
  • Load every binary .wasm file in a project as a Csound plugin.
  • Apply plugin loading to CSD play, ORC play, and disk render.
  • Reuse cached file bytes and clean up temporary URLs.

Result

Projects can carry their Csound plugins with their other files.

Follow-up

  • Check the WebAssembly magic header before loading.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables project-scoped Csound WebAssembly plugins by discovering binary .wasm documents in the active project, loading them as Csound plugins during initialization (CSD play, ORC play, and disk render), and adds a dedicated .wasm file icon across supported themes.

Changes:

  • Add a .wasm file type icon and theme support for the new icon color tokens.
  • Introduce createCsoundForProject to preload project .wasm binaries as Csound plugins and revoke temporary object URLs.
  • Export loadBinaryDocument to reuse cached binary bytes for both FS sync and plugin loading, and add tests for file icon detection and plugin loading behavior.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/styles/emotion.d.ts Extends Emotion theme typing to include fileIcons.wasm.
src/styles/_theme-solarized-dark.ts Adds wasm icon colors to theme.
src/styles/_theme-nord.ts Adds wasm icon colors to theme.
src/styles/_theme-monokai.ts Adds wasm icon colors to theme.
src/styles/_theme-github.ts Adds wasm icon colors to theme.
src/styles/_theme-github-light.ts Adds wasm icon colors to theme.
src/styles/_theme-dracula.ts Adds wasm icon colors to theme.
src/elements/filetype-icons.tsx Adds .wasm detection and a WasmFileIcon; refactors SVG wrapper into FileIconDocument.
src/elements/filetype-icons.test.ts Adds unit tests for .wasm file type detection.
src/components/projects/utils.tsx Exports loadBinaryDocument and improves fetch error handling for binary downloads/caching.
src/components/csound/plugins.ts Adds createCsoundForProject to preload .wasm binaries as Csound plugins via object URLs.
src/components/csound/plugins.test.ts Adds tests ensuring plugins are loaded/revoked correctly and handled on failure/empty projects.
src/components/csound/actions.ts Switches Csound initialization paths to use createCsoundForProject for plugin support.
Suppressed comments (1)

src/components/csound/actions.ts:437

  • csoundInstance is assigned before verifying createCsoundForProject(...) returned a valid instance. If initialization fails (returns null/undefined), csoundInstance will be set to an invalid value and later actions (e.g. stop/pause) may throw.
        csoundInstance = csound as CsoundObj;

        if (!csound) {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants