pub struct ReadyNormalization<'a> { /* private fields */ }Expand description
A lazy normalization session shared by CLI and native PCM playback.
Only the current track (or current album’s tags/identities) is inspected. The CLI can measure missing loudness from source PCM already being decoded; native PCM playback only reuses existing gains and does not enable capture. An album decision is frozen for the session, never changed midway through it.
Implementations§
Source§impl<'a> ReadyNormalization<'a>
impl<'a> ReadyNormalization<'a>
Sourcepub fn new(
paths: &'a [PathBuf],
is_album: bool,
catalog: Option<&'a Catalog>,
directory: &Path,
mode: NormalizationMode,
) -> Result<Self, Box<dyn Error>>
pub fn new( paths: &'a [PathBuf], is_album: bool, catalog: Option<&'a Catalog>, directory: &Path, mode: NormalizationMode, ) -> Result<Self, Box<dyn Error>>
Load available measurements without reading audio files or their tags.
Sourcepub fn without_capture(self) -> Self
pub fn without_capture(self) -> Self
Reuse known gains without measuring or publishing new source loudness.
Native PCM transport selects this policy because it does not observe source samples or publish complete-track measurements. Missing track gains retain the existing fallback policy; missing album gain retains one unchanged level. No meter or capture is prepared for unknown values. Calling this after preparation discards any pending optional capture.
Sourcepub fn prepare(
&mut self,
index: usize,
) -> Result<Option<GainPlan>, Box<dyn Error>>
pub fn prepare( &mut self, index: usize, ) -> Result<Option<GainPlan>, Box<dyn Error>>
Choose an already available gain for the current track or album.
Missing source measurements are captured later through observe_source.
Sourcepub fn is_measuring(&self) -> bool
pub fn is_measuring(&self) -> bool
Whether an active meter is capturing source PCM for a later decision.
Sourcepub fn observe_source(
&mut self,
format: PcmFormat,
samples: &[f32],
) -> Result<(), Box<dyn Error>>
pub fn observe_source( &mut self, format: PcmFormat, samples: &[f32], ) -> Result<(), Box<dyn Error>>
Observe decoded source PCM before downmix, rate conversion and effects. Unsupported layouts retain an unavailable result only after a complete decode. Other meter failures abandon the optional capture.
Sourcepub fn finish_track(
&mut self,
index: usize,
complete: bool,
) -> Result<Option<LoudnessUpdate>, Box<dyn Error>>
pub fn finish_track( &mut self, index: usize, complete: bool, ) -> Result<Option<LoudnessUpdate>, Box<dyn Error>>
Publish only fully decoded tracks/programmes with unchanged sources.