Skip to content

MIDI Pick-up Mode: the rapid-movement branch is unreachable #3942

Description

@mcfnord

🤖 AI: Pick-up Mode's rapid-movement handling never executes. Its help text promises a control waits until the physical controller matches the software value, and an inner branch exists to also catch a controller swept fast enough that its values "skip over" that value. That branch is unreachable, for two independent reasons.

midiPickupTryApply returns before appending to the history buffer, so while a control is armed the buffer stays empty and the size() >= 2 guard in front of the crossing test never holds. Independently, prevMidi reads back(), while the sole call site has already pushed the incoming sample onto that same buffer — so prevMidi is the incoming sample, and the bracket test reduces to midiValue == currentValue, which the tolerance check above it has already accepted.

Driving those helpers verbatim across every strictly-bracketing two-sample crossing of the fader range, both samples outside the tolerance: on ee40cfe, 0 of 147,440 pick up. Repairing either defect alone leaves 0. Repairing both gives 147,440. What remains on stock is the tolerance window by itself — armed at fader 50, 5 of 101 controller positions are accepted, 48 through 52 — so a fader swept briskly steps over the window and stops responding, which is the case the unreachable branch was written for.

Present since the MIDI GUI PR.

🤖 This message was written by AI and reviewed by @mcfnord.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions