miniaudio/
lib.rs

1/// This is a panic which only occurs in debug mode.
2#[cfg(debug_assertions)]
3const MA_DEBUG_PANIC: bool = true;
4#[cfg(not(debug_assertions))]
5const MA_DEBUG_PANIC: bool = false;
6
7macro_rules! ma_debug_panic {
8    ($($Arg:expr,)*) => {
9        if $crate::MA_DEBUG_PANIC {
10            panic!($($Arg,)*)
11        }
12    };
13
14    ($($Arg:expr),*) => {
15        if $crate::MA_DEBUG_PANIC {
16            panic!($($Arg,)*)
17        }
18    };
19}
20
21/// This macro will execute a success block if a result is a MA_SUCCESS block
22/// and return the value of that block wrapped in a Result::Ok. If $Result is an error this will
23/// return an Error enum wrapped in a Result::Err.
24macro_rules! map_result {
25    ($Result:expr, $Success:expr) => {
26        if $crate::base::Error::is_c_error($Result) {
27            Err($crate::base::Error::from_c_error($Result))
28        } else {
29            Ok($Success)
30        }
31    };
32}
33
34macro_rules! impl_from_c {
35    ($RustType:ty, $CType:ty) => {
36        impl $RustType {
37            pub fn from_c(c_enum: $CType) -> $RustType {
38                unsafe { std::mem::transmute(c_enum) }
39            }
40        }
41    };
42}
43
44mod base;
45mod channel_conv;
46mod conversion;
47mod data_conv;
48mod decoder;
49mod device_io;
50mod filters;
51mod frames;
52mod generation;
53mod lock;
54mod resampling;
55mod ring_buffers;
56
57pub use base::*;
58pub use channel_conv::*;
59pub use conversion::*;
60pub use data_conv::*;
61pub use decoder::*;
62pub use device_io::*;
63pub use filters::*;
64pub use frames::*;
65pub use generation::*;
66pub use resampling::*;
67pub use ring_buffers::*;