euphony_mix/
lib.rs

1pub use dasp_frame as frame;
2use euphony_dsp::sample::{self, DefaultSample as Sample, FromSample};
3use euphony_units::coordinates::Cartesian;
4
5mod bformat;
6pub mod distance;
7pub mod mono;
8pub mod stereo;
9
10#[derive(Clone, Copy, Debug, Default)]
11pub struct SpatialSample<Coordinate = Cartesian<Sample>> {
12    pub value: Sample,
13    pub coordinate: Coordinate,
14}
15
16pub trait Mixer {
17    type Error;
18
19    fn skip(&mut self, samples: usize) -> Result<(), Self::Error>;
20    fn mix(&mut self, samples: &[SpatialSample]) -> Result<(), Self::Error>;
21}
22
23pub trait Writer {
24    type Error;
25    type Sample: sample::Sample + FromSample<Sample>;
26    type Frame: frame::Frame<Sample = Self::Sample>;
27
28    fn skip(&mut self, frames: usize) -> Result<(), Self::Error>;
29    fn write(&mut self, frame: Self::Frame) -> Result<(), Self::Error>;
30}