Autogain is now a toggleable performance setting

This commit is contained in:
patben8 committed 2026-11-03 12:18:34 +01:00
1 parent 5d1bfcf7f1
commit f55b8f06e4
5 files changed
+36 -10

No files matched your search

+3 -2
View File
@@ -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
+2
View File
@@ -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).
@@ -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 }) {
</section>
<section className="space-y-2">
<h3 className={section}>Mixer</h3>
<Check
checked={useAutoGain}
onChange={(v) => void set({ useAutoGain: v })}
title="Use auto gain"
text="Off: every channel starts at 0 dB."
/>
<Choice
title="EQ full left"
value={eqKill ? 'kill' : 'cut'}
+5 -3
View File
@@ -188,8 +188,10 @@ export function PrepStrip({
useEffect(() => 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',
)}
<MixerPanel autoGain={{ A: gainA, B: gainB }} />
<MixerPanel autoGain={{ A: gainA, B: gainB }} autoGainOn={useAutoGain} />
{pane(
'B',
<>
+19 -5
View File
@@ -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<Channel, number | null> }) {
export function MixerPanel({
autoGain,
autoGainOn,
}: {
autoGain: Record<Channel, number | null>
/** The `useAutoGain` setting: off, the gain ignores the track's. */
autoGainOn: boolean
}) {
const meterRefs = {
A: useRef<HTMLDivElement>(null),
B: useRef<HTMLDivElement>(null),
@@ -109,7 +116,7 @@ export function MixerPanel({ autoGain }: { autoGain: Record<Channel, number | nu
return (
<div className="well flex w-[26rem] shrink-0 flex-col gap-1.5 rounded-2xl px-2.5 pb-1.5 pt-2.5">
<div className="flex min-h-0 flex-1 items-stretch gap-2">
<Strip ch="A" autoGain={autoGain.A} meterRef={meterRefs.A} />
<Strip ch="A" autoGain={autoGainOn ? autoGain.A : undefined} meterRef={meterRefs.A} />
<div className="flex w-3 flex-col items-center gap-1" title="Master — after the limiter">
<MeterBar fillRef={meterRefs.master} />
<span
@@ -121,7 +128,7 @@ export function MixerPanel({ autoGain }: { autoGain: Record<Channel, number | nu
LIM
</span>
</div>
<Strip ch="B" autoGain={autoGain.B} meterRef={meterRefs.B} mirrored />
<Strip ch="B" autoGain={autoGainOn ? autoGain.B : undefined} meterRef={meterRefs.B} mirrored />
</div>
<div className="flex h-6 shrink-0 items-center justify-center gap-2 px-1">
<span className="font-mono text-[11px] font-semibold text-muted">A</span>
@@ -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<HTMLDivElement | null>
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')}