Added setting for deck focus switching

This commit is contained in:
patben8 committed 2026-11-03 11:46:50 +01:00
1 parent 4799eaef17
commit 2a40106ea5
4 files changed
+32 -29

No files matched your search

+4 -2
View File
@@ -28,6 +28,8 @@ export const APP_SETTING_DEFAULTS = {
perfStems: true,
/** A deck's keylock starts on. */
keylockDefault: true,
/** Any press on a deck focuses it (else only its A/B badge). */
autoFocusDeck: true,
/** EQ full left kills the band (else -26 dB, DJM-style). */
eqKill: false,
/** The crossfader curve: 0 smooth (constant power) .. 1 sharp (a cut).
@@ -183,14 +185,14 @@ export function AppSettings({ onClose }: { onClose: () => void }) {
}
export function Check({ checked, onChange, title, text }: {
checked: boolean; onChange: (v: boolean) => void; title: string; text: string
checked: boolean; onChange: (v: boolean) => void; title: string; text?: string
}) {
return (
<label className="flex cursor-pointer items-start gap-2.5">
<input type="checkbox" className="mt-0.5" checked={checked} onChange={(e) => onChange(e.target.checked)} />
<span className="min-w-0">
<span className="block text-sm text-text">{title}</span>
<span className="block text-xs text-faint">{text}</span>
{text && <span className="block text-xs text-faint">{text}</span>}
</span>
</label>
)
+10 -17
View File
@@ -37,6 +37,7 @@ export function PerformanceSettings({ onClose }: { onClose: () => void }) {
const writePrefs = usePrefsWriter()
const perfStems = useAppSetting('perfStems')
const keylockDefault = useAppSetting('keylockDefault')
const autoFocusDeck = useAppSetting('autoFocusDeck')
const eqKill = useAppSetting('eqKill')
const sharpnessSetting = useAppSetting('crossfaderSharpness')
const fxFilterRange = useAppSetting('fxFilterRange')
@@ -81,22 +82,24 @@ export function PerformanceSettings({ onClose }: { onClose: () => void }) {
</button>
</div>
<div className="max-h-[70vh] space-y-4 overflow-y-auto px-5 py-4 text-sm">
<p className="text-xs text-faint">
The second deck and the mixer (P, or the decks button in the deck's header).
</p>
<section className="space-y-2">
<h3 className={section}>Decks</h3>
<Check
checked={perfStems}
onChange={(v) => void set({ perfStems: v })}
title="Load stem tracks as stems"
text="A stem track loaded into a deck in performance mode plays its four stems (mute and solo work). Off, it plays its mix: lighter on an older computer, since keylock then stretches one stream instead of four. Applies to the next track loaded."
text="Off plays the mix: lighter on older computers."
/>
<Check
checked={keylockDefault}
onChange={(v) => void set({ keylockDefault: v })}
title="Keylock on"
text="Each deck starts with keylock on: a tempo change keeps the pitch. Each deck's KEY button still switches it."
title="Keylock on by default"
/>
<Check
checked={autoFocusDeck}
onChange={(v) => void set({ autoFocusDeck: v })}
title="Click a deck to focus it"
text="Off: only its A/B badge does."
/>
</section>
<section className="space-y-2">
@@ -139,21 +142,11 @@ export function PerformanceSettings({ onClose }: { onClose: () => void }) {
</div>
</div>
</div>
<span className="block text-xs text-faint">
Smooth blends: each channel fades across the whole travel, both at −3 dB in the middle.
Sharper keeps both at full level across a widening middle and fades only near the ends —
at full, a cut over the last few percent, for scratching.
</span>
</div>
</section>
<section className="space-y-2">
<h3 className={section}>Filter FX</h3>
<span className="block text-xs text-faint">
Each channel's FILTER knob filters — low-pass to the left, high-pass to the right — and
the effect picked above it rides along, growing as the knob turns: the reverb blends into
one three times as long, the delay gets longer and the flanger faster (each up to ×8)
from the settings below. These apply to both channels.
</span>
<span className="block text-xs text-faint">Effects grow as the filter opens.</span>
<Choice
title="Filter range (Filter alone)"
value={fxFilterRange}
+15 -8
View File
@@ -122,6 +122,7 @@ export function PrepStrip({
// Performance-mode settings (Settings ▸ Performance mode…).
const perfStems = useAppSetting('perfStems')
const keylockDefault = useAppSetting('keylockDefault')
const autoFocus = useAppSetting('autoFocusDeck')
const eqKill = useAppSetting('eqKill')
const sharpness = useAppSetting('crossfaderSharpness')
const filterRange = useAppSetting('fxFilterRange')
@@ -300,22 +301,27 @@ export function PrepStrip({
)
}
// Any press on a deck focuses it — unless the `autoFocusDeck` setting is
// off, when only its letter badge does (decided 2026-11-03).
const clickFocus = autoFocus ? onFocus : undefined
const pane = (id: DeckId, children: ReactNode, className = 'min-w-0 flex-1') => (
<div className={className} onPointerDownCapture={() => onFocus(id)}>
<div className={className} onPointerDownCapture={clickFocus && (() => clickFocus(id))}>
{children}
</div>
)
const badge = (id: DeckId) => (
<span
<button
type="button"
onPointerDown={() => onFocus(id)}
className={`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg font-mono text-[13px] font-semibold transition-colors ${
id === focused
? 'bg-accent text-ink-950 shadow-[0_0_14px_-2px_var(--color-accent)]'
: 'bg-ink-800 text-muted'
: 'bg-ink-800 text-muted hover:text-text'
}`}
title={id === focused ? `Deck ${id} — the keys act on it` : `Deck ${id} — click it to focus (Alt/Option + key acts on it)`}
title={id === focused ? `Deck ${id}: the keys act on it` : `Deck ${id}: click to focus`}
>
{id}
</span>
</button>
)
return (
<div className="glass flex h-[32rem] shrink-0 flex-col gap-2 p-4">
@@ -326,7 +332,7 @@ export function PrepStrip({
{pane('B', <DeckHeader deck={b} compact badge={badge('B')} />)}
</div>
{DECK_IDS.map((id) => (
<DeckLane key={id} id={id} deck={deckOf(id)} view={view} focused={id === focused} drop={drop} onFocus={onFocus} />
<DeckLane key={id} id={id} deck={deckOf(id)} view={view} focused={id === focused} drop={drop} onFocus={clickFocus} />
))}
<div className="flex shrink-0 gap-3">
{pane(
@@ -392,7 +398,8 @@ function DeckLane({
view: DeckView
focused: boolean
drop: DeckDrop
onFocus: (id: DeckId) => void
/** Focus on any press (the `autoFocusDeck` setting); undefined = off. */
onFocus?: (id: DeckId) => void
}) {
const [ref, over] = useDropTarget<true>({
hint: drop.hint,
@@ -402,7 +409,7 @@ function DeckLane({
return (
<div
ref={ref}
onPointerDownCapture={() => onFocus(id)}
onPointerDownCapture={onFocus && (() => onFocus(id))}
className={`relative flex min-h-0 flex-1 rounded-2xl transition-shadow ${
over ? 'ring-2 ring-accent' : focused ? 'ring-1 ring-accent/45' : ''
}`}