snes9x singleton
snes9x · games · schema v1A Super Nintendo emulator turned into a patchable video+audio module. It runs the snes9x2005 (CAT SFC) libretro core compiled to WASM, rendering the SNES screen (locked 256×224/239, 4:3) to the video out and 32 kHz stereo to audio_l/audio_r. The ROM is user-provided and gitignored: if /roms/snes9x/game.sfc isn't autoloaded the card shows a LOAD A ROM dropzone/file-picker (drop or click a .sfc/.smc — it stays local in your browser). Beyond the picture and sound, it reads the live SNES WRAM each frame to emit game-event CV/GATE: for Super Mario World it pulses on kills and deaths, holds a CV for the current world, and turns clock_in into a clock multiplied by (world+level). Drive it by wiring a GAMEPAD module's gate outputs straight into the 12 SNES button inputs (du→up, a→a, …) plus a clock into clock_in. Single-instance per rack (the WASM core is heavy). DOM-only affordances with no patch port: the ROM dropzone/file picker, and a right-click "see output definition for CV/GATES" panel that explains every game-event output for the loaded ROM; the card's OUTPUT FIT toggle sets the fillMode param (letterbox vs fill). Non-SMW ROMs still boot and show video/audio but the game-event outputs stay inert.
the faceplate
inputs
| id | cable | what it does |
|---|---|---|
clock_in | gate | Clock input (gate cable). Each rising edge is treated as a clock pulse that feeds the gate3 multiplier: the period between edges is measured and replayed as (world+level) evenly-spaced sub-pulses on gate3 (×1 passthrough when not in a level). gate / trigger; modulates cv_clock_in (summed directly (the destination DSP scales it)) |
outputs
| id | cable | what it does |
|---|---|---|
out | video | Video output: the live SNES screen, letterboxed/pillarboxed into the engine framebuffer (Y-flipped, 4:3). Shows a faint scanline void until a ROM frame is available. RGB video stream |
audio_l | audio | Left audio channel of the emulator's 32 kHz stereo output, split off a ChannelSplitter from the PCM worklet. Patch into the audio domain. audio signal |
audio_r | audio | Right audio channel of the emulator's 32 kHz stereo output (the other split of the PCM worklet). Patch into the audio domain. audio signal |
params
| id | label | range | default | curve |
|---|---|---|---|---|
cv_clock_in | CLOCK | 0..1 | 0 | linear |
fillMode | Fill | 0..1 | 0 | discrete |
controls
| control | what it does |
|---|---|
| Cv a | A (0..1, linear). Synthetic gate param backing the a input; its level sets whether the SNES A button is held. |
| Cv b | B (0..1, linear). Synthetic gate param backing the b input; its level sets whether the SNES B button is held. |
| CLOCK | CLOCK (0..1, linear). Synthetic param target of the clock_in gate input; its rising edge drives the gate3 clock multiplier. Set by patching clock_in, not a user knob. |
| Cv down | DOWN (0..1, linear). Synthetic gate param backing the down input; its level sets whether the SNES DOWN button is held. |
| Cv l | L (0..1, linear). Synthetic gate param backing the l input; its level sets whether the SNES L shoulder button is held. |
| Cv left | LEFT (0..1, linear). Synthetic gate param backing the left input; its level sets whether the SNES LEFT button is held. |
| Cv r | R (0..1, linear). Synthetic gate param backing the r input; its level sets whether the SNES R shoulder button is held. |
| Cv right | RIGHT (0..1, linear). Synthetic gate param backing the right input; its level sets whether the SNES RIGHT button is held. |
| Cv select | SELECT (0..1, linear). Synthetic gate param backing the select input; its level sets whether the SNES SELECT button is held. |
| Cv start | START (0..1, linear). Synthetic gate param backing the start input; its level sets whether the SNES START button is held. |
| Cv up | UP (0..1, linear). Synthetic gate param backing the up input — its level sets whether the SNES UP button is held. Set by patching the up gate, not a knob. |
| Cv x | X (0..1, linear). Synthetic gate param backing the x input; its level sets whether the SNES X button is held. |
| Cv y | Y (0..1, linear). Synthetic gate param backing the y input; its level sets whether the SNES Y button is held. |
| Fill | Fill (0..1, discrete). Output fit mode: 0 = letterbox/pillarbox (default, aspect-preserving), 1 = fill/cover-crop. Driven by the card's OUTPUT FIT toggle; only matters when the output aspect isn't 4:3. |
source
snes9x.ts on GitHub.