Struct replaygain::ReplayGain
[−]
[src]
pub struct ReplayGain { /* fields omitted */ }
Methods
impl ReplayGain
[src]
fn new(sample_rate: usize) -> Option<ReplayGain>
Create a new ReplayGain filter for the given sample rate.
Returns None
if the sample rate is not supported.
fn frame_size(&self) -> usize
Returns the size of a single audio frame (one of which we analyze at a time) in floats. Note that because we expect stereo audio, this means that you need to divide this by 2 to get the number of samples.
fn process_frame(&mut self, frame: &[f32])
Processes a single audio frame.
Panics
Panics if frame.len() != self.frame_size()
or if there's anything in
process_samples
's buffer.
If you need buffering, use process_samples()
and only that instead.
fn process_samples(&mut self, frame: &[f32])
Processes a given amount of audio samples.
Note that because we expect stereo audio, it doesn't actually make sense to pass
an odd number of floats to this function but we buffer it to chunks of frame_size()
anyways so we don't care.
fn finish(self) -> (f32, f32)
Completes the analysis and returns the two replaygain values (gain, peak).