Skip to content

link/prolink: relocate the Pioneer wire encoders out of analysis (modular-backends part 3c)#4

Merged
vynulldev merged 3 commits into
mainfrom
prolink-encoders
Jul 8, 2026
Merged

link/prolink: relocate the Pioneer wire encoders out of analysis (modular-backends part 3c)#4
vynulldev merged 3 commits into
mainfrom
prolink-encoders

Conversation

@vynulldev

Copy link
Copy Markdown
Owner

Summary

Part 3c of the modular-backends refactor: move the Pioneer (Pro DJ Link) wire-format encoders out of analysis into a new link/prolink package, leaving analysis as pure DSP plus the neutral core.Analysis projection. Byte-safe with zero behavior change — the golden-hash net over all 10 encoders is unchanged, and no serving-path logic is touched, so no deck is needed to merge.

What's in it (3 commits)

  1. Decouple encodingAnalyzeTrack splits into DSP followed by an installed Encoder interface; analysis knows only the interface + SetEncoder.
  2. Export shared consts — pure rename so the encoders can reference them once relocated.
  3. Relocate — the encoders + pioneerEncoder + their tests move to link/prolink; main installs prolink.NewEncoder() at startup; dbserver/api/tools call prolink.*.

Moved to link/prolink

The waveform generators (PWV4/5/6/7), GeneratePQT2, GeneratePSSI, GeneratePVB2, GeneratePVBR, pioneerEncoder (+ NewEncoder()), and all the encoder tests (they'd form an import cycle if left in package analysis).

Deliberately kept in analysis

Things with a non-serving consumer that would otherwise invert the dependency: the beat-grid encoders (GenerateBeatGrid[FromBeats], used by the ANLZ import path — prolink calls them across the package, so there's a single source of truth and no duplicated logic) and the ANLZ container / VBR-seek helpers (WrapANLZ, VBRSeekIndex, section IO — used by dbserver/export/import). These relocate when the rekordbox import/export is extracted (a later step).

Why it's safe

No cache, serving-path, or encoder-logic change — just relocation + delegation. The 10 golden-hash tests (PWV4/5/6/7 + PQT2 + beat-grid ×2 + PSSI + PVB2 + PVBR) are byte-for-byte identical.

Verification

  • go build ./..., go vet, gofmt -l clean.
  • go test ./analysis/ ./link/prolink/ ./dsp/ ./api/ ./dbserver/ all pass, all 10 golden hashes unchanged.
  • analysisRate was exported to AnalysisRate so the relocated tests share the DSP rate. History preserved via git mv.

Not in this PR (next)

Part 3d — the flow flip: cache neutral core.Analysis, encode at serve time, repoint the ~14 serving reads, slim Result. That one changes live behavior and gets a real-CDJ smoke test before merge.

Where to look

link/prolink/ is the new package (encoders + tests); analysis/encoder.go holds the Encoder interface + SetEncoder; main.go installs the encoder.

vynulldev added 3 commits July 7, 2026 22:12
…ep 1)

Split AnalyzeTrack into DSP (brand-neutral) followed by an installed
Encoder that fills the Pioneer wire blobs (waveforms, beat grid, PQT2,
PSSI). analysis knows only the Encoder interface + a package-level default
(the built-in pioneerEncoder), so the encoders can move to link/prolink
next without inverting the dependency; SetEncoder swaps the implementation.

Byte-safe: the encode sequence and inputs are unchanged — all 10 golden
hashes and the full analysis suite pass. Relocating pioneerEncoder and the
Generate* functions to link/prolink is the next commit.
…rt 3c prep)

Rename previewPoints, anlzPreviewPoints, colorPreviewPoints, maxHeight,
previewMaxHeight, fftSize, and detailEntriesPerSec to exported names so the
encoders can reference them once relocated to link/prolink. Pure rename —
byte-neutral, all 10 golden hashes unchanged.
…t 3c)

Move the Pro DJ Link waveform/PQT2/PSSI/PVB2/PVBR generators and the
pioneerEncoder into a new link/prolink package, leaving analysis as DSP plus
the neutral core.Analysis projection. AnalyzeTrack delegates to the installed
Encoder (main installs prolink.NewEncoder() at startup); the direct callers in
dbserver/api/tools switch to prolink. The encoder tests move with the code
(they'd cycle if left in package analysis).

Kept in analysis where a non-serving consumer needs them without inverting the
dependency: the beat-grid encoders (GenerateBeatGrid[FromBeats] — used by the
ANLZ import path, so prolink calls them via analysis and no logic is
duplicated) and the ANLZ container / VBR-seek helpers (WrapANLZ, VBRSeekIndex,
section IO — used by dbserver/export/import). Those relocate later, once the
rekordbox import/export is extracted.

Byte-safe: all 10 colour-waveform + blob golden hashes unchanged; analysis,
prolink, api, and dbserver suites pass. analysisRate is exported as
AnalysisRate so the relocated tests share the DSP rate.
@vynulldev vynulldev merged commit ee97437 into main Jul 8, 2026
1 check passed
@vynulldev vynulldev deleted the prolink-encoders branch July 8, 2026 03:59
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