Skip to content

Issue #1891: a MIDI fader or knob can cover part of a value's range, or run turned round - #1944

Draft
OneSlips wants to merge 7 commits into
emmertex:stagingfrom
RAD-Films:pr/midi-ranges
Draft

OneSlips wants to merge 7 commits into
emmertex:stagingfrom
RAD-Films:pr/midi-ranges

Conversation

@OneSlips

@OneSlips OneSlips commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Part of #1891. Builds on #1943, #1942, #1936, #1930, #1920 and #1913. It stays a draft until those merge; then I rebase it onto staging.

What changes

A fader, a knob with ends, pitch bend or an NRPN control can now cover part of a value's range, for finer steps. For example, 50 % to 100 % puts Exposure 0 at the fader's bottom and +5 at its top. If the first number is above the second, the control works turned round.

  • Settings > Controls shows Range under the selected control, in percent.
  • surface.midiControl takes from and to, as shares from 0 to 1, at least 0.01 apart. Bad values are refused, and the range already set stays.
  • The settings file keeps them as midi.controls.<id>.from and to. They are written only when they differ from the whole range. Anything unsafe in a file reads as the whole range.
  • When the photo's value is outside the part covered, pickup takes over at the near end, and feedback puts the control at that end.

Checked

  • cargo fmt --check.
  • Clippy -D warnings on lcc-surface, lcc-ui-egui and lcc-app.
  • Tests:
    • lcc-surface: 88 pass.
    • lcc-ui-egui lib: 2,534 pass. One phone-menu test is timing-sensitive on a busy machine; it passes when rerun.
    • lcc-app midi tests pass.
  • New tests:
    • Part of the range, turned round, unsafe values, and what is written to the file.
    • End to end: a fader covering the upper half of Exposure sets and shows values there, and bad ranges are refused.
  • Looked at the Settings row in a headless snapshot.

Manual: automate/control-surfaces

Sources: MIDI2LR's per-control limits (https://github.com/rsjaffe/MIDI2LR, GPL-3.0), read only as a reference for behaviour. No code was copied.

🤖 Generated with Claude Code

OneSlips and others added 7 commits December 5, 2026 03:06
…DI learn

A MIDI controller now shows up in Settings ▸ Controls beside the MX Creative
Console and Loupedeck+, and runs on the same surface engine: pages that follow
the context, one undo step per gesture, the readout, speed and acceleration.

- Touch a knob, fader or button and it appears on the page; bind it like any
  other key or dial. The app guesses how a knob sends (with ends, or one of the
  three endless kinds) and you can pick another type if it moves the wrong way.
- Faders and knobs with ends set the value by position (new Input::Position /
  Effect::Set in lcc-surface), coalesced per frame, one undo step per move.
- Ports: tick which MIDI ports the app opens. midi.toml keeps working; a
  message it binds still goes to its action.
- Commands: surface.midi, surface.midiPort, surface.midiControl,
  surface.midiInput (synthetic MIDI for scripts and tests).

Part of emmertex#1891 (next: pickup, LED feedback, built-in X-Touch Mini layout).

Manual: automate/control-surfaces
Sources: MIDI2LR (https://github.com/rsjaffe/MIDI2LR, GPL-3.0) read as a
reference for behaviour; credited in NOTICE.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A MIDI fader or knob with ends now takes over a value once it reaches it
(within 3 % of the range, or moving past it in one step), so switching
photos, undoing or dragging a slider keeps the photo's value until you bring
the fader to it. Until then the readout shows the value with a white mark
where the fader is: "Move to the value to take over". A fader moved within
the last half second keeps the value; the moves before it takes over add no
undo step.

- lcc-surface: new `pickup` module (pure state, per control), a `pickup`
  setting in `midi` (on by default) and a `Shown::Pickup` readout.
- Settings ▸ Controls ▸ MIDI controllers: "Faders take over at the photo's
  value"; command `surface.midiPickup {on}`.

Part of emmertex#1891 (builds on emmertex#1913).

Manual: automate/control-surfaces
Sources: MIDI2LR (https://github.com/rsjaffe/MIDI2LR, GPL-3.0) pickup mode
read as a reference for behaviour; credited in NOTICE (emmertex#1913).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The app now sends values back to MIDI controllers: a fader or knob with
ends bound to a value gets its place (control change 0-127, pitch bend
14 bits), so motor faders move to the photo's value; a note or button
control gets its light when its binding has an on state (Auto Sync, a tool,
Before/After, a rating). Endless knobs get nothing here (each controller
takes ring values its own way; built-in layouts will drive their rings).

- lcc-surface: new `feedback` module: the message for a control, and a
  diff that sends only what changed and nothing to a control moved in the
  last 300 ms (no echo fighting the hand); a `feedback` setting in `midi`.
- ui-egui: the MIDI host builds what every control should show (Settings'
  controls and every MIDI control the profile binds), at most 25 times a
  second, to the port each control last sent from; a port that opens again
  gets everything again. "Send values back to the controller" in Settings;
  command `surface.midiFeedback {on}`.
- app: a midi-output thread opens the controller's output port matched by
  name (the same name, or one holding it, as Windows' `MIDIOUT2 (...)`).

Part of emmertex#1891 (builds on emmertex#1920 and emmertex#1913).

Manual: automate/control-surfaces
Sources: MIDI2LR (https://github.com/rsjaffe/MIDI2LR, GPL-3.0) feedback read
as a reference for behaviour; credited in NOTICE (emmertex#1913).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ugged in (built-in layout)

A known MIDI controller now works with no setup. When an X-Touch Mini's
port shows up, Chromaforge uses it without asking and adds its built-in
layout once: every knob, push, button and fader gets its name, and the
controls with nothing bound get a starting binding. Bindings the user
made stay as they are.

Layer A: the eight knobs run the Basic panel (Exposure, Contrast,
Highlights, Shadows, Whites, Blacks, Temp, Tint), each push puts its
value back, the buttons cull and move through photos (previous, next,
pick, reject, unflag, before/after, undo, redo, 1-5 stars, copy, paste,
Auto Sync), and the fader runs Exposure. Layer B: the knobs run Texture,
Clarity, Dehaze, Vibrance, Saturation, Sharpening, Noise Reduction and
Masking; the buttons open the edit tools and views; the fader runs
Saturation. Both layers are bound at once because the device sends other
numbers on layer B.

Settings > Controls names the layout under the port and has "Add its
layout again"; the menu and the surface.midiLayout command do the same.

Part of emmertex#1891.

Manual: automate/control-surfaces
Sources: Behringer X-Touch Mini Quick Start Guide (MIDI map, Standard
mode); MIDI2LR community X-Touch Mini kits
(https://github.com/rsjaffe/MIDI2LR, GPL-3.0), read as a reference for
which values go where. No code copied.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…as they are plugged in (built-in layouts)

Two more controllers get a built-in layout, added the first time their
port shows up, as the X-Touch Mini's is. Bindings the user made stay.

nanoKONTROL2 (CC mode, channel 1): the faders run the Basic panel from
Exposure to Tint; the knobs run Texture, Clarity, Dehaze, Vibrance,
Saturation, Sharpening, Noise Reduction and Vignette. S resets its
strip's fader, M its knob, R rates 1-5 and flags. Transport: Track
previous/next, Cycle Auto Sync, Marker copy/paste/Paste from Previous,
Rewind/Fast forward undo/redo, Stop clipping, Play before/after, Record
mask overlay. Its buttons are set to Button, so feedback lights them in
the device's External LED mode.

MIDImix (channel 1): strip faders the Basic panel, master fader
Exposure; top knobs presence, vignette and grain, middle knobs
sharpening and noise reduction, bottom knobs the rest of vignette and
colour noise. Mute resets its strip's fader, Rec Arm rates and flags,
Bank Left/Right move between photos, Solo shows before/after.

Port names match with case, spaces and dashes ignored ("MIDI Mix",
"MIDImix"). The set-up message now reads "{name} is set up and ready
to use." in every language.

Part of emmertex#1891.

Manual: automate/control-surfaces
Sources: Korg nanoKONTROL2 Parameter Guide (LED Mode); nanoKONTROL2 CC
map as it ships and Akai MIDImix MIDI map, cross-checked with Ardour's
community MIDI maps (https://github.com/Ardour/ardour, midi_maps, read
as a reference for numbers only) and Akai's MIDImix user guide; MIDI2LR
community kits (https://github.com/rsjaffe/MIDI2LR, GPL-3.0), read as a
reference for which values go where. No code copied.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t steps

NRPN knobs and faders (Behringer BCR2000/BCF2000 and many synth-style
controllers) become controls of their own, midi.nrpn.<channel>.<parameter>:
CC 99 and 98 pick the parameter, CC 6 and 38 carry the value's high and
low 7 bits, CC 96 and 97 (data increment and decrement) turn it. A
controller that never sends CC 38 is read as 7 bits, so its top is the
value's top. While a channel has a parameter picked, CC 6, 38, 96 and 97
belong to it; the null parameter gives them back as ordinary controls.

Learn sees an NRPN knob as one control; pickup applies; feedback sends
the four control changes, and the output thread sends them as four
messages.

Part of emmertex#1891.

Manual: automate/control-surfaces
Sources: MIDI 1.0 Detailed Specification (Registered and Non-Registered
Parameter Numbers, Data Entry, Data Increment/Decrement); MIDI2LR's NRPN
support (https://github.com/rsjaffe/MIDI2LR, GPL-3.0), read as a
reference for behaviour. No code copied.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… range, or run turned round

A fader, knob with ends, pitch bend or NRPN control can now cover part
of a value's range, for finer steps: from 50 % to 100 % puts Exposure 0
at a fader's bottom and +5 at its top. The first number above the second
turns the control round.

Settings > Controls shows Range under the selected control, in percent;
surface.midiControl takes from and to (shares 0-1, at least 0.01 apart).
The settings file keeps them as midi.controls.<id>.from / to, written
only when they differ from the whole range; anything unsafe in a file
reads as the whole range. Pickup takes over at the near end when the
value is outside the part covered, and feedback puts the control at
that end.

Part of emmertex#1891.

Manual: automate/control-surfaces
Sources: MIDI2LR's per-control limits (https://github.com/rsjaffe/MIDI2LR,
GPL-3.0), read as a reference for behaviour. No code copied.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant