shady_audio/interpolation/
mod.rs1mod context;
4mod cubic_spline;
5mod linear;
6mod nothing;
7
8use std::slice::IterMut;
9
10pub use cubic_spline::CubicSplineInterpolation;
11pub use linear::LinearInterpolation;
12pub use nothing::NothingInterpolation;
13
14pub trait Interpolater {
15 fn interpolate(&mut self, buffer: &mut [f32]);
16
17 fn supporting_points_mut(&mut self) -> IterMut<'_, SupportingPoint>;
18}
19
20pub trait InterpolationInner: Interpolater + Sized {
21 fn new(supporting_points: impl IntoIterator<Item = SupportingPoint>) -> Self;
22
23 fn boxed(supporting_points: impl IntoIterator<Item = SupportingPoint>) -> Box<Self> {
24 Box::new(Self::new(supporting_points))
25 }
26}
27
28#[derive(Debug, Clone, PartialEq)]
29pub struct SupportingPoint {
30 pub x: usize,
32
33 pub y: f32,
35}
36
37#[derive(Debug, Clone, PartialEq, Eq)]
38struct InterpolationSection {
39 pub left_supporting_point_idx: usize,
42
43 pub amount: usize,
46}