mixr/
lib.rs

1pub mod system;
2pub mod loaders;
3pub mod binary_reader;
4mod cmixr;
5
6#[derive(Clone, Debug)]
7#[repr(C)]
8pub struct AudioFormat {
9    pub channels: u8,
10    pub sample_rate: i32,
11    pub bits_per_sample: u8
12}
13
14impl Default for AudioFormat {
15    fn default() -> Self {
16        Self {
17            channels: 2,
18            sample_rate: 48000,
19            bits_per_sample: 16
20        }
21    }
22}
23
24#[derive(Clone, Debug, Copy)]
25#[repr(C)]
26pub enum InterpolationType {
27    None,
28    Linear
29}
30
31#[derive(Clone, Debug)]
32#[repr(C)]
33pub struct ChannelProperties {
34    pub volume: f64,
35    pub speed: f64,
36    pub panning: f64,
37    pub looping: bool,
38    pub interpolation_type: InterpolationType
39}
40
41impl Default for ChannelProperties {
42    fn default() -> Self {
43        Self { volume: 1.0, speed: 1.0, panning: 0.5, looping: false, interpolation_type: InterpolationType::Linear }
44    }
45}
46
47#[repr(C)]
48pub enum ChannelState {
49    Playing,
50    Stopped
51}
52
53#[repr(C)]
54pub enum AudioResult {
55    Ok,
56
57    InvalidBuffer,
58    InvalidChannel,
59    NoChannels
60}