Skip to content

fix(locallibrary-cli): player output picking, active loops, shifted keys - #306

Merged
botandbang merged 4 commits into
mainfrom
bnb/player-fixes
Nov 1, 2026
Merged

botandbang merged 4 commits into
mainfrom
bnb/player-fixes

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

The player now opens its outputs on a worker thread and reports back through the app's message channel. That covers the output picked from the outputs list (d) and the one it opens to play through at start, on the first play, or after an output goes away. Picking one, the track keeps playing through the old output. Playing a track with no output open, its file opens meanwhile and waits for the output. When no output opens, the player says it can't play, and space carries on from there. Keys still work while a slow Bluetooth or AirPlay device answers, and the last output asked for wins. App::play_file no longer returns a bool.

Loops that rekordbox marks active (PCPT status 4) now play round on their own when playback reaches them. anlz::cues reads the status, anlz::track_cues carries the flag from the .DAT's basic lists onto the .EXT's extended list, and loclib-model's analysis::Cue has a new active_loop field (default false when missing). The RPC schema and TypeScript types are regenerated.

Key events where shift comes as a modifier on a lowercase letter (CSI u, xterm's modifyOtherKeys) are now read as the capital. Q quit the player in those terminals.

Added tests:

  • a slow output that doesn't hold up the UI, and the last output picked winning
  • property tests for active loops, from written analysis files through to the deck
  • the "mixes into" panel on the 3,886-track fixture
  • a Hegel property that plays every deck key over damaged beat grids with quantize on and off

Fixes LOC-79
Fixes #181
Fixes LOC-78
Fixes #180
Refs LOC-11 (a likely cause fixed; the reporter needs to confirm)
Refs #99
Refs LOC-13 (not reproduced; test added)
Refs #103

LOC-98 (#225) was already fixed by efb0e25 and can be closed there.

How it was tested

  • cargo fmt --check, and cargo clippy --all-targets -- -D warnings for loclib-model, loclib-waveform, locallibrary and locallibrary-cli.
  • cargo nextest run -p locallibrary-cli -E 'binary(locallibrary) & test(/^tui::/)': 518 pass. The output, active loop, quantize, shifted key and mixes-into tests pass; the new active loop property passed 3 x 300 cases.
  • locallibrary, loclib-model and loclib-waveform filtered on active, cue, anlz and analysis: 234 pass.
  • Not run: x86_64-pc-windows-msvc clippy and the full suite.

Checklist

  • Tests cover the change
  • For locallibrary: apps/locallibrary/CHANGELOG.md has a line under Unreleased, if people using it will notice
  • The READMEs, docs/ and --help still say what the code does (apps/locallibrary/docs/rpc/ too, for a sidecar change)

Planned as these commits, folded into one because they share files:

- fix(locallibrary-cli): open the player's outputs in the background
- feat(locallibrary): read active loops from the analysis and loop them in the player
- fix(locallibrary-cli): take a shifted letter sent as its code for the capital
- test(locallibrary-cli): the mixes-into panel's keys and quantize on any grid
@botandbang
botandbang requested a review from bnb as a code owner October 30, 2026 16:15
@linear-code

linear-code Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

LOC-13

LOC-79

LOC-78

LOC-11

bnb
bnb previously approved these changes Oct 30, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation locallibrary locallibrary and the loclib-* crates locallibrary: cli The locallibrary command line locallibrary: player The terminal player and its waveforms locallibrary: sidecar The JSON-RPC sidecar and the api module it serves locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: mixes Finding the tracks a recorded mix plays, and mix reports tests Tests, fixtures and test harnesses labels Oct 30, 2026
bnb
bnb previously approved these changes Oct 31, 2026
@botandbang

Copy link
Copy Markdown
Contributor Author

Closing and reopening so CI runs on the new single-workflow CI against current main. Branch unchanged.

@botandbang botandbang closed this Oct 31, 2026
@botandbang botandbang reopened this Oct 31, 2026
@botandbang botandbang closed this Oct 31, 2026
@botandbang botandbang reopened this Oct 31, 2026
@botandbang
botandbang enabled auto-merge October 31, 2026 23:36
@botandbang
botandbang disabled auto-merge October 31, 2026 23:45
@github-actions github-actions Bot added locallibrary: interop Libraries for Traktor, Serato and Engine DJ locallibrary: plugins The plugin protocol, its host and the built-in plugins labels Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

Rust coverage

From run 23. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.39% (84505/86774) 96.51% (13523/14012) 95.66% (186068/194505)
Hegel property tests alone 95.39% (82770/86774) 94.13% (13189/14012) 93.47% (181813/194505)

@botandbang
botandbang added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 2e8f398 Nov 1, 2026
31 checks passed
@botandbang
botandbang deleted the bnb/player-fixes branch November 1, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation locallibrary: cli The locallibrary command line locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: interop Libraries for Traktor, Serato and Engine DJ locallibrary: mixes Finding the tracks a recorded mix plays, and mix reports locallibrary: player The terminal player and its waveforms locallibrary: plugins The plugin protocol, its host and the built-in plugins locallibrary: sidecar The JSON-RPC sidecar and the api module it serves locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses

Projects

None yet

2 participants