Fixed auto hotcue overlap and analysis locked hotcue

This commit is contained in:
patben8 committed 2026-09-24 14:05:35 +02:00
1 parent 46ce3db916
commit 6c123e2597
14 files changed
+132 -100

No files matched your search

+6 -3
View File
@@ -120,7 +120,7 @@ export interface CuePoint {
/** False when the adapter refuses commands on this cue. Gate on THIS, never
* on a platform-specific reason like grid_marker. */
editable: boolean
readonly_reason: 'beatgrid_companion' | 'platform_managed' | null
readonly_reason: 'platform_managed' | null
/** Index of the grid marker this cue mirrors, where the platform pairs them.
* A display hint only; null on platforms that do not. */
grid_marker: number | null
@@ -166,8 +166,10 @@ export interface AutoCueSlot {
/** What happened to one requested slot. `not_found`: the track has no such
* event (e.g. no third drop); `out_of_range`: the offset moves it outside the
* track; `occupied`: a cue is there and overwrite was off; `protected`: a cue
* the adapter will not replace (a grid marker's). */
export type AutoCueStatus = 'placed' | 'not_found' | 'out_of_range' | 'occupied' | 'protected'
* the adapter will not replace (a grid marker's); `duplicate`: a lower slot
* already got a cue on the same beat (`duplicate_of`). */
export type AutoCueStatus =
| 'placed' | 'not_found' | 'out_of_range' | 'occupied' | 'protected' | 'duplicate'
export interface AutoCueOutcome {
slot: number
@@ -175,6 +177,7 @@ export interface AutoCueOutcome {
status: AutoCueStatus
start: number | null
name: string | null
duplicate_of: number | null
}
export interface AutoHotcuesResult {
+2 -1
View File
@@ -232,7 +232,8 @@ export function AutoCueDialog({ track, slotCount, slotLabel, existing, onClose,
<p className="mt-3 text-[11px] leading-relaxed text-faint">
Events are found on the beatgrid, counting bar 1 from its first marker — if drops land a
bar or two off, move the grid marker onto the first downbeat. Occupied slots are kept
unless you tick Replace. Your slot setup is remembered for the next track.
unless you tick Replace. If two slots land on the same beat, only the lower one gets
the cue. Your slot setup is remembered for the next track.
</p>
</div>
+2 -5
View File
@@ -13,7 +13,6 @@ interface Props {
}
const READONLY_LABELS: Record<string, string> = {
beatgrid_companion: 'Beatgrid marker — managed by the grid controls',
platform_managed: 'Managed by the DJ app — not editable here',
}
@@ -25,10 +24,8 @@ const READONLY_LABELS: Record<string, string> = {
* can implement momentary "cue preview" (play while held). Press creates when
* empty and jumps/triggers when assigned; release ends any preview.
*
* A slot may be held by a grid marker's companion cue (Traktor writes one beside
* most of its own markers). Those belong to the beatgrid, so they are shown with
* the marker colour and a ⊞ instead of a number, and pressing one only seeks —
* the backend refuses hotcue edits on them, and showing that up front is better
* A cue the adapter will not edit (`editable: false`) shows a lock and only
* seeks; the backend would refuse the edit, and showing that up front is better
* than surfacing the refusal as an error.
*/
export function HotcueBar({
+5 -7
View File
@@ -648,12 +648,6 @@ export function PrepStrip({ track, playRequest = 0, onError, onNotify, fromDevic
const onSlotPress = async (slot: number) => {
if (!track) return
const cue = hotcueAt(slot)
// A grid marker's companion cue holds this slot. It belongs to the beatgrid,
// so pressing it only seeks — never create, retype, select or preview.
if (cue?.grid_marker != null) {
seekManual(cue.start)
return
}
if (!cue) {
if (refuseCueEdit()) return
try {
@@ -710,8 +704,12 @@ export function PrepStrip({ track, playRequest = 0, onError, onNotify, fromDevic
const placed = by('placed').length
const missing = [...by('not_found'), ...by('out_of_range')].map((o) => eventLabel(o.event))
const kept = by('occupied').length + by('protected').length
const dupes = by('duplicate').map(
(o) => `${slotLabel(o.slot)} (same beat as ${slotLabel(o.duplicate_of ?? o.slot)})`,
)
const parts = [`Placed ${placed} hotcue${placed === 1 ? '' : 's'}`]
if (missing.length) parts.push(`not in this track: ${missing.join(', ')}`)
if (dupes.length) parts.push(`skipped ${dupes.join(', ')}`)
if (kept) parts.push(`${kept} occupied slot${kept === 1 ? '' : 's'} kept`)
onNotify?.(placed ? 'success' : 'error', parts.join(' · '))
}
@@ -740,7 +738,7 @@ export function PrepStrip({ track, playRequest = 0, onError, onNotify, fromDevic
const deleteHotcueSlot = async (slot: number) => {
const existing = hotcueAt(slot)
if (!track || !existing) return // nothing to remove in an empty slot
if (existing.grid_marker != null) return // beatgrid-owned: delete the marker instead
if (!existing.editable) return // the adapter would refuse it
if (refuseCueEdit()) return
try {
applyCueEdit(await api.deleteCue(track.id, slot))
-3
View File
@@ -90,9 +90,6 @@ export function drawCues(
const flagH = Math.round(14 * dpr)
const half = Math.floor(lineW / 2)
for (const cue of cues) {
// A grid marker's companion cue is drawn by drawBeatgrid; painting it here
// too would stack a flag on top of every marker line.
if (cue.grid_marker != null) continue
const color = cueColor(cue)
const x = Math.round(timeToX(cue.start))