diff options
Diffstat (limited to 'c2enc')
| -rw-r--r-- | c2enc/Cargo.toml | 10 | ||||
| -rw-r--r-- | c2enc/src/main.rs | 19 |
2 files changed, 29 insertions, 0 deletions
diff --git a/c2enc/Cargo.toml b/c2enc/Cargo.toml new file mode 100644 index 0000000..86d4408 --- /dev/null +++ b/c2enc/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "c2enc" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +byteorder = "1.4.3" +libcodec2 = { version = "0.1.0", path = "../libcodec2" } diff --git a/c2enc/src/main.rs b/c2enc/src/main.rs new file mode 100644 index 0000000..d8ee9c1 --- /dev/null +++ b/c2enc/src/main.rs @@ -0,0 +1,19 @@ +extern crate byteorder; +extern crate libcodec2; + +use byteorder::{LittleEndian, ReadBytesExt}; +use std::fs::File; +use std::io::prelude::*; +use std::io::Cursor; +use std::path::Path; + +fn main() { + let path = Path::new("../../codec2/wav/cross.wav"); + let mut file = File::open(&path).unwrap(); + let mut buf = Vec::new(); + file.read_to_end(&mut buf).unwrap(); + let mut rdr = Cursor::new(buf); + while let Ok(res) = rdr.read_i16::<LittleEndian>() { + println!("{}", res); + } +} |
