macro_rules! implement_resampler {
    ($trait_name:ident, $in_type:ty, $out_type:ty) => { ... };
}
Expand description

A macro for implementing wrapper traits for when a Resampler must be object safe. The wrapper trait locks the generic type parameters or the Resampler trait to specific types, which is needed to make the trait into an object.

One wrapper trait, VecResampler, is included per default. It differs from Resampler by fixing the generic types &[AsRef<[T]>] and &mut [AsMut<[T]>] to &[Vec<T>] and &mut [Vec<T>]. This allows a VecResampler to be made into a trait object like this:

let boxed: Box<dyn VecResampler<f64>> = Box::new(FastFixedIn::<f64>::new(44100 as f64 / 88200 as f64, 1.1, PolynomialDegree::Cubic, 2, 2).unwrap());

Use this implementation as an example if you need to fix the input type to something else.