Function select

Source
pub fn select(
    file: &AudioFile,
    mode: Mode,
    target_lufs: f32,
) -> Result<Option<Selection>, Error>
Expand description

Choose a gain for a file without altering its tags or audio.

target_lufs is explicit so a future player can choose its listening reference. ReplayGain uses a nominal -18 LUFS reference; Opus R128 uses -23 LUFS. On Opus, R128 wins over ReplayGain when both are present. Within a scheme, the other scope is used only when the requested scope is absent. A malformed selected tag is an error, not a reason to fall back silently.

This returns None when normalization is off or no supported tag exists. A returned gain can produce samples above full scale; the output adapter must handle them when it converts floating-point PCM for the audio device.