Struct ReadyNormalization

Source
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>

Source

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.

Source

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.

Source

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.

Source

pub fn is_measuring(&self) -> bool

Whether an active meter is capturing source PCM for a later decision.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for ReadyNormalization<'a>

§

impl<'a> RefUnwindSafe for ReadyNormalization<'a>

§

impl<'a> Send for ReadyNormalization<'a>

§

impl<'a> Sync for ReadyNormalization<'a>

§

impl<'a> Unpin for ReadyNormalization<'a>

§

impl<'a> UnwindSafe for ReadyNormalization<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,