Load project WebAssembly plugins in Csound - #503
Draft
hlolli wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
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
.wasmfile type icon and theme support for the new icon color tokens. - Introduce
createCsoundForProjectto preload project.wasmbinaries as Csound plugins and revoke temporary object URLs. - Export
loadBinaryDocumentto 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
csoundInstanceis assigned before verifyingcreateCsoundForProject(...)returned a valid instance. If initialization fails (returns null/undefined),csoundInstancewill 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
.wasmicon to the file tree..wasmfile in a project as a Csound plugin.Result
Projects can carry their Csound plugins with their other files.
Follow-up