Skip to main content

Modes

Almost every screen is a Mode instance. The global Mode *currentMode tells the rest of the firmware what the four encoders mean and which drawing path to take.

Mode shape​

Defined in toern.ino:

struct Mode {
String name;
unsigned int minValues[4];
unsigned int maxValues[4];
unsigned int pos[4]; // current encoder positions
uint32_t knobcolor[4];
};

When switchMode(newMode) runs, it stores oldMode, updates currentMode, and rewrites each encoder’s min/max/counter/RGB from the mode’s fields.

Named modes (non-exhaustive)​

Mode variableName stringTypical job
drawDRAWPaint notes on the grid
touchyModeTCHYFive-pad sample performance with existing voice players
singleModeSINGLESingle-voice / focused editing
filterModeFILTERMODEPer-channel FX / synth params (sliders)
velocityVELOCITYNote detail: velocity / probability / condition / voice volume
noteShiftNOTE_SHIFTTranspose / shift notes
set_WavSET_WAVSMP: sample browser / assign
recordModeRECORD_MODERecord into a sample slot
set_SamplePackSET_SAMPLEPACKKIT: sample-kit selection
loadSaveTrackLOADSAVE_TRACKPATT: pattern load/save
menuMENUTop-level menu shell
songModeSONGMODESong arrangement
subpatternModeSUBPATTERNSubpattern / mute-related UI
volume_bpmVOLUME_BPMBPM / related transport UI
newFileModeNEW_FILEGenre generator after loading an empty numbered slot

How input finds the right handler​

  1. Hardware callbacks / polling update encoder counters.
  2. checkMode / button chord logic decides whether to switchMode.
  3. Mode-specific branches in toern.ino (and UI files) read currentMode->pos[i] and mutate note / GLOB / SMP.
  4. Draw code compares currentMode == &draw (pointer equality) to pick the correct LED rendering.

Pointer comparison against the global mode objects is the canonical check — don’t compare name strings in hot paths.

Adding a mode​

  1. Declare a Mode myMode = { ... } next to the others.
  2. Wire an entry gesture (button combo, menu item, encoder hold).
  3. Handle encoder deltas while currentMode == &myMode.
  4. Add drawing in toern_ui.ino (or a dedicated helper).
  5. On exit, restore encoder config for the destination mode (switchMode already rebinds ranges).

Operator labels and gestures​

Menu labels are PATT, KIT, SMP, BPM, VOL, SETT, REC, MIDI, MODE, ETC. Internal mode names remain unchanged. Tap touch 1 to toggle DRAW/SINGLE on a sound voice; tap touch 2 to open the menu. The short touch-1 chord grace period lets the second pad join a sample-browser/filter gesture; it is not a hold requirement. Note detail maps encoders 1–4 to velocity, probability, condition/ratchet and whole-voice volume.

See the handbook controls and note detail for complete gestures.

TOUCHY is enabled with MODE → TCHY, is OFF after reboot, and stops sequencer playback. Touch 1–5 trigger voices 1–5 without writing notes. Encoders 1–4 edit the last pad-triggered voice’s pitch, velocity, reverb (where available), and highpass. Channel volumes stay full while enabled and are restored on disable. Short presses open SMP for voices 1–4. Hold encoder 1 to fast-record into the last pad-triggered voice and release to stop; recording does not change pattern notes. Hold encoder 3 for the last pad-triggered voice’s FILTER, and encoder 4 for the main menu. Existing browser/filter exits return to TOUCHY until its MODE toggle is OFF.