jamulussoftware / jamulussoftware/jamulus

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

Open
#3,942 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.1k
Forks
248
Avg merge
2d 3h
Merged PRs (30d)
9

Description

**🤖 AI:** Pick-up Mode's rapid-movement handling never executes. [Its help text](https://github.com/jamulussoftware/jamulus/blob/ee40cfe20ecebe92eeec9eecc2b9ee8b948f439f/src/clientsettingsdlg.cpp#L427-L430) promises a control waits until the physical controller matches the software value, and [an inner branch](https://github.com/jamulussoftware/jamulus/blob/ee40cfe20ecebe92eeec9eecc2b9ee8b948f439f/src/audiomixerboard.cpp#L94-L96) 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](https://github.com/jamulussoftware/jamulus/blob/ee40cfe20ecebe92eeec9eecc2b9ee8b948f439f/src/audiomixerboard.cpp#L119-L129) 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()`](https://github.com/jamulussoftware/jamulus/blob/ee40cfe20ecebe92eeec9eecc2b9ee8b948f439f/src/audiomixerboard.cpp#L97-L99), while [the sole call site](https://github.com/jamulussoftware/jamulus/blob/ee40cfe20ecebe92eeec9eecc2b9ee8b948f439f/src/audiomixerboard.cpp#L113-L119) 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 ee40cfe2, 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](https://github.com/jamulussoftware/jamulus/pull/3502).

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

Contributor guide

Open the contributing guide

Research direction

Start in src/audiomixerboard.cpp at midiPickupTryApply, the crossing branch, prevMidi, and their call site; read the Pick-up Mode help text in src/clientsettingsdlg.cpp for intended behavior. Trace history updates and previous-sample selection, then validate that strictly bracketing rapid movements are handled while the existing tolerance window remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.