From 642977e9bc145001bb2c7a44afd7aa597e81cc3f Mon Sep 17 00:00:00 2001 From: Benjamin Hardy Date: Fri, 25 Sep 2026 16:56:15 +0200 Subject: [PATCH] Improved manual loop visuals --- CLAUDE.md | 6 +++ frontend/src/components/LoopControls.tsx | 39 ++++++++++++-- frontend/src/components/MainWaveform.tsx | 12 ++++- frontend/src/components/PrepStrip.tsx | 23 +++++--- frontend/src/lib/cues.ts | 67 +++++++++++++++++++++--- 5 files changed, 130 insertions(+), 17 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index eea5e25..437cf28 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -404,6 +404,12 @@ Two independent apps that talk over HTTP: `LoopControls` has a BEAT / MAN switch: BEAT shows `− size +` (the size key sets or clears a loop of that length; −/+ halve/double, resizing an engaged beat loop from its locked start), MAN shows IN / OUT / toggle. + The armed IN point is React STATE (`loopInPoint`), not a ref, because the + IN button (lit "armed") and the waveform (`drawLoopIn`: a green IN line + plus a dashed band to the playhead — the loop OUT would make now) both + show it. OUT closes an armed IN, or with a manual loop already set moves + its end to the playhead. A loop that is switched off stays drawn as a dim + outline (`drawLoop(…, idle)`), so the toggle shows what it would restore. **‹ › (and ←/→) MOVE an engaged loop by its own length**, Traktor-style, and only jump the playhead when no loop is engaged. The move sets the new loop BEFORE seeking: `PlaybackEngine.seek` honours the loop in force, so diff --git a/frontend/src/components/LoopControls.tsx b/frontend/src/components/LoopControls.tsx index a19d923..5ba9671 100644 --- a/frontend/src/components/LoopControls.tsx +++ b/frontend/src/components/LoopControls.tsx @@ -26,6 +26,10 @@ interface Props { onToggleSize: () => void // manual mode canToggle: boolean // a loop region exists to switch on/off + /** IN was pressed and is waiting for OUT. */ + inArmed: boolean + /** A manual (IN/OUT) loop exists, engaged or not. */ + manualSet: boolean onLoopIn: () => void onLoopOut: () => void onToggleLoop: () => void @@ -35,7 +39,16 @@ interface Props { const LIT = 'bg-gradient-to-b from-[#7bf0ad] to-mint text-ink-950 shadow-[inset_0_1px_0_rgb(255_255_255/0.6),0_0_14px_rgb(61_220_132/0.55)]' -const KEY = 'flex items-center justify-center rounded-[9px] transition-colors disabled:opacity-30' +// Every key presses in when clicked, so a press is felt even when what it did +// (a loop moved, an in-point set) is somewhere else on screen. +const KEY = + 'flex items-center justify-center rounded-[9px] transition-[color,background-color,box-shadow,transform,filter] duration-75 ' + + 'active:scale-[0.93] active:brightness-125 disabled:opacity-30 disabled:active:scale-100' +// An armed IN: a green rim and glow — "waiting for OUT". +const ARMED = + 'bg-mint/15 text-mint shadow-[inset_0_0_0_1px_rgb(61_220_132/0.75),0_0_12px_-3px_rgb(61_220_132/0.7)]' +// A set point (the loop exists): green text on a faint green tint. +const SET = 'bg-mint/10 text-mint shadow-[inset_0_0_0_1px_rgb(61_220_132/0.35)]' // BOTH modes' clusters are this wide, so switching BEAT ⇄ MAN never shifts // the pads and tempo controls to their right. const CLUSTER = 'well flex h-10 w-[8.5rem] shrink-0 items-center gap-0.5 rounded-xl p-[3px]' @@ -59,6 +72,8 @@ export function LoopControls({ sizeLit, onToggleSize, canToggle, + inArmed, + manualSet, onLoopIn, onLoopOut, onToggleLoop, @@ -121,10 +136,28 @@ export function LoopControls({ ) : (
- -