diff --git a/backend/konduktor/adapters/onelibrary/export.py b/backend/konduktor/adapters/onelibrary/export.py index 4c8dc9e..da3ded3 100644 --- a/backend/konduktor/adapters/onelibrary/export.py +++ b/backend/konduktor/adapters/onelibrary/export.py @@ -367,12 +367,13 @@ class OneLibraryExporter: if is_memory: # rekordbox keeps 10 (earliest first; the rest are dropped, per # the lossiness rule). A memory cue's colour is PCP2 byte 28 from - # its own 8-colour palette; the hot-cue code + RGB stay zero. + # its own 8-colour palette — what Konduktor SHOWS (stored, else + # the type's), as for a hot cue; the hot-cue code + RGB stay zero. if memory >= MAX_MEMORY_CUES: continue memory += 1 code, rgb = 0, (0, 0, 0) - color_id = memory_palette.anlz_byte(memory_palette.nearest_code(cue.color)) + color_id = memory_palette.anlz_byte(memory_palette.nearest_code(effective_color(cue))) else: # What Konduktor SHOWS — stored colour, else the type's (blue cue, # green loop) — as a rekordbox palette CODE, which is what diff --git a/backend/konduktor/adapters/rekordbox/export.py b/backend/konduktor/adapters/rekordbox/export.py index de074e5..a8c5f36 100644 --- a/backend/konduktor/adapters/rekordbox/export.py +++ b/backend/konduktor/adapters/rekordbox/export.py @@ -213,14 +213,15 @@ class RekordboxExporter: for cue in sorted(item.cues.cues, key=lambda c: c.start): if cue.role == "memory" or cue.slot is None: # rekordbox keeps 10 (earliest first; the rest are - # dropped, per the lossiness rule). Colour: the memory - # palette's nearest swatch, else rekordbox's "unset". + # dropped, per the lossiness rule). Colour: what + # Konduktor SHOWS — stored, else the type's — as the + # nearest of the memory palette's 8, as for a hot cue. if memory >= store.MAX_MEMORY_CUES: continue store.add_memory_cue( track_id, start_sec=cue.start, cue_type=cue.type, length_sec=cue.length, name=cue.name, - color_code=memory_palette.nearest_code(cue.color), + color_code=memory_palette.nearest_code(effective_color(cue)), ) memory += 1 continue diff --git a/backend/konduktor/adapters/traktor/projection.py b/backend/konduktor/adapters/traktor/projection.py index 667f5fd..2b0508d 100644 --- a/backend/konduktor/adapters/traktor/projection.py +++ b/backend/konduktor/adapters/traktor/projection.py @@ -175,6 +175,10 @@ def to_track(e) -> Track: ) +#: Traktor's NAME for a cue nobody named. +UNNAMED = "n.n." + + def is_memory_cue(c) -> bool: """A cue on no pad that is not a grid marker — Traktor's memory cue. @@ -248,7 +252,10 @@ def to_track_cues(entry, offset_ms: float = 0.0) -> TrackCues: slot = c.hotcue if c.hotcue is not None and c.hotcue >= 0 else None cues.append( CuePoint( - name=c.name, + # "n.n." is the name Traktor gives every cue the user did not + # name — a placeholder, not a name, so it crosses as none + # (it once landed in rekordbox as a comment reading "n.n."). + name=None if c.name in (None, "", UNNAMED) else c.name, # An unknown TYPE is projected as a plain cue rather than dropped: # preserving a cue we cannot name beats hiding it from the user. type=NATIVE_TO_CUE_TYPE.get(c.type, "cue"), diff --git a/backend/test_export_pioneer.py b/backend/test_export_pioneer.py index b376596..370a012 100644 --- a/backend/test_export_pioneer.py +++ b/backend/test_export_pioneer.py @@ -236,7 +236,10 @@ def _real_cue_tags(path: Path) -> list[bytes]: def _mask_colour(tag: bytes) -> bytes: - """A PCO2 tag with each entry's code + RGB (after its comment) zeroed.""" + """A PCO2 tag with each entry's colours zeroed: the hot-cue code + RGB + (after its comment) and byte 28, a memory cue's colour. The fixture's + memory loop is uncoloured; Konduktor now exports one in its TYPE colour, + as it draws it (decided 2026-10-16) — pinned separately below.""" if tag[:4] != b"PCO2": return tag out, off = bytearray(tag), struct.unpack(">I", tag[4:8])[0] @@ -244,6 +247,7 @@ def _mask_colour(tag: bytes) -> bytes: length = struct.unpack(">I", tag[off + 8:off + 12])[0] at = off + 44 + struct.unpack(">I", tag[off + 40:off + 44])[0] out[at:at + 4] = bytes(4) + out[off + 28] = 0 off += length return bytes(out) @@ -468,6 +472,8 @@ check("rekordbox keeps 10 memory cues: the earliest 10 are exported", check("a memory cue's colour is byte 28 from its own palette (Red = 2); no hot-cue code", (mem_dicts[0]["color_id"], mem_dicts[0]["code"]) == (memory_palette.anlz_byte(1), 0), (mem_dicts[0]["color_id"], mem_dicts[0]["code"])) +check("an uncoloured one exports in its type colour, as Konduktor shows it (cue -> Blue = 7)", + mem_dicts[1]["color_id"] == memory_palette.anlz_byte(6), mem_dicts[1]["color_id"]) dat_tags = W.cue_tags(mem_dicts[:3], extended=False) mem_pcob = A_.raw_entries(A_.Tag("PCOB", dat_tags[1])) check("a memory PCOB of two or more is linked, status 0, as rekordbox writes it", @@ -609,7 +615,8 @@ check("four cue rows: three hot cues and a memory cue (Kind 0)", check("a plain cue is rekordbox's light blue (code 5)", by_kind.get(1) == (0x05, -1), by_kind.get(1)) check("a loop is rekordbox's green (code 22)", by_kind.get(2) == (0x16, -1), by_kind.get(2)) check("the white grid cue has no swatch, so stays uncoloured", by_kind.get(3) == (None, -1), by_kind.get(3)) -check("the memory cue is written, uncoloured", by_kind.get(0) == (None, -1), by_kind.get(0)) +check("an uncoloured memory cue is written in its type colour (cue -> Blue, Color 6)", + by_kind.get(0) == (None, 6), by_kind.get(0)) check("the contentCue mirror holds all four, colours included", mirror is not None and mirror[0].count('"Kind"') == 4 and '"ColorTableIndex": 22' in mirror[0].replace(":22", ": 22"), mirror and mirror[0][:200]) diff --git a/backend/test_traktor_adapter.py b/backend/test_traktor_adapter.py index 49cc37e..4e499b8 100644 --- a/backend/test_traktor_adapter.py +++ b/backend/test_traktor_adapter.py @@ -166,6 +166,8 @@ with tempfile.TemporaryDirectory() as d: count_before = adapter.track(tid2).cue_count tc = adapter.add_memory_cue(tid2, start_sec=33.0, cue_type="fade_in") mem = [c for c in tc.cues if c.role == "memory"] + check("an unnamed cue (Traktor's \"n.n.\") projects with no name", + mem[0].name is None if mem else False, str(mem)) check("add_memory_cue returns fresh cues with the memory cue, by id", len(mem) == 1 and mem[0].slot is None and mem[0].id and mem[0].type == "fade_in" and abs(mem[0].start - 33.0) < 0.001, str(mem))