summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--c2enc/Cargo.toml10
-rw-r--r--c2enc/src/main.rs19
3 files changed, 30 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1c967e4..a445449 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,4 +3,5 @@
members = [
"libcodec2",
"codec2-sys",
+ "c2enc",
]
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);
+ }
+}