Architecture
How Open Stomp Manager is put together, for anyone changing it. Everything about the pedal itself (MIDI messages, records, state tracking, the connection engine) lives in the open-stomp library.
The app is a Tauri program in two halves:
- Rust (
app/src-tauri/src/) owns the library'sDeviceengine and the pedal state. - React (
app/src/) draws the interface in the system's web view.
Source files
Rust: app/src-tauri/src/
| File | What it holds |
|---|---|
main.rs | Command line, version strings, the Tauri commands, startup |
hub.rs | The hub thread: owns the Device engine and the DeviceState, applies updates, runs commands (Cmd), emits state events |
view.rs | The state cut into JSON sections for the frontend |
log.rs, logbook.rs | The activity log: rows, merging knob sweeps, filtering, text export, and the rows the frontend asks for |
import.rs | NAM and IR conversion on a worker thread, with progress and cancel |
backup.rs | Preset files (.ospreset) and the app's copy of each imported model (below) |
update.rs | The update check, download and install (below) |
The Tauri commands in main.rs:
| Command | Does |
|---|---|
snapshot | Every section's latest value |
command | Runs a Cmd on the hub |
log_rows | Rows start..start + count of the filtered log |
log_export | The filtered log as text |
read_preset_file | What importing a preset file would do (a backup::Plan); waits on the hub through Hub::call |
export_presets | Reads the models from the pedal and writes a preset file; waits on the hub through Hub::call |
TypeScript: app/src/
| File | What it holds |
|---|---|
store.ts | The frontend's copy of the sections. useStore subscribes a component to just what it reads; send runs a command |
types.ts | The JSON shapes from view.rs and the commands in hub::Cmd. Keep them in step |
ui.ts | UI-only state: the open dialog, whether the activity log shows |
App.tsx | Layout, the pinned or followed block, the Ctrl+L shortcut, STOMP_DEV flags |
components/ | One component per area (TopBar, PresetList, CurrentPreset, Chain, Detail, Extras, DeviceCard, LogPanel, UpdateBanner, Dialogs) and the controls (Knob, Slider, ModelPicker), each with its own .css |
styles/global.css | Design tokens (colours, radii, spacing), the module colours, shared buttons and the highlight animation |
styles/layout.css | The page grid and how it adapts to narrow windows |
Data flow
pedal ◀──▶ open-stomp Device engine thread (port scan, connect, sync, request queue)
│ Update (+ wake-up) ▲ Device helpers: select_preset, set_head,
▼ │ set_param, set_chain, save_preset, write_settings, …
hub thread (hub.rs) ─────────────────────────┘
Message → DeviceState::apply → Event → activity log, highlights
every ≤16 ms: rebuild sections (view.rs), emit the changed ones
│ "state" event {seq, sections, activity, rx, tx} ▲ invoke("command", Cmd)
▼ │
store.ts ── useStore ──▶ components ── user input ── send ──┘Start.
Hub::spawnstarts the engine withDevice::spawn_with_waker, whose wake-up sends a message to the hub's channel. Frontend commands arrive on the same channel, so they run in order with the pedal's updates.Updates. The hub drains the engine's
Updates:Update Hub does MessageApplies it to the DeviceState, which returns anEvent(category, subject, value). The event goes to the activity log and, unless redundant, becomes anactivityentry that lights up the block, knob or preset headerResetA new session: replaces the DeviceStatewith a fresh oneStatus,Sync,PortsUpdates the connsectionMark,InfoAdds notes to the log Emit. After a batch, at most once per frame (16 ms), the hub rebuilds every section, compares each with what it last sent, and emits only the changed ones as one
stateevent. A knob sweep sends thelivesection, not the 99 presets.Snapshot. On start, the frontend subscribes to
state, then asks for asnapshotof every section. Each section carries the number of the event that last set it, so a snapshot that arrives late can't overwrite newer data.
Sections
| Section | Contents | Changes when |
|---|---|---|
conn | Connection status, ports, sync progress, listen-only, editable, canEditSound, the default replay path | Connecting, syncing, replay progress |
presets | All 99 names, the active preset, whether it's edited | Preset changes, saves, sync |
live | The live sound: chain order, every block's model, on/off and parameters, volume, the followed block | Every edit |
models | Model names per module, with user slot names | User slots change |
extras | Tuner, looper, drum machine | Those change |
device | Product, firmware, system settings, user slot names | Sync, settings writes, imports, renames |
log | Row count and a generation number | Every message |
import | The NAM/IR conversion in progress and the last outcome | Import progress |
restore | The preset-file import in progress and the last outcome | Restore progress |
export | Replies received / expected while an export reads models | Export progress |
update | The update check or install state | Update checks |
catalog | Drum patterns, STOMP_DEV flags, versions | Never |
Editing
Why edits don't touch the state
The pedal doesn't echo what the host sends. Instead the engine reports every message it sends as an Update::Message with Origin::Host, and the hub applies those exactly like pedal messages.
- A knob turned in the app updates
DeviceStatethrough the same path as a knob turned on the pedal. - The log shows it as a Host row.
- There is one source of truth.
- Anything sent while listen-only or disconnected is refused by the engine, and the hub doesn't send it in the first place.
Knobs and sliders show their own value while you turn them and send at most one change per animation frame. When you let go they show the pedal's value again once its echo has arrived.
Rules
editable: connected and not listen-only.canEditSound: also needs the live preset to be known, because one head CC carries model and on/off together, so switching a block on needs its current model. The hub checks the same rules before sending.- Saving uses the live sound (the edit buffer with all edits) with the chosen slot and name, through
Device::save_preset. - Settings changes start from the record the pedal sent, change the given fields and
write_settingsthe whole record. The engine collapses queued settings writes into the newest. - Chain order:
Chain.tsxsends the eight effect modules, GATE included, asSetChain; the hub callsDevice::set_chain. The block shows the sent order until the pedal's state matches it (at most 2 s). - Opening a block in the chain also sends the pedal-page CC, as the official app does.
- Preset knob: after a preset change from the pedal, its messages are held until it has been quiet for 0.15 s (at most 5 s), then applied together. Turning the preset knob several clicks then jumps instead of stepping through every preset.
The activity log
The log stays on the Rust side (log.rs, logbook.rs), so the frontend never holds 50,000 rows. The panel asks for the rows on screen (log_rows, with a few extra above and below) whenever the log section's generation, the filter or the scroll position changes.
- Merging: an event with a
coalescekey merges into a recent row with the same key (within 2.5 s, looking back past up to 12 hidden plumbing rows). It updates the row's value, keeps the starting value (from) and counts messages (×4). - Filtering: the chips and search go to the hub (
SetLogFilter). The visible-row index list is cached by (log generation, filter). - Cap: 50,000 rows.
Backups
backup.rs handles .ospreset files: export, the import plan, and rewriting presets to follow their models.
- Export (
Call::Export): the hub reads each user slot back from the pedal, then writes the file. It gives up if the pedal is silent for 5 s. - Plan (
Call::Plan): which models the pedal already has (same name) and where the others go by default. - Restore (
Cmd::StartRestore): convert any model without converted data, queue the writes (models, presets, settings), count the acks, then re-read the pedal. A restore that hears no ack for 8 s is taken as finished. Library: the source file of each model the app imported, inuser-slots/in the app data folder. An entry only counts while the pedal's slot still has its name.
Updates
update.rs checks the newest release's latest.json at startup and on Check for updates.
- Can install (release builds on macOS, and Windows copies with
uninstall.exenext to the app): download, then install once no import, restore or export is running (the hub decides when), then restart. - Can't (Linux, the portable Windows zip, anything in
/nix/store, debug builds): report the newer version and link to its release page. - A failed check at startup says nothing; a failed manual check, download or install shows in the
updatesection.
Signing and latest.json are covered in Releasing.
Highlights
Each activity entry bumps a counter in the store, keyed by module, parameter or preset header. A component renders <span key={counter} className="glow" />; a new key remounts the element, which replays its CSS animation. The In / Out lights in the top bar work the same way with the rx / tx counts.
Screenshots and tests
tools/dev/webdriver.py drives the real app through WebKitWebDriver (Linux). Debug builds expose the store as window.__stomp, so scripts can wait for the pedal state instead of guessing timings. tools/dev/shot.py uses it for the docs' screenshots (see Building).
Adding a feature
| You want to | Do this |
|---|---|
| Support new pedal behaviour (a message, a record field, a command) | Add it to the library first, with a test against a capture if possible, then use it here |
| Show something new | Add it to a section in view.rs (or a new section), mirror it in types.ts, and read it with useStore in a component |
| Send something new | Add a Cmd variant in hub.rs that calls a Device helper (so listen-only and the log keep working), mirror it in types.ts, and send it. The hub's tests parse the frontend's JSON for the trickier commands |
| Style something | Use the variables in global.css. A block's colour comes from data-module="amp" and is read as var(--mod) |
