1pub use decode::decode_silk;
2pub use encode::encode_silk;
3pub use error::SilkError;
4
5mod decode;
6mod encode;
7mod error;
8
9macro_rules! fast_check {
10 ($call:expr) => {{
11 let code = $call;
12 if code != 0 {
13 return Err(SilkError::from(code));
14 }
15 }};
16}
17
18pub(crate) use fast_check;
19
20#[allow(dead_code)]
21#[allow(non_camel_case_types)]
22#[allow(non_snake_case)]
23#[allow(non_upper_case_globals)]
24pub(crate) mod sdk {
25 include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
26}
27
28#[cfg(test)]
29mod tests {
30 use crate::decode_silk;
31 use crate::encode_silk;
32
33 #[test]
34 fn test_encode() {
35 let input = std::fs::read("input.pcm").unwrap();
36 let output = encode_silk(input, 24000, 24000, true).unwrap();
37 std::fs::write("output.silk", output).unwrap();
38 }
39
40 #[test]
41 fn test_decode() {
42 let input = std::fs::read("input.silk").unwrap();
43 let output = decode_silk(input, 24000).unwrap();
44 std::fs::write("output.pcm", output).unwrap();
45 }
46}