mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 15:11:58 +01:00
Second slice: read the gain synced in the first one and scale the decoded PCM by it. - `ReplayGainProcessor` is a `BaseAudioProcessor` that scales 16-bit and float samples, saturating on overflow rather than wrapping. It is installed through `DefaultAudioSink`'s audio processor chain, so it runs ahead of the default silence-skip and speed processors. - `replayGainLinearGain` picks the track or album gain according to the mode, falls back to the other gain when one is missing, adds the preamp, and caps the result at the peak's headroom so a boost cannot clip. A non-positive peak means the server has no peak data and is ignored. - `ReplayGainMode` and the preamp live in `UserPreferences`, defaulting to track mode and 0 dB. The settings UI is still to come. - `PlaybackService` resolves the current song's gain alongside its star state and applies it on every media item transition. The processor only runs while the audio processor chain does, which `DefaultAudioSink` skips when float output is enabled. That stays off, as it is by default.