Skip to content

Issue #1891: MIDI controllers show the photo's values (feedback) - #1930

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

OneSlips wants to merge 3 commits into
emmertex:stagingfrom
RAD-Films:pr/midi-feedback

Conversation

@OneSlips

@OneSlips OneSlips commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Part of #1891. Builds on #1920 (pickup) and #1913: this branch contains their commits; the change here is the last commit. I'll rebase it onto staging as those merge and mark it ready.

What it does

The app sends values back to MIDI controllers, so the controller shows the photo:

  • A fader or knob with ends bound to a value gets its place (control change 0–127, pitch bend 14 bits): motor faders move to the photo's value as you change photos or pages, and knobs that keep a position follow.
  • A note or button control gets its light (127 on, 0 off) when its binding has an on state: Auto Sync, a tool, Before/After, a rating, and the rest of the states the surface keys already light for.
  • Endless knobs get nothing here: each controller takes ring values its own way, so built-in layouts (next PR) drive their rings.
  • Only what changed goes out, at most 25 times a second. A control moved in the last 300 ms gets nothing, so its own echo never fights the hand; once it rests it gets the value it set.
  • Feedback goes back to the port the control last sent from (else to every port in use), through the controller's output port of the same name, or one whose name holds it (Windows sometimes names it MIDIOUT2 (…)). A port that opens again gets everything again.
  • On by default. Settings ▸ Controls ▸ MIDI controllers ▸ Send values back to the controller turns it off; command surface.midiFeedback {on}.

Code: a pure lcc_surface::feedback module (messages and the change diff, bounded), the host side in surface_midi.rs, and a midi-output thread in the desktop app (Windows/macOS, midir).

Tests

  • lcc-surface feedback::tests: messages for CC, pitch bend, notes and button CCs (none for endless knobs), only changes sent, nothing to a control in hand, reset, bounded state.
  • lcc-app feedback_goes_to_the_output_port_named_like_the_input.
  • lcc-ui-egui values_and_lights_go_back_to_the_controller: the fader, knob and Auto Sync light get their values on opening a photo; nothing is re-sent while nothing changes; Auto Sync on lights the button; a contrast change elsewhere moves the knob; a fader in hand gets no echo and gets its value once it rests; off sends nothing; a missing on is refused.
  • The Settings learn test scrolls the action list into view (the page grew by two rows).
  • cargo xtask ci --quick green.

New UI strings are translated in all 17 fork catalogs. Checked with synthetic MIDI only; motor faders and LEDs on real hardware are not yet tried.

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

🤖 Generated with Claude Code

OneSlips and others added 3 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>

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