Skip to content

Reading pedal state ​

How DeviceState follows the pedal from its MIDI traffic, what each Event tells you, and where to find presets, the live sound, looper, drum, tuner, settings and user slots. The state module is pure, so it works with the engine or with your own transport.

Apply every message ​

DeviceState is a model of the pedal. Apply every complete MIDI message to it, from either direction, and reset it when a new session starts.

rust
use open_stomp::device::Update;
use open_stomp::{Category, DeviceState};

let mut state = DeviceState::default();
while let Ok(update) = dev.recv() {
    match update {
        Update::Reset => state = DeviceState::default(),
        Update::Message { origin, bytes, .. } => {
            let ev = state.apply(&bytes, origin);
            if ev.category != Category::Protocol && !ev.redundant {
                println!("{:8} {} = {}", ev.category.label(), ev.subject, ev.value);
            }
        }
        _ => {}
    }
}
python
from open_stomp import DeviceState

state = DeviceState()
for u in dev:
    ev = state.feed(u)       # applies "message", clears on "reset", else None
    if ev and ev.category != "protocol" and not ev.redundant:
        print(ev)            # AMP      Mar J800 · GAIN = 64
  • apply(bytes, origin) applies one complete message and returns an Event. Python also has feed(update), which handles Updates directly.
  • Your own edits: the pedal never echoes host messages. The engine reports everything it sends as an Origin::Host message, so applying every Update::Message keeps the state right for your edits too.
  • Sent another way? If you send through another path, apply your bytes yourself with Origin::Host.

Events ​

Event fieldMeaning
originOrigin::Pedal (pedal → host) or Origin::Host (host → pedal: your program, or the official app in a replay)
categoryWhat kind of change; see the table below
subject, valuePlain English, e.g. "Mar J800 · GAIN" and "64"
coalesceA key: consecutive events with the same key are one gesture (a knob sweep) and can be merged in a log
redundantThe message changed nothing (the CC burst after a preset change repeating known values, values for unused parameter slots)
rawThe message bytes
Rust Categorylabel()Python category
PresetPRESET"preset"
Effect(Module)The module name, e.g. AMP"effect" (the module is in ev.module)
VolumeVOLUME"volume"
NavigationPAGE"navigation"
LooperLOOPER"looper"
DrumDRUM"drum"
TunerTUNER"tuner"
SettingsSETTINGS"settings"
DeviceDEVICE"device"
ProtocolSYSEX"protocol": request/reply plumbing (handshake reads, acks, upload chunks)
Unknown???"unknown"

In Python the display label is ev.label, and str(ev) joins label, subject and value.

What it tracks ​

FieldWhatFilled by
firmware, model_id, product"V1.1.1", "JME-01", "JME STOMPBOX"Version and product short frames
presets99 × Option<Preset> (None until read)0x0B replies and writes
currentActive preset index (0-based), or NoneProgram changes; edit-buffer matching after the sync
live, live_knownThe edit buffer: the stored preset plus every change sincePreset changes, CCs (heads, params, volume), renames, chain moves
pageThe module the pedal's display showsCC 0x3B
looper, drum, tunerSee belowTheir CCs and SysEx records
settingsOption<Settings>0x14 replies and writes
user_amps, user_irs10 × Option<String>: user slot namesSlot-info replies, imports, renames

The byte layouts behind these are on the Preset record and Other records pages.

Presets, live sound and changes ​

  • presets[i] is the stored preset in slot i (P01 = 0), once the sync has read it.
  • current is the active slot. It is None until a program change, or until the edit buffer matched a stored preset after the sync.
  • live is what the pedal plays now. live_known says whether it has been read or loaded from a stored preset yet.
  • modified() is true when live sounds different from the stored preset (unused parameter slots are ignored).
MethodReturns
stored(i)The stored preset in slot i, if read
preset_name(i)Its name, if read
modified()Whether the live sound differs from the stored preset
model_name(module, model)A model's display name, using user slot names for user models
select_preset(i)Updates the model only: sets current and loads the stored preset into live. It sends nothing; to switch presets on the pedal use Device::select_preset

When the active slot is identified after the sync, the edit buffer is matched against the stored presets. If the edit buffer has unsaved edits, the match fails and current stays None until the next preset change.

rust
if let Some(i) = state.current {
    let name = state.preset_name(i).unwrap_or("?");
    let star = if state.modified() { "*" } else { "" };
    println!("{} {name}{star}", open_stomp::state::preset_label(i)); // P05 Lead*
}
python
from open_stomp.records import preset_label

if state.current is not None:
    star = "*" if state.modified() else ""
    print(preset_label(state.current), state.preset_name(state.current), star)

Looper, drum and tuner ​

looper fieldMeaning
state0 empty, 1 recording, 2 playing, 3 overdubbing, 4 stopped; state_name() gives the word
layers0x1 = an overdub layer on top (undo available), 0x2 = base layer only
rec_level, play_levelRecord and playback levels, 0–100
syncLOOP SYNC on or off
mode0 NR, 1 AR
drum fieldMeaning
playingRunning or stopped
patternFlat pattern number, style × 10 + pattern; catalog::drum_pattern_name(v) gives e.g. "Rock 04"
level0–100
bpmTempo; it only travels in SysEx 0x19 (there is no tempo CC)
tuner fieldMeaning
activeTuner mode on
detectedA note is being detected
noteIndex into catalog::NOTES ("C", "C#", …)
centsRaw, 50 = in tune; cents_offset() gives −50…+50

Fields that the pedal hasn't reported yet are None. In Python state_name and cents_offset are properties.

Settings ​

state.settings holds the global settings record once the sync has read it: input trim, global EQ, wireless and loopback. To change them, see Presets and settings.

User slots ​

  • user_amps[i], user_irs[i]: the names of USER AMP and USER IR slots i (0–9). An empty user AMP slot reads back as "USER AMP NN".
  • In events: user models are amp and cab models 30–39, and model_name() shows the slot's name next to the model name.
  • Imports and renames update these names: the state applies the name records they send, and renames and deletes re-read the slot (User AMP and IR slots).

Python attributes are snapshots ​

Changing a copy changes nothing

state.live, state.presets[3], preset.modules and so on return copies; the model changes only through apply or feed. To edit, take a copy, change it, and send it (saving a preset).

Helpers ​

RustPythonGives
state::preset_label(i)records.preset_label(i)"P01" for 0
state::chain_label(&chain)"GATE > OD/FX > AMP > …"
state::looper_state_name(s)state.looper_state_name(s)"Recording" and so on
catalog::drum_pattern_name(v)catalog.drum_pattern_name(v)"Rock 04" for 13
catalog::NOTEScatalog.NOTESTuner note names

MIT or Apache-2.0. Not affiliated with SORAN.