Struct replaygain::ReplayGain
source · pub struct ReplayGain { /* private fields */ }
Implementations§
source§impl ReplayGain
impl ReplayGain
sourcepub fn new(sample_rate: usize) -> Option<ReplayGain>
pub 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.
sourcepub fn frame_size(&self) -> usize
pub 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.
sourcepub fn process_frame(&mut self, frame: &[f32])
pub 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.
sourcepub fn process_samples(&mut self, frame: &[f32])
pub 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.