Skip to content

[GSoC] CMRT 09: Library: Add CMRT data overlay ("Use CMRT Data") - #16764

Draft
Swarnadip-Kar wants to merge 104 commits into
mixxxdj:mainfrom
Swarnadip-Kar:pr/cmrt-phase2-canonical-overlay
Draft

[GSoC] CMRT 09: Library: Add CMRT data overlay ("Use CMRT Data")#16764
Swarnadip-Kar wants to merge 104 commits into
mixxxdj:mainfrom
Swarnadip-Kar:pr/cmrt-phase2-canonical-overlay

Conversation

@Swarnadip-Kar

@Swarnadip-Kar Swarnadip-Kar commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Lets a CMRT member track load its canonical track's beatgrid and cues in
place of its own -- without touching its own stored data, so unchecking
the box restores exactly what was there before, and without touching the
audio file at all. Toggled per-track via a library checkbox column.

This version puts the redirect inside Track's own mutators, so every
existing caller (CueControl included) is redirected transparently with
zero changes to any of them.

Changes

  • New cmrt_members.use_cmrt_data column + DAO read/write methods
    (getCmrtMemberByTrackId(), updateMemberUseCmrtData()).
  • "Use CMRT Data" library checkbox column (CheckboxDelegate, same
    CASE-gated virtual-column pattern the other CMRT columns already use).
  • Track::applyCmrtOverlay()/clearCmrtOverlay(): swaps a track's own
    cues/beats for a shifted, resampled view of its canonical track's
    data. Handles cross-sample-rate transfers correctly by reprojecting
    every beat marker and cue position through seconds (the one
    sample-rate-independent common unit) rather than a raw frame-offset
    add.
  • Write-through in createAndAddCue()/removeCue()/trySetBeats()/the
    per-Cue updated() handler, so edits made while the overlay is active
    land on the canonical track, not the local stashed copy.
  • TrackDAO applies the overlay at load time (getTrackById()) and
    exposes apply/restore entry points for the checkbox's live-toggle
    case.
  • CmrtGroupingService purges overlaying members' cached Track objects on
    canonical re-election, so a stale TrackPointer doesn't linger.

Notes for reviewers

  • Two argument-order fixes to FingerprintMatcher::compare() calls in
    CMRT 07 (inverted offset sign in replaceCanonical() and in the
    re-election loop, found while building this feature) are folded back
    into their originating commits in CMRT 07 rather than left here as
    separate patches.

Depends on: [GSoC] CMRT 08: Library: Add CMRT track name column (#16763)

Adds schema revision 41 to extend the library table with
MusicBrainz and AcoustID metadata fields required for
Chromaprint-based lookup workflows.

New columns:
- musicbrainz_recording_id
- musicbrainz_release_id
- musicbrainz_track_id
- musicbrainz_artist_id
- acoustid_id
- acoustid_lookup_at
- acoustid_lookup_status

Also adds indexes for MusicBrainz and AcoustID lookup paths.

The revision is backwards-compatible and does not modify
existing user data.
Adds schema revision 42 extending track_analysis with a
TEXT payload column intended for small metadata blobs such
as audio quality metrics and Chromaprint version metadata.

Raw fingerprint arrays are intentionally not stored in
the database.

Also adds a composite lookup index on (track_id, type).
Adds schema revision 43 introducing database tables for
Chromaprint fingerprint grouping, CMRT membership,
AcoustID queue management, and AcoustID response caching.

New tables:
- fingerprint_metadata
- cmrt_groups
- cmrt_members
- acoustid_queue
- acoustid_cache

Design notes:
- fingerprint_hash is a non-unique SimHash pre-filter
- chroma_sha256 is used as the canonical integrity key
- raw fingerprint arrays are not stored in SQLite
- ON DELETE CASCADE is intentionally omitted

Also adds supporting indexes and bumps
kRequiredSchemaVersion from 42 to 43.
This commit implements reading, writing, and deleting `.chroma`
binary files directly to disk, avoiding BLOBs in the SQLite database.
It also wires TrackFingerprintDao into the broader DAO ecosystem
and adds file cleanup cascades into the central track purging logic.

Changes:
- trackfingerprintdao.h/cpp: Accept UserSettingsPointer to manage
  paths privately in ~/.mixxx/fingerprints/ and add save/load/delete.
  saveChromaFile uses a write-temp-then-rename pattern.
- trackdao.h/cpp: Add TrackFingerprintDao dependency and loop over
  purged tracks in onPurgingTracks() to call deleteChromaFile().
- trackcollection.cpp: Initialize m_trackFingerprintDao with pConfig
  and pass to m_trackDao.
- libraryscanner.h/cpp: Add TrackFingerprintDao member to satisfy
  the updated TrackDAO constructor dependency during background scans.
@Swarnadip-Kar
Swarnadip-Kar force-pushed the pr/cmrt-phase2-canonical-overlay branch from 176f1e4 to 34de2b3 Compare August 9, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant