Skip to content

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's Device engine and the pedal state.
  • React (app/src/) draws the interface in the system's web view.

Source files ​

Rust: app/src-tauri/src/ ​

FileWhat it holds
main.rsCommand line, version strings, the Tauri commands, startup
hub.rsThe hub thread: owns the Device engine and the DeviceState, applies updates, runs commands (Cmd), emits state events
view.rsThe state cut into JSON sections for the frontend
log.rs, logbook.rsThe activity log: rows, merging knob sweeps, filtering, text export, and the rows the frontend asks for
import.rsNAM and IR conversion on a worker thread, with progress and cancel
backup.rsPreset files (.ospreset) and the app's copy of each imported model (below)
update.rsThe update check, download and install (below)

The Tauri commands in main.rs:

CommandDoes
snapshotEvery section's latest value
commandRuns a Cmd on the hub
log_rowsRows start..start + count of the filtered log
log_exportThe filtered log as text
read_preset_fileWhat importing a preset file would do (a backup::Plan); waits on the hub through Hub::call
export_presetsReads the models from the pedal and writes a preset file; waits on the hub through Hub::call

TypeScript: app/src/ ​

FileWhat it holds
store.tsThe frontend's copy of the sections. useStore subscribes a component to just what it reads; send runs a command
types.tsThe JSON shapes from view.rs and the commands in hub::Cmd. Keep them in step
ui.tsUI-only state: the open dialog, whether the activity log shows
App.tsxLayout, 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.cssDesign tokens (colours, radii, spacing), the module colours, shared buttons and the highlight animation
styles/layout.cssThe page grid and how it adapts to narrow windows

Data flow ​

text
 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 ──┘
  1. Start. Hub::spawn starts the engine with Device::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.

  2. Updates. The hub drains the engine's Updates:

    UpdateHub does
    MessageApplies it to the DeviceState, which returns an Event (category, subject, value). The event goes to the activity log and, unless redundant, becomes an activity entry that lights up the block, knob or preset header
    ResetA new session: replaces the DeviceState with a fresh one
    Status, Sync, PortsUpdates the conn section
    Mark, InfoAdds notes to the log
  3. 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 state event. A knob sweep sends the live section, not the 99 presets.

  4. Snapshot. On start, the frontend subscribes to state, then asks for a snapshot of 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 ​

SectionContentsChanges when
connConnection status, ports, sync progress, listen-only, editable, canEditSound, the default replay pathConnecting, syncing, replay progress
presetsAll 99 names, the active preset, whether it's editedPreset changes, saves, sync
liveThe live sound: chain order, every block's model, on/off and parameters, volume, the followed blockEvery edit
modelsModel names per module, with user slot namesUser slots change
extrasTuner, looper, drum machineThose change
deviceProduct, firmware, system settings, user slot namesSync, settings writes, imports, renames
logRow count and a generation numberEvery message
importThe NAM/IR conversion in progress and the last outcomeImport progress
restoreThe preset-file import in progress and the last outcomeRestore progress
exportReplies received / expected while an export reads modelsExport progress
updateThe update check or install stateUpdate checks
catalogDrum patterns, STOMP_DEV flags, versionsNever

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 DeviceState through 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_settings the whole record. The engine collapses queued settings writes into the newest.
  • Chain order: Chain.tsx sends the eight effect modules, GATE included, as SetChain; the hub calls Device::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 coalesce key 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, in user-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.exe next 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 update section.

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 toDo 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 newAdd 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 newAdd 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 somethingUse the variables in global.css. A block's colour comes from data-module="amp" and is read as var(--mod)

MIT or Apache-2.0. Not affiliated with SORAN.