mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
7a7a9f5e6b
111 of 122 top-level src/utils/ files move into 16 topic folders (audio, cache, cover, share, server, playback, playlist, deviceSync, waveform, mix, format, export, changelog, ui, perf, componentHelpers). True singletons with no cluster stay at the utils/ root. Pure file-move: a path-aware codemod rewrote 539 relative-import specifiers across 275 files; no logic touched. The hot-path coverage gate list (.github/frontend-hot-path-files.txt) is updated to the new paths for the 11 gated utils files — a mechanical consequence of the move, not a CI change. tsc is green.
16 lines
587 B
TypeScript
16 lines
587 B
TypeScript
/**
|
|
* Before SQLite has integrated LUFS, match Rust `loudness_gain_placeholder_until_cache`:
|
|
* pivot at -14 LUFS, `true_peak = 0` (no EBU headroom cap), then add pre-attenuation from settings.
|
|
*/
|
|
const PLACEHOLDER_INTEGRATED_LUFS = -14;
|
|
|
|
export function loudnessGainPlaceholderUntilCacheDb(
|
|
targetLufs: number,
|
|
preAnalysisAttenuationDb: number,
|
|
): number {
|
|
const pre = Math.min(0, Math.max(-24, preAnalysisAttenuationDb));
|
|
let pivot = targetLufs - PLACEHOLDER_INTEGRATED_LUFS;
|
|
pivot = Math.max(-24, Math.min(24, pivot));
|
|
return Math.max(-24, Math.min(24, pivot + pre));
|
|
}
|