Skip to content

Commit

Permalink
Manual format changes 3
Browse files Browse the repository at this point in the history
  • Loading branch information
AldaronLau committed Oct 14, 2024
1 parent df0306b commit 7bfa778
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions src/stream/speex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// FIXME: Once remove macros, can delete
#![allow(trivial_casts, trivial_numeric_casts)]

use alloc::{vec, vec::Vec};
use alloc::vec::{self, Vec};
use core::{f64::consts::PI, mem};

#[cfg(not(test))]
Expand Down Expand Up @@ -136,17 +136,15 @@ macro_rules! algo {
}

impl ResamplerState {
/*
* * Resample a float array. The input and output buffers must *not*
* overlap.
* @param st Resampler state
* @param in Input buffer
* @param in_len number of input samples in the input buffer. Returns the
* number of samples processed
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of
* samples written
*/
/// Resample a float array. The input and output buffers must *not* overlap.
///
/// - @param st Resampler state
/// - @param in Input buffer
/// - @param in_len number of input samples in the input buffer. Returns
/// the number of samples processed
/// - @param out Output buffer
/// - @param out_len Size of the output buffer. Returns the number of
/// samples written
pub(crate) fn process_float(
&mut self,
mut in_0: &[f32],
Expand Down Expand Up @@ -199,25 +197,22 @@ impl ResamplerState {
}
}

/*
* * Make sure that the first samples to go out of the resamplers don't
* have
* leading zeros. This is only useful before starting to use a newly
* created resampler. It is recommended to use that when resampling
* an audio file, as it will generate a file with the same length.
* For real-time processing, it is probably easier not to use this
* call (so that the output duration is the same for the first
* frame). @param st Resampler state
*/
/// Make sure that the first samples to go out of the resamplers don't have
/// leading zeros. This is only useful before starting to use a newly
/// created resampler. It is recommended to use that when resampling an
/// audio file, as it will generate a file with the same length. For
/// real-time processing, it is probably easier not to use this call (so
/// that the output duration is the same for the first frame).
///
/// - @param st Resampler state
pub(crate) fn skip_zeros(&mut self) {
let filt_len = self.filt_len / 2;
self.last_sample = filt_len;
}

/*
* * Reset a resampler so a new (unrelated) stream can be processed.
* @param st Resampler state
*/
/// Reset a resampler so a new (unrelated) stream can be processed.
///
/// - @param st Resampler state
#[allow(unused)] // For now.
pub(crate) fn reset_mem(&mut self) {
self.last_sample = 0;
Expand Down

0 comments on commit 7bfa778

Please sign in to comment.