From f55b8f06e42717da02dc3999ac5c04796f83f1f0 Mon Sep 17 00:00:00 2001 From: Benjamin Hardy Date: Tue, 3 Nov 2026 12:18:34 +0100 Subject: [PATCH] Autogain is now a toggleable performance setting --- CLAUDE.md | 5 ++-- frontend/src/components/AppSettings.tsx | 2 ++ .../src/components/PerformanceSettings.tsx | 7 ++++++ frontend/src/components/PrepStrip.tsx | 8 ++++--- frontend/src/components/mixer/MixerPanel.tsx | 24 +++++++++++++++---- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 82ecd71..14ae576 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1174,7 +1174,7 @@ Two independent apps that talk over HTTP: / Try again (`backend_restart`). The shell has no timeout of its own. Before ready it answers quit requests itself — nothing can be unsaved — and stops at ready so it never races `QuitGuard`), `SaveBar` (+ "Discard changes…" when - dirty, and the settings gear beside it, whose menu (or `?` anywhere) opens `ShortcutsDialog` — a KEYBOARD MAP (decided 2026-10-15): keys lit in the colour of what they do, a caption explaining the key pointed at or pressed (pressing explains, it never acts: a capture-phase listener keeps the deck's and table's keys from firing), holding or picking ⇧ / Cmd-Ctrl relights it with that layer, mouse gestures listed beneath. It shrinks to fit the dialog and drops the words on the keys when too small. Its content is `lib/shortcuts.ts`, written out BY HAND, so a new or changed shortcut in `lib/deckKeys.ts` / `TrackTable` must be added there too — and `AppSettings` ("Konduktor Settings…": app-level prefs, each with its default in `APP_SETTING_DEFAULTS` and read through `useAppSetting`; today `expandPlaylistFolders` and `exportRootFolder`, both default off — the latter read by the backend at `run_export` and passed down as `ExportPayload.root_folder` — and `timeReadoutDecimals` (0–3, default 1: the deck's ELAPSED / REMAIN, truncated, never rounded)) — and its own panel, `PerformanceSettings` ("Performance mode…", decided 2026-11-03), whose values sit in the same `APP_SETTING_DEFAULTS`: `perfStems` (default on: a stem track loaded INTO performance mode plays its stems, else its mix; read at load, never reloads a deck), `keylockDefault` (on), `autoFocusDeck` (on: any press on a deck focuses it; off: only its A/B badge, a button), `eqKill` (off = -26 dB), `crossfaderSharpness` (0..1, 0 = smooth, default 0.5: a slider beside `CrossfaderCurveGraph`, which draws both channels' curves and where the crossfader is; dragging it moves the mixer at once and saves through the debounced prefs writer), and the Filter FX: `fxFilterRange` (the Filter alone) and `fxEffectRange` (under an effect), each full / musical / gentle, `fxFilterResonance`, `fxReverbSize`, `fxDelayBeats`, `fxCrusherDrive`, `fxFlangerBeats` (the mixer's per-channel PRM knob was removed). PrepStrip copies them into `mixerState`. The Sidebar holds folder open state as per-id overrides of that setting, reset on a new library or a change of the setting, and carried to the new ids when a rename/move changes a folder's path id)), `Toolbar` (search/filters; columns are chosen by right-clicking the table header), + dirty, and the settings gear beside it, whose menu (or `?` anywhere) opens `ShortcutsDialog` — a KEYBOARD MAP (decided 2026-10-15): keys lit in the colour of what they do, a caption explaining the key pointed at or pressed (pressing explains, it never acts: a capture-phase listener keeps the deck's and table's keys from firing), holding or picking ⇧ / Cmd-Ctrl relights it with that layer, mouse gestures listed beneath. It shrinks to fit the dialog and drops the words on the keys when too small. Its content is `lib/shortcuts.ts`, written out BY HAND, so a new or changed shortcut in `lib/deckKeys.ts` / `TrackTable` must be added there too — and `AppSettings` ("Konduktor Settings…": app-level prefs, each with its default in `APP_SETTING_DEFAULTS` and read through `useAppSetting`; today `expandPlaylistFolders` and `exportRootFolder`, both default off — the latter read by the backend at `run_export` and passed down as `ExportPayload.root_folder` — and `timeReadoutDecimals` (0–3, default 1: the deck's ELAPSED / REMAIN, truncated, never rounded)) — and its own panel, `PerformanceSettings` ("Performance mode…", decided 2026-11-03), whose values sit in the same `APP_SETTING_DEFAULTS`: `perfStems` (default on: a stem track loaded INTO performance mode plays its stems, else its mix; read at load, never reloads a deck), `keylockDefault` (on), `autoFocusDeck` (on: any press on a deck focuses it; off: only its A/B badge, a button), `useAutoGain` (on: a channel's gain starts at the track's auto gain; off: 0 dB), `eqKill` (off = -26 dB), `crossfaderSharpness` (0..1, 0 = smooth, default 0.5: a slider beside `CrossfaderCurveGraph`, which draws both channels' curves and where the crossfader is; dragging it moves the mixer at once and saves through the debounced prefs writer), and the Filter FX: `fxFilterRange` (the Filter alone) and `fxEffectRange` (under an effect), each full / musical / gentle, `fxFilterResonance`, `fxReverbSize`, `fxDelayBeats`, `fxCrusherDrive`, `fxFlangerBeats` (the mixer's per-channel PRM knob was removed). PrepStrip copies them into `mixerState`. The Sidebar holds folder open state as per-id overrides of that setting, reset on a new library or a change of the setting, and carried to the new ids when a rename/move changes a folder's path id)), `Toolbar` (search/filters; columns are chosen by right-clicking the table header), `TrackTable` (**the one track list** — All Tracks, playlists, exports and devices. TanStack Table + **virtualized** grid; per-row play button, configurable columns, header sorting, inline double-click editing, and @@ -2805,7 +2805,8 @@ The prep strip plays every track through the **Web Audio API** (a plain rate 1 the stretcher is bypassed. **The mixer** (`lib/audio/mixer.ts`, performance mode phase 4): each deck's engine plays into its CHANNEL (`DeckEngine.create(mixer().input(ch))`): - GAIN (the state's `trim`: the track's `auto_gain_db` + the knob, ±12 dB) → + GAIN (the state's `trim`: the track's `auto_gain_db` — unless the + `useAutoGain` setting is off — + the knob, ±12 dB) → a 3-band ISOLATOR (LR4 crossovers at 250 Hz / 2.5 kHz, the low band through a 2.5 kHz all-pass, so the bands sum flat — measured 0.0000 dB; Web Audio's diff --git a/frontend/src/components/AppSettings.tsx b/frontend/src/components/AppSettings.tsx index 3f47c03..dbbb06e 100644 --- a/frontend/src/components/AppSettings.tsx +++ b/frontend/src/components/AppSettings.tsx @@ -30,6 +30,8 @@ export const APP_SETTING_DEFAULTS = { keylockDefault: true, /** Any press on a deck focuses it (else only its A/B badge). */ autoFocusDeck: true, + /** A channel's gain starts at the track's auto gain (else 0 dB). */ + useAutoGain: 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). diff --git a/frontend/src/components/PerformanceSettings.tsx b/frontend/src/components/PerformanceSettings.tsx index 2ee4093..7cbbe69 100644 --- a/frontend/src/components/PerformanceSettings.tsx +++ b/frontend/src/components/PerformanceSettings.tsx @@ -38,6 +38,7 @@ export function PerformanceSettings({ onClose }: { onClose: () => void }) { const perfStems = useAppSetting('perfStems') const keylockDefault = useAppSetting('keylockDefault') const autoFocusDeck = useAppSetting('autoFocusDeck') + const useAutoGain = useAppSetting('useAutoGain') const eqKill = useAppSetting('eqKill') const sharpnessSetting = useAppSetting('crossfaderSharpness') const fxFilterRange = useAppSetting('fxFilterRange') @@ -104,6 +105,12 @@ export function PerformanceSettings({ onClose }: { onClose: () => void }) {

Mixer

+ void set({ useAutoGain: v })} + title="Use auto gain" + text="Off: every channel starts at 0 dB." + /> mixer().setActive(performance), [performance]) const gainA = decks.A.track?.auto_gain_db ?? null const gainB = decks.B.track?.auto_gain_db ?? null - useEffect(() => mixer().setAutoGain('A', gainA ?? 0), [gainA]) - useEffect(() => mixer().setAutoGain('B', gainB ?? 0), [gainB]) + // The `useAutoGain` setting off: every channel starts at 0 dB. + const useAutoGain = useAppSetting('useAutoGain') + useEffect(() => mixer().setAutoGain('A', useAutoGain ? (gainA ?? 0) : 0), [gainA, useAutoGain]) + useEffect(() => mixer().setAutoGain('B', useAutoGain ? (gainB ?? 0) : 0), [gainB, useAutoGain]) const bpmA = (a.activeMarker?.bpm ?? 0) * a.rate const bpmB = (b.activeMarker?.bpm ?? 0) * b.rate useEffect(() => mixer().setTempo('A', bpmA), [bpmA]) @@ -355,7 +357,7 @@ export function PrepStrip({ , 'flex min-w-0 flex-1 flex-col gap-2', )} - + {pane( 'B', <> diff --git a/frontend/src/components/mixer/MixerPanel.tsx b/frontend/src/components/mixer/MixerPanel.tsx index 2dff49f..962a4fc 100644 --- a/frontend/src/components/mixer/MixerPanel.tsx +++ b/frontend/src/components/mixer/MixerPanel.tsx @@ -64,7 +64,14 @@ function beatsLabel(b: number): string { * them the master meter and the limiter's light; the crossfader beneath. The * values live in `mixerState` and the audio in `mixer.ts`. */ -export function MixerPanel({ autoGain }: { autoGain: Record }) { +export function MixerPanel({ + autoGain, + autoGainOn, +}: { + autoGain: Record + /** The `useAutoGain` setting: off, the gain ignores the track's. */ + autoGainOn: boolean +}) { const meterRefs = { A: useRef(null), B: useRef(null), @@ -109,7 +116,7 @@ export function MixerPanel({ autoGain }: { autoGain: Record
- +
- +
A @@ -162,7 +169,8 @@ function Strip({ mirrored = false, }: { ch: Channel - autoGain: number | null + /** The track's auto gain; null = it has none, undefined = the setting is off. */ + autoGain: number | null | undefined meterRef: RefObject mirrored?: boolean }) { @@ -207,7 +215,13 @@ function Strip({ onChange={(v) => set({ trim: Math.abs(v) < 0.3 ? 0 : v })} label="Gain" describe={(v) => - `Gain ${fmtDb(v)}${autoGain != null ? ` on the track's auto gain (${fmtDb(autoGain)})` : ' (this track has no auto gain)'}` + `Gain ${fmtDb(v)}${ + autoGain === undefined + ? ' (auto gain off)' + : autoGain != null + ? ` on the track's auto gain (${fmtDb(autoGain)})` + : ' (this track has no auto gain)' + }` } /> {eq('high', 'Hi', 'High')}