fixed_resample/
lib.rs

1#[cfg(feature = "resampler")]
2mod resampler;
3#[cfg(feature = "resampler")]
4mod resampler_type;
5
6#[cfg(feature = "resampler")]
7pub use resampler::*;
8#[cfg(feature = "resampler")]
9pub use resampler_type::*;
10
11#[cfg(feature = "channel")]
12mod channel;
13#[cfg(feature = "channel")]
14pub use channel::*;
15
16#[cfg(feature = "resampler")]
17pub use rubato;
18
19#[cfg(feature = "resampler")]
20pub use rubato::Sample;
21
22/// The trait governing a single sample.
23///
24/// There are two types which implements this trait so far:
25/// * [f32]
26/// * [f64]
27#[cfg(not(feature = "resampler"))]
28pub trait Sample
29where
30    Self: Copy + Send,
31{
32    fn zero() -> Self;
33}
34
35#[cfg(not(feature = "resampler"))]
36impl Sample for f32 {
37    fn zero() -> Self {
38        0.0
39    }
40}
41
42#[cfg(not(feature = "resampler"))]
43impl Sample for f64 {
44    fn zero() -> Self {
45        0.0
46    }
47}