[][src]Struct ebur128::EbuR128

pub struct EbuR128 { /* fields omitted */ }

EBU R128 loudness analyzer.

Implementations

impl EbuR128[src]

pub fn new(channels: u32, rate: u32, mode: Mode) -> Result<Self, Error>[src]

Create a new instance with the given configuration.

pub fn mode(&self) -> Mode[src]

Get the configured mode.

pub fn channels(&self) -> u32[src]

Get the configured number of channels.

pub fn rate(&self) -> u32[src]

Get the configured sample rate.

pub fn channel_map(&self) -> &[Channel][src]

Get the configured channel types.

pub fn max_window(&self) -> usize[src]

Get the configured maximum window duration in ms.

pub fn max_history(&self) -> usize[src]

Get the configured maximum history in ms.

pub fn set_channel(
    &mut self,
    channel_number: u32,
    value: Channel
) -> Result<(), Error>
[src]

Set channel type.

The default is:

  • 0 -> Left
  • 1 -> Right
  • 2 -> Center
  • 3 -> Unused
  • 4 -> LeftSurround
  • 5 -> RightSurround
  • _ -> Unused

pub fn set_channel_map(&mut self, channel_map: &[Channel]) -> Result<(), Error>[src]

Set channel types.

The default is:

  • 0 -> Left
  • 1 -> Right
  • 2 -> Center
  • 3 -> Unused
  • 4 -> LeftSurround
  • 5 -> RightSurround
  • _ -> Unused

pub fn change_parameters(
    &mut self,
    channels: u32,
    rate: u32
) -> Result<(), Error>
[src]

Change library parameters.

Note that the channel map will be reset when setting a different number of channels. The current unfinished block will be lost.

pub fn set_max_window(&mut self, window: u32) -> Result<(), Error>[src]

Set the maximum window duration.

Set the maximum duration in ms that will be used for EbuR128::loudness_window. Note that this destroys the current content of the audio buffer.

pub fn set_max_history(&mut self, history: u32) -> Result<(), Error>[src]

Set the maximum history.

Set the maximum history in ms that will be stored for loudness integration. More history provides more accurate results, but requires more resources.

Applies to EbuR128::loudness_range and EbuR128::loudness_global when Mode::HISTOGRAM is not set.

Default is ULONG_MAX (at least ~50 days). Minimum is 3000ms for Mode::LRA and 400ms for Mode::M.

pub fn reset(&mut self)[src]

Resets the current state.

pub fn add_frames_i16(&mut self, frames: &[i16]) -> Result<(), Error>[src]

Add interleaved frames to be processed.

pub fn add_frames_i32(&mut self, frames: &[i32]) -> Result<(), Error>[src]

Add interleaved frames to be processed.

pub fn add_frames_f32(&mut self, frames: &[f32]) -> Result<(), Error>[src]

Add interleaved frames to be processed.

pub fn add_frames_f64(&mut self, frames: &[f64]) -> Result<(), Error>[src]

Add interleaved frames to be processed.

pub fn add_frames_planar_i16(&mut self, frames: &[&[i16]]) -> Result<(), Error>[src]

Add planar frames to be processed.

pub fn add_frames_planar_i32(&mut self, frames: &[&[i32]]) -> Result<(), Error>[src]

Add planar frames to be processed.

pub fn add_frames_planar_f32(&mut self, frames: &[&[f32]]) -> Result<(), Error>[src]

Add planar frames to be processed.

pub fn add_frames_planar_f64(&mut self, frames: &[&[f64]]) -> Result<(), Error>[src]

Add planar frames to be processed.

pub fn loudness_global(&self) -> Result<f64, Error>[src]

Get global integrated loudness in LUFS.

pub fn loudness_global_multiple<'a>(
    iter: impl Iterator<Item = &'a Self>
) -> Result<f64, Error>
[src]

Get global integrated loudness in LUFS across multiple instances.

pub fn loudness_momentary(&self) -> Result<f64, Error>[src]

Get momentary loudness (last 400ms) in LUFS.

pub fn loudness_shortterm(&self) -> Result<f64, Error>[src]

Get short-term loudness (last 3s) in LUFS.

pub fn loudness_window(&self, window: u32) -> Result<f64, Error>[src]

Get loudness of the specified window in LUFS.

window must not be larger than the current window. The current window can be changed by calling EbuR128::set_max_window.

pub fn loudness_range(&self) -> Result<f64, Error>[src]

Get loudness range (LRA) of programme in LU.

Calculates loudness range according to EBU 3342.

pub fn loudness_range_multiple<'a>(
    iter: impl IntoIterator<Item = &'a Self>
) -> Result<f64, Error>
[src]

Get loudness range (LRA) of programme in LU across multiple instances.

Calculates loudness range according to EBU 3342.

pub fn sample_peak(&self, channel_number: u32) -> Result<f64, Error>[src]

Get maximum sample peak from all frames that have been processed.

The equation to convert to dBFS is: 20 * log10(out)

pub fn prev_sample_peak(&self, channel_number: u32) -> Result<f64, Error>[src]

Get maximum sample peak from the last call to EbuR128::add_frames.

The equation to convert to dBFS is: 20 * log10(out)

pub fn true_peak(&self, channel_number: u32) -> Result<f64, Error>[src]

Get maximum true peak from all frames that have been processed.

Uses an implementation defined algorithm to calculate the true peak. Do not try to compare resulting values across different versions of the library, as the algorithm may change.

The current implementation uses a custom polyphase FIR interpolator to calculate true peak. Will oversample 4x for sample rates < 96000 Hz, 2x for sample rates < 192000 Hz and leave the signal unchanged for 192000 Hz.

The equation to convert to dBTP is: 20 * log10(out)

pub fn prev_true_peak(&self, channel_number: u32) -> Result<f64, Error>[src]

Get maximum true peak from the last call to EbuR128::add_frames.

Uses an implementation defined algorithm to calculate the true peak. Do not try to compare resulting values across different versions of the library, as the algorithm may change.

The current implementation uses a custom polyphase FIR interpolator to calculate true peak. Will oversample 4x for sample rates < 96000 Hz, 2x for sample rates < 192000 Hz and leave the signal unchanged for 192000 Hz.

The equation to convert to dBTP is: 20 * log10(out)

pub fn relative_threshold(&self) -> Result<f64, Error>[src]

Get relative threshold in LUFS.

Trait Implementations

impl Debug for EbuR128[src]

Auto Trait Implementations

impl RefUnwindSafe for EbuR128

impl Send for EbuR128

impl Sync for EbuR128

impl Unpin for EbuR128

impl UnwindSafe for EbuR128

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.